Bean not exported
klauskinski Dec 4, 2012 2:44 PMHi,
I'm writing an application and I'm splitting it in 3 parts:
- Client
- Library
- Server
The libraries contains 2 packages
klaus.kinski.entity
klaus.kinski.transfer
entity contains objects like UserTO
transfer contains the interfaces like LoginTO
In my Server-Project I have the package (I have some more, but this one is related to the question)
klaus.kinski.transferlogic
This package contains the object LoginBean implementing the interface LoginTO.
It implements the method "public String doLogin(UserTO userTO)"
When I now copy the packages klaus.kinski.entity and klaus.kinski.transfer into the Server project directory in Eclipse, everything works perfectly fine, and I can use the EJB via JBoss Remoting from my client.
But I want to use the entity and transfer package from the Library of course by including the Library as a JAR File.
So what I did was:
- Generate the Library Project as KlausKinskiLib.jar
- Copy KlausKinskiLib.jar to C:\....\jboss-as-7.1.1.Final\modules\klaus\kinski\main
- Create a module.xml in the above path:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="klaus.kinski">
<resources>
<resource-root path="KlausKinskiLib.jar"/>
</resources>
</module>
- Include KlausKinskiLib.jar as an "External JAR" in Eclipse to resolve the dependencies inside Eclipse.
- Create a META-INF\jboss-deployment-structure.xml file in my EJB Project containing:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="klaus.kinski" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
- Rebuild the EJB Project
- Republish the EJB Project to JBoss.
Now The EJB can not longer be accessed via JBoss Remoting.
I noticed the following different output from JBoss while re-deploying the EJB Jar:
20:12:52,996 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named LoginBean in deployment unit deployment "KlausKinskiServer.jar" are as follows:
java:global/KlausKinskiServer/LoginBean!klaus.kinski.transfer.LoginTO
java:app/KlausKinskiServer/LoginBean!klaus.kinski.transfer.LoginTO
java:module/LoginBean!klaus.kinski.transfer.LoginTO
java:jboss/exported/KlausKinskiServer/LoginBean!klaus.kinski.transfer.LoginTO
java:global/KlausKinskiServer/LoginBean
java:app/KlausKinskiServer/LoginBean
java:module/LoginBean
The red marked line is no longer there.
When I rename the jboss-deployment-structure.xml file and copy back the packages from my library, the line comes back and the EJB is working again.
When I rename the jboss-deployment-structure.xml file and do not copy the library packages to Server package I get NoClassDefFoundError exceptions. So in general the Library seems to be used but exporting Beans implementing interfaces only defined in the library seems to be a problem.
I'm a bit lost on this one....