1 Reply Latest reply on Jan 3, 2006 9:25 AM by Libor Kotouc

    Jboss 4.0.3 and Netbeans 4 beta2 ejb deployment problem

    newbeeuser Newbie

      Hi,
      I am creating a simple ejb using Netbeans 5 beta 2 and deploying it on jboss 4.0.3. I am getting following exceptions.

      2005-12-30 01:23:51,953 ERROR [org.jboss.deployment.MainDeployer] Could not create deployment: file:/D:/jboss-4.0.3/server/default/deploy/EJBModule1.jar
      org.jboss.deployment.DeploymentException: ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!
      at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:300)
      at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:151)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:506)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy24.create(Unknown Source)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:935)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:789)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
      at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy9.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:428)
      at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
      at $Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
      at org.jboss.Main.boot(Main.java:187)
      at org.jboss.Main$1.run(Main.java:438)
      at java.lang.Thread.run(Thread.java:534)
      2005-12-30 01:23:52,218 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@ecc90312{ url=file:/C:/softwares/jboss-4.0.3SP1/server/default/deploy/EJBModule1.jar, deployedLastModified=0 }
      org.jboss.deployment.DeploymentException: ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!
      ========================================================
      Following is the code for ejb-jar.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
       <display-name>EJBModule1</display-name>
       <enterprise-beans>
       <session>
       <display-name>NewSessionSB</display-name>
       <ejb-name>NewSessionBean</ejb-name>
       <local-home>test.NewSessionLocalHome</local-home>
       <local>test.NewSessionLocal</local>
       <ejb-class>test.NewSessionBean</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       </session>
       </enterprise-beans>
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>NewSessionBean</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
       </ejb-jar>

      ================================================
      The code for session beans is given below
      package test;
      
      import javax.ejb.*;
      
      /**
       * This is the bean class for the NewSessionBean enterprise bean.
       * Created Dec 30, 2005 1:16:36 AM
       * @author rohit
       */
      public class NewSessionBean implements javax.ejb.SessionBean, test.NewSessionLocalBusiness {
       private javax.ejb.SessionContext context;
      
       // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
       // TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
       // TODO Add business methods or web service operations
       /**
       * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
       */
       public void setSessionContext(javax.ejb.SessionContext aContext) {
       context = aContext;
       }
      
       /**
       * @see javax.ejb.SessionBean#ejbActivate()
       */
       public void ejbActivate() {
      
       }
      
       /**
       * @see javax.ejb.SessionBean#ejbPassivate()
       */
       public void ejbPassivate() {
      
       }
      
       /**
       * @see javax.ejb.SessionBean#ejbRemove()
       */
       public void ejbRemove() {
      
       }
       // </editor-fold>
      
       /**
       * See section 7.10.3 of the EJB 2.0 specification
       * See section 7.11.3 of the EJB 2.1 specification
       */
       public void ejbCreate() {
       // TODO implement ejbCreate if necessary, acquire resources
       // This method has access to the JNDI context so resource aquisition
       // spanning all methods can be performed here such as home interfaces
       // and data sources.
       }
      
      
      
       // Add business logic below. (Right-click in editor and choose
       // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
      
       public String Hello() {
       //TODO implement Hello
       return "Hello";
       }
      
      
      
      }


        • 1. Re: Jboss 4.0.3 and Netbeans 4 beta2 ejb deployment problem
          Libor Kotouc Newbie

          I also saw the similar question at http://jboss.org/?module=bb&op=viewtopic&t=74636. The difference is only in using DTD instead of XML Schema.

          I created an EJB module in NetBeans - it automatically generated ejb-jar.xml with the same header as for you - and then deployed it on the JBoss4.0.3SP1 without any problem.

          I also looked at the source code of the class throwing the deployment exception. There is nothing what could indicate where the problem is, it looks like you deployment descriptor is logically fine.

          The XML parsing is now the only thing I wouldn't believe, the structure looks good.
          Don't you use any special enconding or couldn't the file contain some special 'invisible' characters which could cause that the header is not parsed well?