[jboss-user] [Installation, Configuration & DEPLOYMENT] - EJB not deployed in EAR file with libraries

antonio.genghi do-not-reply at jboss.com
Mon Nov 10 11:23:43 EST 2008


Hi all.

I have a strage problem with JBoss 4.2.3 running on JDK 1.5.0_16b02 (latest from Sun).

Here is my case:

myApp.ear
 |
 |\-lib
 |    \-util1.jar
 |     |-util2.jar
 |
 |\-META-INF
 |   \-application.xml
 |   |-MANIFEST.MF
 |
 |-myEjb.jar

Content of application.xml:
<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
  | <application>
  |   <display-name>myApp</display-name>
  |   <description>Application description</description>
  |   <module>
  |     <ejb>myEjb.jar</ejb>
  |   </module>
  |   <library-directory>lib</library-directory>
  | </application>

Content of MANIFEST.MF
Manifest-Version: 1.0
  | Ant-Version: Apache Ant 1.7.0
  | Created-By: 1.5.0_16-b02 (Sun Microsystems Inc.)

myEJB.jar
 |
 |\-myPackage
 |   \-myBean.class
 |
 |\-META-INF
 |   \-ejb-jar.xml
 |    |-jboss.xml
 |    |-MANIFEST.MF

Content of ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
  | <ejb-jar>
  |     <display-name>myEJB</display-name>
  |     <enterprise-beans>
  |         <message-driven>
  |             <display-name>myEJB</display-name>
  |             <ejb-name>myEJB</ejb-name>
  |             <ejb-class>myPackage.myBean</ejb-class>
  |             <transaction-type>Container</transaction-type>
  |             <message-driven-destination>
  |                 <destination-type>javax.jms.Queue</destination-type>
  |             </message-driven-destination>
  |        </message-driven>
  |    </enterprise-beans>
  | </ejb-jar>

Content of jboss.xml


  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss PUBLIC
  |    "-//JBoss//DTD JBOSS 3.2//EN"
  |    "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
  | <jboss>
  |     <enterprise-beans>
  |         <message-driven>
  |             <ejb-name>myEJB</ejb-name>
  |             <destination-jndi-name>jms/myQueue</destination-jndi-name>     
  |         </message-driven>
  |     </enterprise-beans>
  | </jboss>
  | 

Content of MANIFEST.MF

  | Manifest-Version: 1.0
  | Ant-Version: Apache Ant 1.7.0
  | Created-By: 1.4.2_05-b04 (Sun Microsystems Inc.)
  | Class-Path: 
  |   util1.jar 
  |   util2.jar 
  |   Ant-Version: Apache Ant 
  |  1.6.5
  | 

(It should be all).

The problem is that i cannot see th EJB deployed neither bind to JMS queue.
But if i try to deploy the whole EAR without the util1.jar and util2.jar (also removing from manifest.mf) the EJB deploy correctly and bind to jms quee too.
Also, the EAR and EJB works correctly if i deploy the archive as an exploded package (also the myEjb.jar).

The picture was not so clear so i decided to debug the JARDeployer, and i notice that the problem is in those lines:


  |          // Since a META-INF directory exists within rt.jar, we can't just do a 
  |          // getResource (it will always return rt.jar's version).
  |          // The method we want is findResource, but it is marked protected in
  |          // ClassLoader.  Fortunately, URLClassLoader exposes it which makes
  |          // this hack possible.  Anybody have a better way to check a URL
  |          // for the existance of a META-INF??
  |          URL ddDir;
  |          try 
  |          {
  |             ddDir = di.localCl.findResource("META-INF/");
  |             if (ddDir == null) 
  |             {
  |                log.debug("No META-INF or WEB-INF resource found, assuming it if for us");
  |                return true;
  |             }
  |          } 
  |          catch (ClassCastException e) 
  |          {
  |              // assume there is a META-INF...
  |              ddDir = new URL(di.url, "META-INF/");
  |          }
  | 

The deployer (better, the classloader) cannot access META-INF of myEJB.jar in the temp deploy directory.

The question is: WHY?

Where am I wrong?

Could you help me?

Thanks a lot in advance.

Antonio

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4188177#4188177

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4188177



More information about the jboss-user mailing list