Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually, you're not getting a <code>ClassNotFoundException</code>, you're getting a <code>NoClassDefFoundError</code> and I suspect some dependencies to be missing, as suggested by:</p> <pre><code>Class [ Lcom/company/app/jms/IJmsSessionFactory; ] not found. Error while loading [ class com.company.app.eventprocessor.provider.EventProvider </code></pre> <p>Where is that <code>com.company.app.jms.IJmsSessionFactory</code>?</p> <hr> <blockquote> <p>I have now cut the ear down to a single ejb module and am getting the NoClassDef for Lorg/apache/log4j/Logger however the log4j jar is also in the ear. It feels like I must be missing something fundamental here? </p> </blockquote> <p>Where is the <code>log4j.jar</code> exactly? In <code>/lib</code>? Can you actually show the structure of your EAR? And please also show the <code>MANIFEST.MF</code> of your EJB-JAR. </p> <p>Just in case, here is a relevant quote from <a href="http://www.developer.com/java/ejb/article.php/10931_3670496_2/Packaging-EJB-3-Applications.htm" rel="nofollow noreferrer">Packaging EJB 3 Applications</a>:</p> <blockquote> <h3>Packaging EJB-JAR</h3> <p>...</p> <p>The EJB-JAR file must include the interfaces and bean classes. It may also include any helper classes. Optionally the helper classes may be packaged in a separate JAR file in the EAR file. You have two options:</p> <ul> <li>The JAR containing helper classes may be packaged in the lib directory of the EAR file. Using this approach, the packaged classes will be automatically visible to all modules in the EAR module.</li> <li>If you want to limit the visibility to only a specific EJB-JAR or WAR module, you can create an entry in the Manifest.mf file of the module that contains a Class-Path attribute to the JAR file.</li> </ul> <p>Now that you know the structure of EJB-JAR and how to package it, let's look at the elements of <code>ejb-jar.xml</code>.</p> </blockquote> <hr> <blockquote> <p>Based on your comments I think I am understadning my issue. It would appear I am not packaging the ear correctly, I don't think the maven dependencies are referenced correctly. If I simply build my ejb jar it does not include any of the dependant jars. Should I be specifying something in the pom to include the jars ejb-jar? I have the build plugin <code>&lt;artifactId&gt;maven-ejb-plugin&lt;/artifactId&gt;</code> and packaging <code>&lt;packaging&gt;ejb&lt;/packaging&gt;</code> set.</p> </blockquote> <p>Bundling dependencies into an EJB-JAR is not supported (see <a href="http://jira.codehaus.org/browse/MEJB-3" rel="nofollow noreferrer">MEJB-3</a>) mostly because jar-within-jar is not part of the <a href="http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html" rel="nofollow noreferrer">JAR specification</a> (and might not be supported by all EJB container) and does not comply with <a href="http://java.sun.com/j2ee/verified/packaging.html" rel="nofollow noreferrer">Sun's advice regarding J2EE packaging</a> in general.</p> <p>So while you may ignore this rule (see <a href="http://jira.codehaus.org/browse/MEJB-3?focusedCommentId=203184&amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_203184" rel="nofollow noreferrer">this trick</a> or <a href="http://magnus-k-karlsson.blogspot.com/2009/08/bundle-common-jar-into-ejb-jar-with.html" rel="nofollow noreferrer">this one</a>), the standard way would be to package the EJB-JAR and all the JARs it depends on in an EAR. This is my recommendation and I think that this post might help: <a href="http://agoncal.wordpress.com/2009/10/23/because-i-always-forget-how-to-use-maven-ear-plugin/" rel="nofollow noreferrer">Because I always forget how to use maven-ear-plugin</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload