Tuesday, 15 January 2013

eclipse - Java MDB EJB Project maven depends on Web Project -


I found an existing web project. Now I need to add an MDB EJB project and he did the same. The EJB project depends on the Meowen Web project

So far all is well. At the moment, I start using some classes in my MDB web project, it compiles exactly and everything looks fine, but with runtime noClassDefFoundError bombs

I have my web pom Xml and added this to the configuration configuration

  & lt; Plugin & gt; & Lt; Group & gt; Org.apache.maven.plugins & lt; / Group & gt; & Lt; ArtifactId & gt; Maven War Plugin & lt; / ArtifactId> & Lt; Version & gt; 2.1.1 & lt; / Edition & gt; & Lt; Configuration & gt; & Lt; AttachClasses & gt; True & lt; / AttachClasses & gt;  

and in my EJB POM

  & lt; Dependency & gt; & Lt; Group & gt; My.group & lt; / Group & gt; & Lt; ArtifactId & gt; My-web-project names & lt; / ArtifactId> & Lt; Version & gt; $ {Project.version} & lt; / Edition & gt; & Lt; Classifier & gt; Classes & lt; / Classifier & gt; & Lt; / Dependencies & gt;  

How to get classes inside my EJB web project

I can not really do it in another way because I do not have permission to edit the web project. By default, all server modules use classloaders and web modules may depend on EJB, please help!

< Ul>
  • If you are on a Java EE6 analog server, you can add your EJB directly to the Web module (the need for a web project change)
  • Remove the normal class from the Web project and Create Java Utility Project. Add that project to the EAR, and the web and the ejbb project depend on it, and the web depends on the ebook (changes in the web also require a change)
  • Single for your entire app Configure the Classloader If your server allows it, then it should resolve your issues.
  • In short, I advise to edit the web project and use one of the two previous solutions, but if you really want to work in the third number solution.


    No comments:

    Post a Comment