Tuesday 21 April 2009

5-Writing JAVA Clients for Calling BEA WebLogic EJBs

V- How to deploy and test

Unfortunately, my WebLogic CONSOLE does not and has not ever worked. So, I use WLST console.
1st step: Start Jdev
2. step: Start WebLogic server from the menu.
3. step:Start WLST from main computer Programs menu, Weblogic Server, Tools, WebLogic Scripting Tool
4. step Connect connect('weblogic','weblogic','t3://localhost:7101')
5.th step undeploy(‘java2s’) if necessary
6.th step deploy("java2s","C:/EJBstateless/deploy/java2s.jar","DefaultServer",securityModel="Advanced", block="true")
Here, C:/EJBstateless… is the directory where I have put the generated EJB jar. DefaultServer is the server I use.
7th step: Return back and run the client with the
ant run
command.

IMPORTANT NOTE: Converting JBOSS EJBs to WebLogic has a terrible pitfall. You generate the jar file than deploy it but when it comes to testing the client does not do anything. The worst of it there is not any warning etc message. It seems all is well, deployment is successfull but there is not anything wrong.
Some things and tools I used for debugging:

The use of other deployment options such as:
deploy("java2s","C:/EJBstateless/deploy/java2s.jar" ,"DefaultServer", 'nostage', libraryModule="true", subModuleTargets='CountBean@DefaultServer', securityModel="Advanced", securityValidationEnabled="false", block="true")


Check whether the EJB exists: Which looks OK.
listApplications()

tried to use NodeManager with no success, I have to fix it:
nmConnect('weblogic','weblogic','localhost','7101','DefaultDomain', 'DefaultDomain', 'C:/oracle/Middleware/user_projects/applications/DefaultDomain','plain')

tried to start and stop the application: Looked OK.
startApplication('java2s')
stopApplication('java2s')

tried to change the EJB definitions such as:
You should : 1 - Declare the JNDI name on the ejb annotation : @Stateless(name = "TestBean", mappedName = "TestBean") public class TestBean implements Test { ...

I read that WebLOGIC EJB2s must be serialized in order to work. I tried that one with no success either for the EJBs that I was trying to convert from JBOSS.


It always came down to this error:

[java] javax.naming.NameNotFoundException: While trying to lookup 'ejb.Coun
tBean.remote' didn't find subcontext 'CountBean'. Resolved 'ejb' [Root exception
is javax.naming.NameNotFoundException: While trying to lookup 'ejb.CountBean.re
mote' didn't find subcontext 'CountBean'. Resolved 'ejb']; remaining name 'Count
Bean/remote'

(
prev ) ( next )