Not sure whats wrong, what you mean by batch, the JEE7 batching API? Or a simple standalone client as batch?
Could you elaborate on this?
Simple standalone client as batch.
Standalone java program trying to invoke EJB, its throwing exception while JNDI lookup: Can not find EJB by JNDI name:
Same JNDI lookup works fine while accessing in Web application.
In the dass you should real the er documentation how to connect to the server. You Meer to usw a jboss-ejb-client.properties file.If you have questions onthat you should attach the Client code.
Here is the code, its working fine when I call from struts action which is part of WAR file.
Application is deployed as EAR which has WAR and EJB Jar.
String homeInterfaceName = AppointmentProcessHome.class.getName(); Properties jndiProps = new Properties(); jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory"); jndiProps.setProperty(Context.PROVIDER_URL,"remote://localhost:4447"); Context context = new InitialContext(jndiProps); Object objref = context.lookup("ejb:PatientInfoEAR/PatientInfoEJB/AppointmentProcessEJB!"+homeInterfaceName); AppointmentProcessHome home = (AppointmentProcessHome)PortableRemoteObject.narrow(objref, AppointmentProcessHome.class);
AppointmentProcess aptProcess = home.create();
when I use this code in standalone Java client (called inside main() method) it throws exception: Can not find EJB by JNDI name:
While calling from standalone java clinet, EAR is deployed on Wildfly server and its running.
I am trying to run standalone Java client from another command prompt.
It worked after adding jboss-ejb-client.properties file in classpath.
Thanks for help,