-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
1.1.0.Beta5
-
None
-
User Experience
-
I cannot deploy file with name "datasource.xml" into embedded container.
Got the following in stack trace while loading JNDI component:
Caused by: javax.naming.NameNotFoundException: PostgresDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
The fun this is that it's actual just for name "datasource.xml". If I change it to some other name the file will be deployed without any problems.
Seems "datasource.xml" is hardcoded in some way in embedded container.
Sample code:
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
Embedded container; // initialized with Spring <bean id="container" class="org.jboss.jca.embedded.EmbeddedFactory" factory-method="create"/>
container.startup();
container.deploy("jdbc-xa.rar");
container.deploy("datasource.xml");