Tuesday, 21 April 2009

7-Writing JAVA Clients for Calling BEA WebLogic EJBs


VII-ejb-jar.xml and other xml file issue for identifying EJBs

After this point I began to think about the way I defined my EJBs. I certainly, deployed them but they did not work so there must be something related to the way I defined them. So, I began to chang ejb-jar.xml, and tried to get error messages by injecting intentional mistakes. I got the below messages:

VALIDATION PROBLEMS WERE FOUND
problem: cvc-complex-type.2.4a: Expected elements
'remote@http://java.sun.com/xml/ns/javaee
local-home@http://java.sun.com/xml/ns/javaee
local@http://java.sun.com/xml/ns/javaee
business-local@http://java.sun.com/xml/ns/javaee
business-remote@http://java.sun.com/xml/ns/javaee
service-endpoint@http://java.sun.com/xml/ns/javaee
ejb-class@http://java.sun.com/xml/ns/javaee
session-type@http://java.sun.com/xml/ns/javaee
timeout-method@http://java.sun.com/xml/ns/javaee
init-method
@http://java.sun.com/xml/ns/javaee
remove-method@http://java.sun.com/xml/ns/javaee
transaction-type@http://java.sun.com/xml/ns/javaee
around-invoke@http://java.sun.com/xml/ns/javaee
env-entry@http://java.sun.com/xml/ns/javaee
ejb-ref@http://java.sun.com/xml/ns/javaee
ejb-local-ref@http://java.sun.com/xml/ns/javaee
serv
ice-ref@http://java.sun.com/xml/ns/javaee
resource-ref@http://java.sun.com/xml/ns/javaee
resource-env-ref@http://java.sun.com/xml/ns/javaee
message-destination-
ref@http://java.sun.com/xml/ns/javaee
persistence-context-ref@http://java.sun.com/xml/ns/javaee
persistence-unit-ref@http://java.sun.com/xml/ns/javaee
post-cons
truct@http://java.sun.com/xml/ns/javaee
pre-destroy@http://java.sun.com/xml/ns/javaee
post-activate@http://java.sun.com/xml/ns/javaee
pre-passivate@http://java.
sun.com/xml/ns/javaee
security-role-ref@http://java.sun.com/xml/ns/javaee
securi
ty-identity@http://java.sun.com/xml/ns/javaee'
instead of 'bogus@http://java.sun
.com/xml/ns/javaee' here in element session@http://java.sun.com/xml/ns/javaee:.
I got deployment errors when I played with the ejb-jar.xml…
wls:/DefaultDomain/serverConfig> deploy("java2s","C:/EJBstateless/deploy/java2s.
jar" ,"DefaultServer",securityModel="Advanced", block="true")
Deploying application from C:\EJBstateless\deploy\java2s.jar to targets DefaultS
erver (upload=false) ...
<20.nis.2009>
......Failed to deploy the application with status failed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State : failed
Deployment Message : weblogic.application.ModuleException: Exception prepari
ng module: EJBModule(java2s)


Unable to deploy EJB: java2s.jar from java2s.jar:

There are 6 nested errors:

weblogic.ejb.container.compliance.ComplianceException: In EJB CountBean, the hom
e interface of a stateless session bean must have one create method that takes n
o arguments.
and
weblogic.ejb.container.compliance.ComplianceException: Home methods are not allo
wed on session beans: CountBean.count()
and
weblogic.ejb.container.compliance.ComplianceException: In EJB CountBean, the hom
e interface bean.CountRemote must extend the javax.ejb.EJBHome interface.
and
weblogic.ejb.container.compliance.ComplianceException: In EJB CountBean, method
count() on the home interface does not throw java.rmi.RemoteException. This is a
required exception.
at weblogic.ejb.container.compliance.HomeInterfaceChecker.checkMethodsTh
and
weblogic.ejb.container.compliance.ComplianceException: In EJB CountBean, method
remove() on the home interface does not throw java.rmi.RemoteException. This is
a required exception.
and
weblogic.ejb.container.compliance.ComplianceException: In EJB CountBean, method
set(int) on the home interface does not throw java.rmi.RemoteException. This is
a required exception.

Traceback (innermost last):
File "", line 1, in ?
File "", line 234, in deploy
WLSTException: Error occured while performing deploy : Target exception thrown w
hile deploying application: Error occured while performing deploy : Deployment F
ailed.Error occured while performing deploy : Deployment Failed. Use dumpStack()
to view the full stacktrace
wls:/DefaultDomain/serverConfig>

The message was clear. To convert JBOSS EJBs to WebLOGIC you must change their definitions.
Here follows the outputs for my JAVA Client program calling the WebLOGIC EJBs.


(
prev ) ( next )