Blog

JNDI lookup on EJB hosted on WAS

these files must be included in deplyment assembly in client
com.ibm.was.thinclient.jar
com.ibm.was.orb.jar
set following properties via: system.setproperty(key,value);
-Djavax.ext.dirs="<WAS_CLIENT>/java/jre/lib:<WAS_CLIENT>/java/jre/lib/ext:<WAS_CLIENT>/lib:<WAS_CLIENT>/plugins"
add following files to the deployment assembly
-classpath "PluggableClient.jar:HelloEJBClient.jar" com.test.PluggableClient
ssl connection vua client to was server was not successful but if it was these are the properties for ssl connection: (we disabled the ssl connection from server)
set following properties via: system.setproperty(key,value);

-Dcom.ibm.SSL.ConfigURL=file:$profile_root/properties/ssl.client.props

-Dcom.ibm.CORBA.ConfigURL=file:$profile_root/properties/sas.client.props

You may also have to set these params too or hardcode them in sas.client.props, I noticed that the prompt kept timing out waiting for login credentials if I did not include these ones.

-Dcom.ibm.CORBA.loginUserid=${WasUserid}

-Dcom.ibm.CORBA.loginPassword=${WasPassword}

-Dcom.ibm.CORBA.loginSource=properties

just noticed that my listener address / url format is different too: -Djava.naming.provider.url=iiop://localhost:${ORB_LISTENER_ADDRESS} . You can find the orb listener port in config/cells//nodes//serverindex.xml .  

 

need these code to get context facory

env.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
env.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put("java.naming.provider.url", "corbaloc::myhost:2809");
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("ejb/ejbs/HelloHome");
 HelloHome home = (HelloHome) PortableRemoteObject.narrow(obj,                      HelloHome.class);
            HelloBean bean = home.create();
            System.out.println("EJB Output -> " + bean.hello());.

 

PortableRemoteObject is needed because we have stub in client and need to extract interface and object from it. 

we also need adding stub to client project by creating stub from EJB.jar file and including just stubes in the output jar and sending it to deployment assembly

Unable to lookup remote EJB on Websphere 8

SSL is by default turned on for IIOP

 

(WebSphere Application Server7 and 8) Disabling Secure Socket Layer (SSL) for RMI/IIOP

 

How to lookup an EJB and other Resources in WebSphere Application Server using a Oracle JDK client

 

PortableRemoteObject.narrow EJB3

Create stubs command

 

Why do I have to lookup an EJB stub per JNDI if it is already in the client class path?

 

 

 


 these setup makes CDI not working

 

 

0 Comments :

Comment

All Categories