Hello,
I have the same problem. Have you found a solution yet?
I have JBoss 4.0.4GA and a .ear archive with a bla-server.spring archive
inside. The spring deployer does its job well and the ApplicationContext is
created and registered to local JNDI:
| 11:49:27,755 INFO [ApplicationContextLoaderImpl] Bean factory [bla-server]
binded to local JNDI.
|
The JNDIView lists the bound object in the gloabal namespace:
| +- bla-server (class: org.jboss.spring.factory.NamedXmlApplicationContext)
|
With the following code it is not possible to access the bound object when the
snippet is run from outside the container.
| Hashtable<String,String> environment = new Hashtable<String,String>();
|
environment.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
|
environment.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
| environment.put("java.naming.provider.url","jnp://localhost:1099");
|
| try {
| initialContext = new InitialContext(environment);
| }
| catch (NamingException exception) {
| fail("Could not create InitialContext.Exception:"+exception);
| return;
| }
| try {
| this.ac = (ApplicationContext)initialContext.lookup("bla-server");
| }
| catch (NamingException exception) {
| fail("Could not obtain 'bla-server' ApplicationContext:"+exception);
| return;
| }
|
I want to access the ApplicationContext from the outside to test my beans and
the associated ejb3 persistence which are inside the container. Access from
inside the container is no problem.
Is there a way to register the ApplicationContext in a way it is visible from
the outside? On a more general note I would be interested in how people do test
there beans when they rely on the container.
Regards,
Ricky
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986481#3986481
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986481
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user