3 Replies Latest reply on Sep 21, 2005 9:53 AM by Tim Meagh

    Deploying an entity bean

    Tim Meagh Newbie

      Hi,

      I am trying to get an entity bean to connect to a MySQL database using BMP. When i tried to deploy an entity bean on jboss i get the following exception.


      b-jar.xml@11:32; - nested throwable: (org.xml.sax.SAXParseException: XML documen
      t structures must start and end within the same entity.)
       at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:328)
       at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:257)
       at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.jav
      a:229)
       at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:147)
       at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:495)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.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 $Proxy33.create(Unknown Source)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:919)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:773)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
       at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:118)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.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 $Proxy6.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:319)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:507)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:192)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      loop(AbstractDeploymentScanner.java:203)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      run(AbstractDeploymentScanner.java:182)
      Caused by: org.xml.sax.SAXParseException: XML document structures must start and
       end within the same entity.
       at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
       at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:313)
       ... 40 more



      Here is the ejb-jar.xml file that i am trying to parse


      <?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_4.dtd>
      <ejb-jar>
       <description>Entity Bean </description>
       <display-name>Products Application</display-name>
       <enterprise-beans>
       <entity>
       <ejb-name>BMPProduct</ejb-name>
       <home>com.nabil.ejb.ProductHome</home>
       <remote>com.nabil.ejb.Product</remote>
       <ejb-class>com.nabil.ejb.ProductBean</ejb-class>
       <persistence-type>Bean</persistence-type>
       <prim-key-class>com.nabil.ejb.ProductPK</prim-key-class>
       <reentrant>false</reentrant>
       <env-entry>
       <env-entry-name>dbUrl</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>jdbc:mysql://localhost:3306/mytest</env-entry-value>
       </env-entry>
       <env-entry>
       <env-entry-name>dbUserName</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>x</env-entry-value>
       </env-entry>
       <env-entry>
       <env-entry-name>dbPassword</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>y</env-entry-value>
       </env-entry>
       </entity>
       </enterprise-beans>
      </ejb-jar>




      Can anyone see what is wrong???