Exception in thread "main" 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
Although the reason for the above error is very differen However, Context.listBinding() or listing will not work in JBoss AS 7.1.1 due to : https://issues.jboss.org/browse/AS7-5492
Please try the later versions. May be JBoss EAP 6.1 and above.
Exception in thread "main" 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(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
Additionally.... in order to avoid the exception which you are getting as above you will need to make sure that you are creating the InitialContext as mentioned in the below link, And need to make sure that the JBOSS_HOME/bin/client/jboss-client-7.1.0.Final.jar jar is present in client classpath along with the jboss-ejb-client.properties file in the classpath of the client.
I have jboss-client*.jar and jboss-ejb-client.properties file in my class path. I am able to invoke EJBs remotely, but unable to get user transaction through JNDI lookup. Its throwing above mentioned exception.
Any thoughts on this will be appreciated...
To get a UserTransaction you need to use this
in JBossAS7, there is no other way. As you see you need to know at least one of the target node names.
WildFly is about to change that, but I'm not sure when that will happen.
Thank you Wolf-Dieter Fink.
Do you have any idea about how to get all the EJBs that are deployed in Jboss AS7?
In previous versions, context.list("") use to do the job.
As mentioned earlier there were some issues reported: https://issues.jboss.org/browse/AS7-5492
That is fixed on JBoss EAP 6.1.0.Alpha (7.2.0.Final)
So first try the upgraded version of JBoss ^^
Once that is done then you will have to use the "remote-naming" approach here if you want to call the "context.listBindings()"
Properties<String, String> prop = new Properties<String, String>();
NOTE: If you will try with the "ejb-client-api" based approach to call "context.listBindings()" then it won't work as it is not supported by "ejb-client-api" approach