EJB Deployment

Hi guys,

i have created one .ear project in WebSphere Studio Application Developer IDE 5.0 and it contains a web module named TestWeb and an EJB module TestEJB after i deploy the .ear project on server i can access servlet in the browser and EJB using Universal Test Client ejb lookup so i don't need to write the code to access the EJB the jndi exploerer automatically does it by clicks itself but my question is is there a way by which we can write an explicit client code within IDE to access the EJBs just like we normally write the JNDI lookup client code for accessing ejb modules be attentive my question is not to know how to access ejb using client that i already know within the WSAD environment itself so relevant help would be greatly appreciated.

Regards,

Parshva Kamdar.

[810 byte] By [pkamdar2000a] at [2007-11-27 4:14:58]
# 1

Hi Parshva,

As i understand your question is the following

Is there a way by which we can write an explicit client code within IDE to access the EJBs just like we normally write the JNDI lookup client code for accessing ejb modules.

My answer is

--

Yes you can and You should do it that way only.

You must access your EJB via JNDI lookup code in your clients

regards

minkeya at 2007-7-12 9:21:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Hi,

i wrote the client code and run the program after that it is giving the following exception

javax.naming.ConfigurationException: The property com.ibm.ws.naming.wsn.factory.initial is not set. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/jndiprovider.properties cannot be found by the class loader.

at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:190)

at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:108)

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)

at javax.naming.InitialContext.init(InitialContext.java:231)

at javax.naming.InitialContext.<init>(InitialContext.java:207)

at client.SampleClient.main(SampleClient.java:28)

Exception in thread "main"

so please guide me.

thanks,

Parshva Kamdar.

pkamdar2000a at 2007-7-12 9:21:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Probably u shud set CLASSPATH pointing to namingclient.jar, cmImpl.jar, j2cImpl.jar, properties and Use IBM JDK in \WebSphere\AppServer\javaHope this helps,Regards,Sourabh
SourabhGoeLa at 2007-7-12 9:21:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

Hi,

first of all thanks a lot for your response and guidence as per your instructions regarding steps i included namingclient.jar and cmimpl.jar and j2cimpl.jar in the classpath but i could not understand about properties you mentioned so i guess because of that it is giving this error as below so please refocus on that how i need to include properties and i run the program from WSAD Run option so also guide me how to use IBM JDK i am listing the exception i got after including the above mentioned .jar files in my classpath as Add External Jars options.

Unable to read required resource: implfactory.properties

java.lang.NullPointerException

at java.io.Reader.<init>(Reader.java(Inlined Compiled Code))

at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))

at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))

at java.util.Properties.load(Properties.java(Compiled Code))

at com.ibm.ws.util.ImplFactory$1.run(ImplFactory.java:38)

at java.security.AccessController.doPrivileged(Native Method)

at com.ibm.ws.util.ImplFactory.<clinit>(ImplFactory.java:33)

at com.ibm.ejs.jts.jts.CurrentFactory.<clinit>(CurrentFactory.java:56)

at com.ibm.ws.wlm.client.affinity.TransactionAffinityModule.<init>(TransactionAffinityModule.java:168)

at java.lang.reflect.Constructor.newInstance(Native Method)

at com.ibm.ws.wlm.client.affinity.AffinityManager.<init>(AffinityManager.java:109)

at com.ibm.ws.wlm.client.WLMClient.init(WLMClient.java:146)

at com.ibm.rmi.corba.PluginRegistry.loadPlugins(PluginRegistry.java:276)

at com.ibm.rmi.corba.ORB.initializePlugins(ORB.java:345)

at com.ibm.CORBA.iiop.ORB.initializePlugins(ORB.java:845)

at com.ibm.rmi.corba.ORB.orbParameters(ORB.java:1168)

at com.ibm.CORBA.iiop.ORB.orbParameters(ORB.java:1102)

at com.ibm.rmi.corba.ORB.set_parameters(ORB.java:1101)

at com.ibm.CORBA.iiop.ORB.set_parameters(ORB.java:1639)

at org.omg.CORBA.ORB.init(ORB.java:406)

at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:77)

at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:189)

at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:98)

at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:74)

at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:367)

at java.lang.reflect.Method.invoke(Native Method)

at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:313)

at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:363)

at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)

at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)

at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)

at javax.naming.InitialContext.lookup(InitialContext.java:359)

at src.SampleClient.main(SampleClient.java:28)

exception caught inside catch javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider url: "iiop://localhost:2809/". Make sure that the host and port information is correct and that the server identified by the provider url is a running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network environment or workstation network configuration. [Root exception is org.omg.CORBA.UNKNOWN:minor code: 0 completed: Maybe]

javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider url: "iiop://localhost:2809/". Make sure that the host and port information is correct and that the server identified by the provider url is a running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network environment or workstation network configuration. Root exception is org.omg.CORBA.UNKNOWN:minor code: 0 completed: Maybe

at com.ibm.CORBA.iiop.ClientDelegate.intercept(ClientDelegate.java:966)

at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:528)

at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:713)

at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:258)

at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)

at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1090)

at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:676)

at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:604)

at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:478)

at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)

at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)

at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)

at javax.naming.InitialContext.lookup(InitialContext.java:359)

at src.SampleClient.main(SampleClient.java:28)

Thanks,

Parshva.

pkamdar2000a at 2007-7-12 9:21:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Hi,M really sorry, I dint check this thread earlier.....maybe u have already received solution to this....but I forgot to mention that u have to add implfactory.jar to ur class path. This should have a file called implfactory.properties.Regards
SourabhGoeLa at 2007-7-12 9:21:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...