Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENC problem #1

Closed
JeromeSimmonds opened this issue Jan 27, 2017 · 6 comments
Closed

ENC problem #1

JeromeSimmonds opened this issue Jan 27, 2017 · 6 comments

Comments

@JeromeSimmonds
Copy link

Hi,

I am trying to load:

InitialContext ic = new InitialContext();
ic.lookup("java:jboss/datasources/my_ds");

But I get the error Invalid subcontext 'java:jboss' in context ''

Content of the src/test/resources/jndi.properties file:

java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
org.osjava.sj.root=src/test/resources/jndi
org.osjava.sj.delimiter=/
org.osjava.sj.space=java
org.osjava.sj.jndi.shared=true

Content of the src/test/resources/jndi/jboss/datasources.properties file:

my_ds.type=javax.sql.DataSource
my_ds.driver=com.mysql.jdbc.Driver
my_ds.url=jdbc:mysql://localhost:3306/my_ds
my_ds.user=xxx
my_ds.password=xxx

What is wrong? Thanks!

@h-thurow
Copy link
Owner

h-thurow commented Jan 28, 2017 via email

@JeromeSimmonds
Copy link
Author

JeromeSimmonds commented Jan 28, 2017

Hi,

Thanks for your answer.
So I changed the property in src/test/resources/jndi.properties:
org.osjava.sj.space=java:jboss

Then I moved src/test/resources/jndi/jboss/datasources.properties to src/test/resources/jndi/datasources.properties

Now I don't get the error anymore but
ic.lookup("java:jboss/datasources/my_ds");
returns null...

@h-thurow
Copy link
Owner

h-thurow commented Jan 29, 2017

Hi,

because you set org.osjava.sj.delimiter=/ you have to use "/" as namespace separator in datasources.properties too:

my_ds/type=javax.sql.DataSource
my_ds/driver=com.mysql.jdbc.Driver
my_ds/url=jdbc:mysql://localhost:3306/my_ds
my_ds/user=xxx
my_ds/password=xxx

@JeromeSimmonds
Copy link
Author

Thanks!

@h-thurow
Copy link
Owner

h-thurow commented Jan 30, 2017 via email

@h-thurow h-thurow reopened this Jan 30, 2017
@h-thurow
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants