EJB lookup from remote client
ghosh_nandita Nov 6, 2012 5:02 AMHi
I am a new bie in EJB3.x .I am writing JUNIT test cases for ejb which is deployed in JBOSS7.1 FINAL using remote client.
I have used all the maven dependency https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
I have jboss-ejb-client.properties in my class path.
and when i browsed through internet i found one option
System.out.println(getClass().getClassLoader().getResourceAsStream(
"jboss-ejb-client.properties"));
it returns
java.io.BufferedInputStream@6267fe80
Following is the jboss-ejb-clent.properties
--------------
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
#remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=admin123
remote.connection.default.password=jboss
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
java.naming.provider.url=remote://localhost:4447
jboss.naming.client.ejb.context=true
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=true
remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
log4j.logger.org.jboss.ejb.client=TRACE
--------------------
But i get the following error when i try to run the test cases.
----------------
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392
------------------
Please help in solving this error
Thanks in advance