5 Replies Latest reply on Oct 29, 2012 8:22 AM by Adheep M

    Error during deployment of EJB 2.0 in JBoss 7.1

    Adheep M Newbie

      Hi ,

       

      I am trying to deploy my sample ejb2.0 bean in to jbossAS 7.1 , I have some problem with parsing ejb-jar.xml in jboss 7.

       

      HelloHome.java

       

       

      import javax.ejb.*;
      import java.rmi.RemoteException;
      
      public interface HelloHome extends EJBHome {
          /**
           * @return
           * @throws CreateException
           * @throws RemoteException
           */
          public Hello create() throws CreateException, RemoteException;
      }
      

       

      Hello.java

       

       

      
      import javax.ejb.*;
      import java.rmi.RemoteException;
      import java.sql.SQLException;
      import java.util.Vector;
      
      public interface Hello extends EJBObject {
      
          public String printMessage(String name) throws RemoteException;
      
      }
      

       

      HelloBean.java

       

      import java.rmi.RemoteException;
      
      
      public class HelloBean implements SessionBean {
          private static final long serialVersionUID = 1L;
      
          /**
           * @param args
           */
      
          public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
              System.out.println("Ejb Activated...");
          }
      
          public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
              System.out.println("Ejb Passivated...");
          }
      
          /* (non-Javadoc)
           * @see javax.ejb.SessionBean#ejbRemove()
           */
          public void ejbRemove() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
              System.out.println("Ejb Removed...");
      
          }
      
          /* (non-Javadoc)
           * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
           */
          public void setSessionContext(SessionContext arg0) throws EJBException,
                  RemoteException {
              // TODO Auto-generated method stub
      
          }
          public void ejbCreate() {
              System.out.println("In Ejb Create...");
      
          }
      
          /**
           * @param name
           * @return welcome messsage
           */
          public String printMessage(String name) {
              return ("Hello " + name);
          }
      
      }
      

       

      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>
          <enterprise-beans>
              <session>
                  <ejb-name>HelloBean</ejb-name>
                  <home>serverPackage.HelloHome</home>
                  <remote>serverPackage.Hello</remote>
                  <ejb-class>serverPackage.HelloBean</ejb-class>
                  <session-type>Stateless</session-type>
                  <transaction-type>Container</transaction-type>
              </session>
          </enterprise-beans>
      </ejb-jar>
      

       

      jboss.xml

       

       

      <?xml version='1.0' ?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
      <jboss>
          <enterprise-beans>
              <session>
      
                  <ejb-name>HelloBean</ejb-name>
                  <local-jndi-name>helloJndi</local-jndi-name>
              </session>
          </enterprise-beans>
      </jboss>
      

       

       

      StackTrace :

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[12,13]
      Message: Unexpected element 'transaction-type' encountered
       at org.jboss.metadata.parser.util.MetaDataElementParser.unexpectedElement(MetaDataElementParser.java:108)
       at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.processElement(EntityBeanMetaDataParser.java:218)
       at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.processElement(EntityBeanMetaDataParser.java:41)
       at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
       at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.parse(EntityBeanMetaDataParser.java:73)
       at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:95)
       at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:38)
       at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
       at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:74)
       at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:66)
       at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:111)
       at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:38)
       at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
       at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parseDocument(EjbJarMetaDataParser.java:109)
       at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parse(EjbJarMetaDataParser.java:53)
       at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.parseEjbJarXml(EjbJarParsingDeploymentUnitProcessor.java:245)
      

       

       

       

      Is there anything i am missing ?.

        • 1. Re: Error during deployment of EJB 2.0 in JBoss 7.1
          Stephen Coy Master

          This stack trace is from parsing a large ejb-jar.xml file (it says the error is on line 1245).

           

          The sample that you gave appears to have only 15 lines or so in it...

          1 of 1 people found this helpful
          • 2. Re: Error during deployment of EJB 2.0 in JBoss 7.1
            Adheep M Newbie

            Stephen Coy wrote:

             

            This stack trace is from parsing a large ejb-jar.xml file (it says the error is on line 1245).

             

            The sample that you gave appears to have only 15 lines or so in it...

            Yes you are right, the stack trace posted before was not correct. I've updated it

            Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[12,13]
            Message: Unexpected element 'transaction-type' encountered
            at org.jboss.metadata.parser.util.MetaDataElementParser.unexpectedElement(MetaDataElementParser.java:108)
            at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.processElement(EntityBeanMetaDataParser.java:218)
            at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.processElement(EntityBeanMetaDataParser.java:41)
            at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
            at org.jboss.metadata.ejb.parser.spec.EntityBeanMetaDataParser.parse(EntityBeanMetaDataParser.java:73)
            at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:95)
            at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.processElement(EnterpriseBeansMetaDataParser.java:38)
            at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
            at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:74)
            at org.jboss.metadata.ejb.parser.spec.EnterpriseBeansMetaDataParser.parse(EnterpriseBeansMetaDataParser.java:66)
            at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:111)
            at org.jboss.metadata.ejb.parser.spec.AbstractEjbJarMetaDataParser.processElement(AbstractEjbJarMetaDataParser.java:38)
            at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65)
            at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parseDocument(EjbJarMetaDataParser.java:109)
            at org.jboss.metadata.ejb.parser.spec.EjbJarMetaDataParser.parse(EjbJarMetaDataParser.java:53)
            at org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor.parseEjbJarXml(EjbJarParsingDeploymentUnitProcessor.java:245)

            • 3. Re: Error during deployment of EJB 2.0 in JBoss 7.1
              Nicklas Karlsson Master

              That's a bit strange. The DTD indicates that the transaction-type would be supported at that location.

              • 4. Re: Error during deployment of EJB 2.0 in JBoss 7.1
                jaikiran pai Master

                Which exact version of AS 7.1 is this? Please give it a try against the nightly build https://community.jboss.org/thread/167590 and see if it's fixed there.

                • 5. Re: Error during deployment of EJB 2.0 in JBoss 7.1
                  Adheep M Newbie

                  Hi Jaikiran,

                  jaikiran pai wrote:

                   

                  Which exact version of AS 7.1 is this? Please give it a try against the nightly build https://community.jboss.org/thread/167590 and see if it's fixed there.

                  I'm currently using JBoss AS 7.1.1, I'll will try it out in the nightly build and let you know if it still exists. Thanks