8 Replies Latest reply on Oct 11, 2002 12:59 PM by Adrian Brock

    Bean Managed Persistence - Entity Bean

    mohan Newbie

      Hi all,


      Could anyone pls tell me how to create ejb-jar.xml file for a BMP Entity Bean.

      Thankx in advance

      Mohan

        • 2. Re: Bean Managed Persistence - Entity Bean
          mohan Newbie

          Hi,

          Thanx much Adrian


          Mohan

          • 3. Re: Bean Managed Persistence - Entity Bean
            mohan Newbie

            Hi again,

            Could u pls tell me what is this error abt.

            12:37:23,246 ERROR [MainDeployer] could not create deployment: file:/C:/jboss3.0
            /server/default/deploy/account.jar
            org.jboss.deployment.DeploymentException: End of entity not allowed; an end tag
            is missing.; - nested throwable: (org.xml.sax.SAXParseException: End of entity n
            ot allowed; an end tag is missing.)
            at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:267)
            at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.jav
            a:226)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:182)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
            tScanner.java:405)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
            canner.java:515)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            loop(AbstractDeploymentScanner.java:202)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            run(AbstractDeploymentScanner.java:191)
            + nested throwable:
            org.xml.sax.SAXParseException: End of entity not allowed; an end tag is missing.

            at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3108)
            at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3096)
            at org.apache.crimson.parser.Parser2.content(Parser2.java:1824)
            at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
            at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
            at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
            at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
            at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
            at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)

            at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl
            .java:185)
            at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86)
            at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:257)
            at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.jav
            a:226)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:182)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
            tScanner.java:405)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
            canner.java:515)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            loop(AbstractDeploymentScanner.java:202)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            run(AbstractDeploymentScanner.java:191)
            12:37:23,416 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment
            .scanner.URLDeploymentScanner$DeployedURL@1ac3b61f{ url=file:/C:/jboss3.0/server
            /default/deploy/account.jar, deployedLastModified=1034233254000 }
            org.jboss.deployment.DeploymentException: End of entity not allowed; an end tag
            is missing.; - nested throwable: (org.xml.sax.SAXParseException: End of entity n
            ot allowed; an end tag is missing.)
            at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:267)
            at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.jav
            a:226)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:182)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
            tScanner.java:405)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
            canner.java:515)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            loop(AbstractDeploymentScanner.java:202)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            run(AbstractDeploymentScanner.java:191)
            + nested throwable:
            org.xml.sax.SAXParseException: End of entity not allowed; an end tag is missing.

            at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3108)
            at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3096)
            at org.apache.crimson.parser.Parser2.content(Parser2.java:1824)
            at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
            at org.apache.crimson.parser.Parser2.content(Parser2.java:1766)
            at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1494)
            at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
            at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
            at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)

            at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl
            .java:185)
            at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86)
            at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:257)
            at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.jav
            a:226)
            at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:182)
            at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
            at org.jboss.deployment.MainDeployer.create(MainDeployer.java:637)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:512)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
            tScanner.java:405)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
            canner.java:515)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            loop(AbstractDeploymentScanner.java:202)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
            run(AbstractDeploymentScanner.java:191)

            Thanx in advance

            Mohan

            • 4. Re: Bean Managed Persistence - Entity Bean
              Adrian Brock Master

              You forgot to close one of the tags.

              e.g.

              <ejb-name>Test


              Is wrong, it should have </ejb-name> after Test

              You might have accidently typed <ejb-name> by
              mistake?

              Regards,
              Adrian

              • 5. Re: Bean Managed Persistence - Entity Bean
                mukesh Newbie

                guys

                i saw the replies to this question.
                there are many tools which generate ejb-jar.xml. one of such tool is "ejb-gen", which supports autogeneration of weblogic specific files as well.

                Apart from ejb-jar.xml, which extra(container specific) xml files are needed and where to put them, and what extra configuration one has to make to successfully deploy and run bmp entity beans in jboss 3.0.0-tomcat4.0.0.

                I have already wrote a "jboss.xml" file where i am setting the jndi name for my bmp. I have also configured "oracle-service.xml" (since i am using oracle 8i) for datasource, connection properties and connection pool.

                After i put the bean in %jboss_home%\server\default\deploy
                directory, and start the server, the server log shows no error.it showed that deployment of bmp is completed.
                But the problem appears when i try to look for my bmp in the "admin" window. I could not find my bean listed there.
                Also, when i run the client, the client console shows that jndi name(of my bean) not found.
                can anyone please put some light on it?

                thanks in advance.

                • 6. Re: Bean Managed Persistence - Entity Bean
                  Adrian Brock Master

                  When you say the admin window,
                  do you mean JNDIView and the list operation.

                  What name are you binding with?

                  Regards,
                  Adrian

                  • 7. Re: Bean Managed Persistence - Entity Bean
                    mukesh Newbie

                    yes i mean the same.
                    http://localhost:8082

                    Here's my scenario.

                    1)My ejb-jar.xml has display name of my bmp as "AccountEJB"

                    .....ejb-jar.xml...

                    <display-name>AccountEJB</display-name>
                    <ejb-name>AccountEJB</ejb-name>
                    ......
                    2) my "jboss.xml" has the following entry:

                    <enterprise-bean>

                    <ejb-name>AccountEJB</ejb-name>
                    <jndi-name>AccountExample</jndi-name>

                    </enterprise-bean>



                    3) Also since i am using oracle 8i, i added the follwing code to :
                    %jboss_root%\server\default\conf\login-config.xml

                    <application-policy name = "OracleDbRealm">

                    <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
                    <module-option name = "dsJndiName">java:/OracleDS</module-option>
                    <module-option name = "principal">admin</module-option>
                    <module-option name = "userName">system</module-option>
                    <module-option name = "password">manager</module-option>
                    <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option>
                    </login-module>

                    </application-policy>


                    4) i also modified the file : standard-jaws.xml for Oracle.


                    type-mapping-definition>
                    Oracle8i

                    <java-type>java.lang.Boolean</java-type>
                    <jdbc-type>BIT</jdbc-type>
                    <sql-type>NUMBER(1)</sql-type>


                    <java-type>java.lang.Byte</java-type>
                    <jdbc-type>NUMERIC</jdbc-type>
                    <sql-type>NUMBER(3)</sql-type>


                    <java-type>java.lang.Short</java-type>
                    <jdbc-type>NUMERIC</jdbc-type>
                    <sql-type>NUMBER(5)</sql-type>


                    <java-type>java.lang.Integer</java-type>
                    <jdbc-type>INTEGER</jdbc-type>
                    <sql-type>NUMBER(10)</sql-type>


                    <java-type>java.lang.Long</java-type>
                    <jdbc-type>BIGINT</jdbc-type>
                    <sql-type>NUMBER(19)</sql-type>


                    <java-type>java.lang.Float</java-type>
                    <jdbc-type>REAL</jdbc-type>
                    <sql-type>NUMBER(38,7)</sql-type>


                    <java-type>java.math.BigDecimal</java-type>
                    <jdbc-type>DECIMAL</jdbc-type>
                    <sql-type>NUMBER(38,15)</sql-type>


                    <java-type>java.lang.Double</java-type>
                    <jdbc-type>DOUBLE</jdbc-type>
                    <sql-type>NUMBER(38,15)</sql-type>


                    <java-type>java.lang.Character</java-type>
                    <jdbc-type>CHAR</jdbc-type>
                    <sql-type>CHAR</sql-type>


                    <java-type>java.lang.String</java-type>
                    <jdbc-type>VARCHAR</jdbc-type>
                    <sql-type>VARCHAR2(255)</sql-type>


                    <java-type>java.sql.Date</java-type>
                    <jdbc-type>DATE</jdbc-type>
                    <sql-type>DATE</sql-type>


                    <java-type>java.sql.Time</java-type>
                    <jdbc-type>TIME</jdbc-type>
                    <sql-type>DATE</sql-type>


                    <java-type>java.sql.Timestamp</java-type>
                    <jdbc-type>TIMESTAMP</jdbc-type>
                    <sql-type>DATE</sql-type>


                    <java-type>java.lang.Object</java-type>
                    <jdbc-type>JAVA_OBJECT</jdbc-type>
                    <sql-type>BLOB</sql-type>
                    <!-- Change this from BLOB to RAW(255) if you know your
                    serialized object will be <= 255 bytes -->

                    </type-mapping-definition>

                    5) Finally, i modified oracle-service.xml.

                    Still the bean cannot be bound to the jndi name.
                    Please can anybody tell me why is this so.

                    Also, i would highly appreciate if anybody can send me a little sample bean with all the files needed.
                    its very urgent.

                    thanks in advance
                    mukki


                    • 8. Re: Bean Managed Persistence - Entity Bean
                      Adrian Brock Master

                      You won't need JAWS for BMP.

                      Can you show the server/default/log/server.log for bean's
                      deployment.
                      Maybe it is not finding META-INF/ejb-jar.xml and just
                      deploying it as a classes only jar?

                      Regards,
                      Adrian