5 Replies Latest reply on Feb 4, 2002 7:50 AM by Kiran Kumar Kintali

    How to retreive values from database in CMP

    Kiran Kumar Kintali Newbie

      I am trying to retreive values from database to JSP on load that is when that JSP is called i need to invoke a method which takes care of retreving all the values from the database and display it. How is it possible in CMP(JBoss) and also pl tell me what all changes I need to make in ejb-jar,jwas,etc. If any one of u got the example pl send that to me.

      Kiran kumar

        • 1. Re: How to retreive values from database in CMP
          Alexander Lepekhine Newbie

          I can give you Sun "cmpcustomer" example. I have slightly modified it and deployed to JBoss3.0alpha. Hope this example will be enough. All deployment descriptors are there too.
          Wish you success.
          Alexander

          • 2. Re: How to retreive values from database in CMP
            Kiran Kumar Kintali Newbie

            Hello Alexander,

            I have customised your example and when i tryed to deploy it, it is giving some errors saying {BadMagicNumber) why i am getting this error can u please explain me about that what all changes i need to make in descriptor and other files.

            Thanks
            kiran kumar

            • 3. Re: How to retreive values from database in CMP
              Kiran Kumar Kintali Newbie

              When i am trying to deploy i am gettig this error(Bad Magic Number) please help me out
              ==========================================================

              [AutoDeployer] Auto deploy of file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/deploy/mms.ear
              [J2EE Deployer Default] Deploy J2EE application: file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/deploy/mms.ear
              [J2eeDeployer] Create application mms.ear
              [J2eeDeployer] inflate and install WEB module mms.war
              [J2eeDeployer] install EJB module mms.jar
              [J2eeDeployer] add all ejb jar files to the common classpath
              [Container factory] Deploying:file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/mms.ear
              [Verifier] Verifying file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/mms.ear/ejb1004.jar
              [Verifier] java.lang.ClassFormatError: com/mms/Login (Bad magic number)
              [Verifier] at java.lang.ClassLoader.defineClass0(Native Method)
              [Verifier] at java.lang.ClassLoader.defineClass(Unknown Source)
              [Verifier] at java.security.SecureClassLoader.defineClass(Unknown Source)
              [Verifier] at java.net.URLClassLoader.defineClass(Unknown Source)
              [Verifier] at java.net.URLClassLoader.access$100(Unknown Source)
              [Verifier] at java.net.URLClassLoader$1.run(Unknown Source)
              [Verifier] at java.security.AccessController.doPrivileged(Native Method)
              [Verifier] at java.net.URLClassLoader.findClass(Unknown Source)
              [Verifier] at java.lang.ClassLoader.loadClass(Unknown Source)
              [Verifier] at java.lang.ClassLoader.loadClass(Unknown Source)
              [Verifier] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
              [Verifier] at java.lang.Class.getMethods0(Native Method)
              [Verifier] at java.lang.Class.getMethods(Unknown Source)
              [Verifier] at org.jboss.verifier.strategy.EJBVerifier11.verifyEntityHome(EJBVerifier11.java:762)
              [Verifier] at org.jboss.verifier.strategy.EJBVerifier11.checkEntity(EJBVerifier11.java:121)
              [Verifier] at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:132)
              [Verifier] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:467)
              [Verifier] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:369)
              [Verifier] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:304)
              [Verifier] at java.lang.reflect.Method.invoke(Native Method)
              [Verifier] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Verifier] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Verifier] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:494)
              [Verifier] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
              [Verifier] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
              [Verifier] at java.lang.reflect.Method.invoke(Native Method)
              [Verifier] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Verifier] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Verifier] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
              [Verifier] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
              [Verifier] at java.lang.Thread.run(Unknown Source)
              [Container factory] Deploying LoginBean
              [Container factory] Container Invoker RMI Port='4444'
              [Container factory] Container Invoker Client SocketFactory='Default'
              [Container factory] Container Invoker Server SocketFactory='Default'
              [Container factory] Container Invoker Server SocketAddr='Default'
              [Container factory] Container Invoker Optimize='true'
              [Container factory] Deploying ProjectBean
              [Container factory] Deploying UserInfoBean
              [Container factory] Container Invoker RMI Port='4444'
              [Container factory] Container Invoker Client SocketFactory='Default'
              [Container factory] Container Invoker Server SocketFactory='Default'
              [Container factory] Container Invoker Server SocketAddr='Default'
              [Container factory] Container Invoker Optimize='true'
              [Container factory] Begin java:comp/env for EJB: UserInfoBean
              [Container factory] TCL: java.net.URLClassLoader@1f7708
              [Container factory] End java:comp/env for EJB: UserInfoBean
              [Container factory] JRMP 1.3 CI initialized
              [Container factory] Storing sessions for UserInfoBean in:C:\JBoss-2.4.3_Tomcat-3.2.3\jboss\db\sessions\UserInfoBean
              [Container factory] 0 old sessions removed
              [Container factory] java.lang.ClassCastException: $Proxy5
              [Container factory] at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.getEJBLocalHome(BaseLocalContainerInvoker.java:151)
              [Container factory] at org.jboss.ejb.Container.init(Container.java:354)
              [Container factory] at org.jboss.ejb.EntityContainer.init(EntityContainer.java:272)
              [Container factory] at org.jboss.ejb.Application.init(Application.java:202)
              [Container factory] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:372)
              [Container factory] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:304)
              [Container factory] at java.lang.reflect.Method.invoke(Native Method)
              [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Container factory] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:494)
              [Container factory] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
              [Container factory] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
              [Container factory] at java.lang.reflect.Method.invoke(Native Method)
              [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Container factory] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Container factory] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
              [Container factory] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
              [Container factory] at java.lang.Thread.run(Unknown Source)
              [J2EE Deployer Default] Starting mms.ear failed!
              [Default] org.jboss.ejb.DeploymentException: Could not deploy file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/mms.ear, Cause:java.lang.ClassCastException: $Proxy5
              [Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:401)
              [Default]
              [Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:304)
              [Default]
              [Default] at java.lang.reflect.Method.invoke(Native Method)
              [Default]
              [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Default]
              [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Default]
              [Default] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:494)
              [Default]
              [Default] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
              [Default]
              [Default] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
              [Default]
              [Default] at java.lang.reflect.Method.invoke(Native Method)
              [Default]
              [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [Default]
              [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [Default]
              [Default] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
              [Default]
              [Default] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
              [Default]
              [Default] at java.lang.Thread.run(Unknown Source)
              [Default]
              [J2EE Deployer Default] Module mms.war is not running
              [J2EE Deployer Default] Module mms.ear is not running
              [J2EE Deployer Default] Destroying application mms.ear
              [AutoDeployer] Deployment failed:file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/deploy/mms.ear
              [AutoDeployer] org.jboss.deployment.J2eeDeploymentException: Error while starting mms.ear: Could not deploy file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/mms.ear, Cause: org.jboss.ejb.DeploymentException: Could not deploy file:/C:/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/mms.ear, Cause:java.lang.ClassCastException: $Proxy5
              [AutoDeployer] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:519)
              [AutoDeployer] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
              [AutoDeployer] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
              [AutoDeployer] at java.lang.reflect.Method.invoke(Native Method)
              [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
              [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
              [AutoDeployer] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
              [AutoDeployer] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
              [AutoDeployer] at java.lang.Thread.run(Unknown Source)

              • 4. Re: How to retreive values from database in CMP
                Alexander Lepekhine Newbie

                I am not sure if it will work in JBoss_2.4.3.
                The example explains the usage of local interfaces
                as for EJB 2.0 specification.
                I used JBoss 3.0alpha.
                Try to install it. It works fine.

                • 5. Re: How to retreive values from database in CMP
                  Kiran Kumar Kintali Newbie

                  I am downloading that version of JBoss once i install and work on that i will let u know the results