Friday, June 11, 2010

EJB3 - JBOSS - Andromda created -- deployment

OK.

So the ear built fine, now to get it to deploy properly...

I have installed JBOSS v5.0.1 on my machine.  Tried deploying the ear by copying it into:
%JBOSSDeployFolder%\server\default\deploy

Starting getting erros like:

error due to the following reason(s): org.jboss.xb.binding.JBossXBRuntimeException: Element {http://java.sun.com/xml/ns/javaee}jboss is not bound as a global element.




I realized that the jboss.xml file (located inside of the 'yourapp-core.jar' file) which is inside of the .ear had the wrong xml namespace defined.  To fix it you will need to modify the jboss.xml.vsl file, which is located in the cartridge.  As I mentioned in my previous blog post, I maintain a copy of the SNAPSHOT version to keep my changes from being overwritten...   to fix the xml namespace issue, I open my andromda-ejb3-cartridge-1.0-JBOSS.jar file (located in my maven local repository as described in previous blog post).  Modify the /templates/ejb3/config/jboss/jboss.xml.vsl file.  Change the tag to be:

 


I also had problems where JBOSS gave what is IMHO a really bad error message, it said:

* EJB CholesterolGoalDao has defined EJB2.x local component interface of com.wellnessrecord.domain.goals.CholesterolGoalDao but has no localHome; ; Incomplete EJB2.x View [JBMETA-130]

Which after some investigation, means that the ejb-jar.xml created by Andromda is outdated, and uses the old EJB 2.1 conventions...

This file has sections for each of your session beans of the form:

  
           
               
           

            UserServiceBean
            com.wellnessrecord.service.UserServiceRemote
            com.wellnessrecord.service.UserServiceBean
            Stateless
            Container
       


Well, as it turns out, in EJB3 you need the and tags to be of the form and

To fix, modify the file:  /andromda-ejb3-cartridge-1.0-JBOSS.jar\templates\ejb3\config\ejb-jar.xml file.  Replace all occurances of with , with , with and with


Run:
mvn clean
mvn install

Redeploy your .ear to JBOSS.

No comments:

Post a Comment