1 2 Previous Next 16 Replies Latest reply on Nov 4, 2007 11:27 PM by Lave Kulshreshtha

    ClassCastException on PortableRemoteObject.narrow(object, He

    Lave Kulshreshtha Newbie

      posted Sunday, October 21, 2007 11:47 PM
      --------------------------------------------------------------------------------
      I have created an EJB module and a web module.
      When I try to run EJB from a servlet I get ClassCastException. I do not know why?

      I am using myEclipse 6.0 and JBoss 4.2.1 GA application server.

      I get ClassCastException When I try to narrow after lookup.

      I have seen many sites but i could not resolve this problem.

      Can some one help on this?

      Please find below the code details.

      jboss.xml
      -----------------------------------------------

      <enterprise-beans>

      <ejb-name>Hello</ejb-name>
      <jndi-name>ejb/Hello</jndi-name>


      <ejb-name>TesterBean</ejb-name>
      <jndi-name>test/Tester</jndi-name>


      </enterprise-beans>



      ejb-jar.xml
      -----------------------------------------------
      <enterprise-beans>

      <ejb-name>Hello</ejb-name>
      com.wiley.examples.HelloHome
      com.wiley.examples.Hello
      <ejb-class>com.wiley.examples.HelloBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      <display-name>TesterBean</display-name>
      <ejb-name>TesterBean</ejb-name>
      com.wiley.examples.TesterHome
      com.wiley.examples.Tester
      <ejb-class>com.wiley.examples.TesterEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      jboss-web.xml
      -----------------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>ejb/HelloEjb</ejb-ref-name>
      <jndi-name>ejb/Hello</jndi-name>
      </ejb-ref>
      </jboss-web>


      web.xml
      -----------------------------------------------------
      <ejb-ref>
      <ejb-ref-name>ejb/HelloEjb</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.wiley.examples.HelloHome
      com.wiley.examples.Hello
      <ejb-link>Hello</ejb-link>
      </ejb-ref>


      code from servlet
      ---------------------------------------------------
      Properties env = new Properties();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming rg.jnp.interfaces");
      env.put("org.omg.CORBA.ORBInitialHost","localhost");
      env.put("org.omg.CORBA.ORBInitialPort","3700");

      Context context = new InitialContext();
      Object object = context.lookup("java:comp/env/ejb/HelloEjb");
      System.out.println(object);
      HelloHome helloHome = null;
      if (object != null) {
      // PortableRemoteObject.narrow(object, HelloHome.class);
      helloHome = (HelloHome)PortableRemoteObject.narrow(object, HelloHome.class);

      Hello hello = helloHome.create();
      System.out.println(hello.hello());
      }

      I am able to compile entire code but When i excute EJB's I get ClassCastException on PortableRemoteObject.narrow(object, HelloHome.class);

      Please help.

        • 2. Re: ClassCastException on PortableRemoteObject.narrow(object
          Lave Kulshreshtha Newbie

          I have seen this link but I could not understand how to fix the problem.
          Can you please give me any idea about how JNDI lookup's are resolved in JBoss.

          I am able to lookup EJB in a web module but I can not narrow the lookup object to Home interface.

          -Lave

          • 3. Re: ClassCastException on PortableRemoteObject.narrow(object
            jaikiran pai Master

            lavkul,

            Are the home/local/remote interfaces of the bean present in the web as well as the ejb module? If yes, then remove those interfaces from the web module. Having it in 2 places results in this classloading issue.

            • 4. Re: ClassCastException on PortableRemoteObject.narrow(object
              Lave Kulshreshtha Newbie

              The remote and home interfaces are present only in ejb2.jar (ejb project jar), to access these interfaces in web module I have created project dependency in eclipse. So this should not be the reason.

              Does jBoss requires any special configuration for JNDI look up.

              Shall I use any other application server? I am very confused.

              Thanks in advance.
              -Lave

              • 5. Re: ClassCastException on PortableRemoteObject.narrow(object
                jaikiran pai Master

                Can you post the entire exception stacktrace that you see (remember to enclose the stacktrace in a code block using the Code button in the message editor window).

                • 6. Re: ClassCastException on PortableRemoteObject.narrow(object
                  Lave Kulshreshtha Newbie

                  Here is the entire stack trace, right from server startup to ejb exception.

                  cmd /c D:\jboss-4.2.1.GA\bin\run.bat -c default
                  
                  D:\jboss-4.2.1.GA\bin>echo off
                  ===============================================================================
                  
                   JBoss Bootstrap Environment
                  
                   JBOSS_HOME: D:\jboss-4.2.1.GA
                  
                   JAVA: D:\Program Files\Java\jdk1.5.0_06\bin\java
                  
                   JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
                  
                   CLASSPATH: D:\Program Files\Java\jdk1.5.0_06\lib\tools.jar;D:\jboss-4.2.1.GA\bin\run.jar
                  
                  ===============================================================================
                  
                  20:54:59,843 INFO [Server] Starting JBoss (MX MicroKernel)...
                  20:54:59,843 INFO [Server] Release ID: JBoss [Trinity] 4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)
                  20:54:59,843 INFO [Server] Home Dir: D:\jboss-4.2.1.GA
                  20:54:59,843 INFO [Server] Home URL: file:/D:/jboss-4.2.1.GA/
                  20:54:59,843 INFO [Server] Patch URL: null
                  20:54:59,843 INFO [Server] Server Name: default
                  20:54:59,843 INFO [Server] Server Home Dir: D:\jboss-4.2.1.GA\server\default
                  20:54:59,843 INFO [Server] Server Home URL: file:/D:/jboss-4.2.1.GA/server/default/
                  20:54:59,843 INFO [Server] Server Log Dir: D:\jboss-4.2.1.GA\server\default\log
                  20:54:59,843 INFO [Server] Server Temp Dir: D:\jboss-4.2.1.GA\server\default\tmp
                  20:54:59,843 INFO [Server] Root Deployment Filename: jboss-service.xml
                  20:55:01,140 INFO [ServerInfo] Java version: 1.5.0_06,Sun Microsystems Inc.
                  20:55:01,140 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_06-b05,Sun Microsystems Inc.
                  20:55:01,140 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
                  20:55:03,390 INFO [Server] Core system initialized
                  20:55:10,249 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
                  20:55:10,249 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
                  20:55:11,921 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
                  20:55:11,921 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
                  20:55:12,968 INFO [TransactionManagerService] Starting recovery manager
                  20:55:13,499 INFO [TransactionManagerService] Recovery manager started
                  20:55:13,499 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
                  20:55:23,718 INFO [EJB3Deployer] Starting java:comp multiplexer
                  20:55:29,046 INFO [ServiceEndpointManager] jbossws-1.2.1.GA (build=200704151756)
                  20:55:33,234 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.5.0_06\bin;.;D:\WINDOWS\System32;D:\WINDOWS;D:\WINDOWS\system32;D:\WINDOWS;D:\WINDOWS\System32\Wbem;C:\orawin95\bin
                  20:55:34,062 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
                  20:55:34,062 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
                  20:55:34,062 INFO [Catalina] Initialization processed in 1847 ms
                  20:55:34,062 INFO [StandardService] Starting service jboss.web
                  20:55:34,062 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.0.GA
                  20:55:34,140 INFO [Catalina] Server startup in 80 ms
                  20:55:34,499 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
                  20:55:36,468 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
                  20:55:38,031 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../tmp/deploy/tmp7398jbossws-context-exp.war/
                  20:55:38,577 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
                  20:55:42,296 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
                  20:55:43,671 INFO [MailService] Mail Service bound to java:/Mail
                  20:55:44,015 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
                  20:55:44,140 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
                  20:55:44,234 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
                  20:55:44,452 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
                  20:55:44,702 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
                  20:55:44,749 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
                  20:55:44,765 INFO [QuartzResourceAdapter] start quartz!!!
                  20:55:44,874 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
                  20:55:44,921 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
                  20:55:44,952 INFO [RAMJobStore] RAMJobStore initialized.
                  20:55:44,952 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
                  20:55:44,952 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
                  20:55:44,952 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
                  20:55:47,202 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
                  20:55:48,077 INFO [A] Bound to JNDI name: queue/A
                  20:55:48,077 INFO [B] Bound to JNDI name: queue/B
                  20:55:48,077 INFO [C] Bound to JNDI name: queue/C
                  20:55:48,077 INFO [D] Bound to JNDI name: queue/D
                  20:55:48,077 INFO [ex] Bound to JNDI name: queue/ex
                  20:55:48,109 INFO [testTopic] Bound to JNDI name: topic/testTopic
                  20:55:48,140 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
                  20:55:48,140 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
                  20:55:48,140 INFO [testQueue] Bound to JNDI name: queue/testQueue
                  20:55:48,202 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
                  20:55:48,249 INFO [DLQ] Bound to JNDI name: queue/DLQ
                  20:55:48,562 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
                  20:55:51,577 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                  20:55:51,593 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=MyEjb.jar,name=Hello,service=EJB3 with dependencies:
                  20:55:52,109 INFO [EJBContainer] STARTED EJB: com.wiley.examples.HelloBean ejbName: Hello
                  20:55:52,234 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                  20:55:52,234 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=MyEjb.jar,name=TesterBean,service=EJB3 with dependencies:
                  20:55:52,296 INFO [EJBContainer] STARTED EJB: com.wiley.examples.TesterEJB ejbName: TesterBean
                  20:55:52,312 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.1.GA/server/default/deploy/MyEjb.jar
                  20:55:52,468 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
                  20:55:53,468 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
                  20:55:53,499 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
                  20:55:53,640 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 53s:781ms
                  Connected to server
                  [2007-10-16 08:55:53,671] Module myWebEar: Module is being deployed, please wait...
                  20:55:53,749 INFO [EARDeployer] Init J2EE application: file:/E:/web/WebApp/myWebEar/myWebEar.ear
                  20:55:54,734 INFO [TomcatDeployer] deploy, ctxPath=/WebModule, warUrl=.../tmp/deploy/tmp7428myWebEar.ear-contents/WebModule-exp.war/
                  20:55:55,015 INFO [STDOUT] Filter Intialized
                  20:55:55,140 WARN [TomcatDeployer] Failed to setup clustering, clustering disabled. NoClassDefFoundError: org/jgroups/blocks/MethodCall
                  20:55:55,187 INFO [EARDeployer] Started J2EE application: file:/E:/web/WebApp/myWebEar/myWebEar.ear
                  [2007-10-16 08:55:55,187] Module myWebEar: Module is deployed successfully
                  20:55:55,390 INFO [STDOUT] Request initialized
                  20:55:55,718 INFO [STDOUT] Request destroyed
                  20:55:55,968 INFO [STDOUT] Request initialized
                  20:55:55,968 INFO [STDOUT] Request destroyed
                  20:56:18,296 INFO [EJBContainer] STOPPED EJB: com.wiley.examples.HelloBean ejbName: Hello
                  20:56:18,296 WARN [JmxKernelAbstraction] jboss.j2ee:jar=MyEjb.jar,name=Hello,service=EJB3 is not registered
                  20:56:18,312 INFO [EJBContainer] STOPPED EJB: com.wiley.examples.TesterEJB ejbName: TesterBean
                  20:56:18,312 WARN [JmxKernelAbstraction] jboss.j2ee:jar=MyEjb.jar,name=TesterBean,service=EJB3 is not registered
                  20:56:19,249 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                  20:56:19,249 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=MyEjb.jar,name=Hello,service=EJB3 with dependencies:
                  20:56:19,327 INFO [EJBContainer] STARTED EJB: com.wiley.examples.HelloBean ejbName: Hello
                  20:56:19,359 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                  20:56:19,359 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=MyEjb.jar,name=TesterBean,service=EJB3 with dependencies:
                  20:56:19,390 INFO [EJBContainer] STARTED EJB: com.wiley.examples.TesterEJB ejbName: TesterBean
                  20:56:19,406 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.1.GA/server/default/deploy/MyEjb.jar
                  20:56:33,624 INFO [STDOUT] Request initialized
                  20:56:33,656 ERROR [STDERR] java.lang.ClassCastException
                  20:56:33,671 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
                  20:56:33,671 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
                  20:56:33,671 ERROR [STDERR] at com.ejb.EjbServlet.doPost(EjbServlet.java:46)
                  20:56:33,671 ERROR [STDERR] at com.ejb.EjbServlet.doGet(EjbServlet.java:20)
                  20:56:33,671 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
                  20:56:33,671 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  20:56:33,671 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  20:56:33,671 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  20:56:33,671 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                  20:56:33,671 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  20:56:33,671 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                  20:56:33,671 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  20:56:33,671 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                  20:56:33,671 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                  20:56:33,671 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                  20:56:33,671 ERROR [STDERR] Caused by: java.lang.ClassCastException: $Proxy86
                  20:56:33,671 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
                  20:56:33,671 ERROR [STDERR] ... 23 more
                  20:56:33,671 INFO [STDOUT] Request destroyed
                  


                  • 7. Re: ClassCastException on PortableRemoteObject.narrow(object
                    jaikiran pai Master

                     

                    20:56:33,671 ERROR [STDERR] Caused by: java.lang.ClassCastException: $Proxy86
                    20:56:33,671 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Port
                    ableRemoteObject.java:212)


                    This does look like the interfaces being present in the classpath.

                    I have seen this link but I could not understand how to fix the problem.


                    Can you post the output of the jmx-console method mentioned in the wiki entry that i posted earlier?



                    • 8. Re: ClassCastException on PortableRemoteObject.narrow(object
                      Lave Kulshreshtha Newbie

                      When I create local ejb, then I am able to execute ejb from web application.

                      But When I create a remote ejb I face this problem.

                      I have seen the display class info method, it does not return any thing. I guess this method needs class name as i/p.

                      I am new JBoss also, so may be I am not aware about all the configurtions.

                      I have set ejb project in the classpath of web project, so that interfaces are available inside web application and this works fine in case of local ejb's.

                      -Lave

                      • 9. Re: ClassCastException on PortableRemoteObject.narrow(object
                        jaikiran pai Master

                        OK, let's take this one step at a time. From the logs that you posted, i see that you are first deploying MyEjb.jar:

                        20:55:52,312 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.1.GA/server/default/deploy/MyEjb.jar


                        At a later point of time, you are deploying myWebEar.ear which (as per the logs) contains MyEjb.jar and WebModule.war

                        20:55:53,749 INFO [EARDeployer] Init J2EE application: file:/E:/web/WebApp/myWebEar/myWebEar.ear


                        So ultimately, the MyEjb.jar is being deployed twice (i might be wrong, but at this point that's what i can infer from the logs). I would suggest that you delete the MyEjb.jar which is present at D:/jboss-4.2.1.GA/server/default/deploy and then restart JBoss. See if that solves the issue. Let us know how it goes.



                        • 10. Re: ClassCastException on PortableRemoteObject.narrow(object
                          Lave Kulshreshtha Newbie

                          I have created a new project and did a fresh deployment such that there is only one ejb project deployed but still problem is same.

                          I am attaching the logs again

                          [cmd /c D:\jboss-4.2.1.GA\bin\run.bat -c all
                          ===============================================================================

                          JBoss Bootstrap Environment

                          JBOSS_HOME: D:\jboss-4.2.1.GA

                          JAVA: D:\Program Files\Java\jdk1.5.0_06\bin\java

                          JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

                          CLASSPATH: D:\Program Files\Java\jdk1.5.0_06\lib\tools.jar;D:\jboss-4.2.1.GA\bin\run.jar

                          ===============================================================================

                          22:46:05,811 INFO [Server] Starting JBoss (MX MicroKernel)...
                          22:46:05,811 INFO [Server] Release ID: JBoss [Trinity] 4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)
                          22:46:05,811 INFO [Server] Home Dir: D:\jboss-4.2.1.GA
                          22:46:05,811 INFO [Server] Home URL: file:/D:/jboss-4.2.1.GA/
                          22:46:05,811 INFO [Server] Patch URL: null
                          22:46:05,811 INFO [Server] Server Name: all
                          22:46:05,811 INFO [Server] Server Home Dir: D:\jboss-4.2.1.GA\server\all
                          22:46:05,826 INFO [Server] Server Home URL: file:/D:/jboss-4.2.1.GA/server/all/
                          22:46:05,826 INFO [Server] Server Log Dir: D:\jboss-4.2.1.GA\server\all\log
                          22:46:05,826 INFO [Server] Server Temp Dir: D:\jboss-4.2.1.GA\server\all\tmp
                          22:46:05,826 INFO [Server] Root Deployment Filename: jboss-service.xml
                          22:46:06,467 INFO [ServerInfo] Java version: 1.5.0_06,Sun Microsystems Inc.
                          22:46:06,467 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_06-b05,Sun Microsystems Inc.
                          22:46:06,467 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
                          22:46:08,029 INFO [Server] Core system initialized
                          22:46:16,108 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
                          22:46:16,123 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
                          22:46:18,920 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
                          22:46:18,920 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
                          22:46:19,936 INFO [TransactionManagerService] Starting recovery manager
                          22:46:20,123 INFO [TransactionManagerService] Recovery manager started
                          22:46:20,123 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
                          22:46:28,842 INFO [EJB3Deployer] Starting java:comp multiplexer
                          22:46:30,764 INFO [InterceptorChainFactory] interceptor chain is:
                          class org.jboss.cache.interceptors.CallInterceptor
                          class org.jboss.cache.interceptors.PessimisticLockInterceptor
                          class org.jboss.cache.interceptors.UnlockInterceptor
                          class org.jboss.cache.interceptors.ReplicationInterceptor
                          class org.jboss.cache.interceptors.TxInterceptor
                          class org.jboss.cache.interceptors.CacheMgmtInterceptor
                          22:46:31,576 INFO [STDOUT]
                          -------------------------------------------------------
                          GMS: address is 192.168.1.3:1884
                          -------------------------------------------------------
                          22:46:33,608 INFO [TreeCache] viewAccepted(): [192.168.1.3:1884|0] [192.168.1.3:1884]
                          22:46:33,639 INFO [TreeCache] TreeCache local address is 192.168.1.3:1884
                          22:46:33,639 INFO [TreeCache] State could not be retrieved (we are the first member in group)
                          22:46:33,639 INFO [TreeCache] parseConfig(): PojoCacheConfig is empty
                          22:46:36,639 INFO [ServiceEndpointManager] jbossws-1.2.1.GA (build=200704151756)
                          22:46:40,264 INFO [SnmpAgentService] SNMP agent going active
                          22:46:42,404 INFO [DefaultPartition] Initializing
                          22:46:42,514 INFO [STDOUT]
                          -------------------------------------------------------
                          GMS: address is 192.168.1.3:1890
                          -------------------------------------------------------
                          22:46:44,529 INFO [DefaultPartition] Number of cluster members: 1
                          22:46:44,529 INFO [DefaultPartition] Other members: 0
                          22:46:44,529 INFO [DefaultPartition] Fetching state (will wait for 30000 milliseconds):
                          22:46:44,529 INFO [DefaultPartition] State could not be retrieved (we are the first member in group)
                          22:46:44,608 INFO [HANamingService] Started ha-jndi bootstrap jnpPort=1100, backlog=50, bindAddress=/127.0.0.1
                          22:46:44,670 INFO [DetachedHANamingService$AutomaticDiscovery] Listening on /127.0.0.1:1102, group=230.0.0.4, HA-JNDI address=127.0.0.1:1100
                          22:46:47,061 INFO [TreeCache] No transaction manager lookup class has been defined. Transactions cannot be used
                          22:46:47,201 INFO [InterceptorChainFactory] interceptor chain is:
                          class org.jboss.cache.interceptors.CallInterceptor
                          class org.jboss.cache.interceptors.EvictionInterceptor
                          class org.jboss.cache.interceptors.PessimisticLockInterceptor
                          class org.jboss.cache.interceptors.PassivationInterceptor
                          class org.jboss.cache.interceptors.ActivationInterceptor
                          class org.jboss.cache.interceptors.UnlockInterceptor
                          class org.jboss.cache.interceptors.ReplicationInterceptor
                          class org.jboss.cache.interceptors.TxInterceptor
                          class org.jboss.cache.interceptors.CacheMgmtInterceptor
                          22:46:47,248 INFO [STDOUT]
                          -------------------------------------------------------
                          GMS: address is 192.168.1.3:1896
                          -------------------------------------------------------
                          22:46:49,264 INFO [TreeCache] viewAccepted(): [192.168.1.3:1896|0] [192.168.1.3:1896]
                          22:46:49,264 INFO [TreeCache] TreeCache local address is 192.168.1.3:1896
                          22:46:49,373 INFO [InterceptorChainFactory] interceptor chain is:
                          class org.jboss.cache.interceptors.CallInterceptor
                          class org.jboss.cache.interceptors.EvictionInterceptor
                          class org.jboss.cache.interceptors.PessimisticLockInterceptor
                          class org.jboss.cache.interceptors.UnlockInterceptor
                          class org.jboss.cache.interceptors.ReplicationInterceptor
                          class org.jboss.cache.interceptors.TxInterceptor
                          class org.jboss.cache.interceptors.CacheMgmtInterceptor
                          22:46:49,436 INFO [STDOUT]
                          -------------------------------------------------------
                          GMS: address is 192.168.1.3:1901
                          -------------------------------------------------------
                          22:46:51,889 INFO [TreeCache] viewAccepted(): [192.168.1.3:1901|0] [192.168.1.3:1901]
                          22:46:51,889 INFO [TreeCache] TreeCache local address is 192.168.1.3:1901
                          22:46:53,576 INFO [CorbaNamingService] Naming: [IOR:000000000000002B49444C3A6F6D672E6F72672F436F734E616D696E672F4E616D696E67436F6E746578744578743A312E3000000000000200000000000000E4000102000000000A3132372E302E302E31000DC8000000114A426F73732F4E616D696E672F726F6F74000000000000050000000000000008000000004A414300000000010000001C000000000001000100000001050100010001010900000001050100010000002100000060000000000000000100000000000000240000001E0000007E00000000000000010000000C3139322E3136382E312E33000DC9004000000000000000000000001004010008060667810201010100000000000000000000000000000000000000000000002000000004000000000000001F0000000400000003000000010000002000000000000000020000002000000004000000000000001F0000000400000003]
                          22:46:53,717 INFO [CorbaTransactionService] TransactionFactory: [IOR:000000000000003049444C3A6F72672F6A626F73732F746D2F69696F702F5472616E73616374696F6E466163746F72794578743A312E30000000000200000000000000E4000102000000000A3132372E302E302E31000DC8000000144A426F73732F5472616E73616374696F6E732F46000000050000000000000008000000004A414300000000010000001C000000000001000100000001050100010001010900000001050100010000002100000060000000000000000100000000000000240000001E0000007E00000000000000010000000C3139322E3136382E312E33000DC9004000000000000000000000001004010008060667810201010100000000000000000000000000000000000000000000002000000004000000000000001F0000000400000003000000010000002000000000000000020000002000000004000000000000001F0000000400000003]
                          22:46:55,936 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jdk1.5.0_06\bin;.;D:\WINDOWS\System32;D:\WINDOWS;D:\WINDOWS\system32;D:\WINDOWS;D:\WINDOWS\System32\Wbem;D:\WINDOWS\system32;D:\WINDOWS;D:\WINDOWS\System32\Wbem;D:\GlassFish\glassfish\bin;C:\orawin95\bin
                          22:46:57,358 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
                          22:46:57,358 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
                          22:46:57,358 INFO [Catalina] Initialization processed in 1786 ms
                          22:46:57,358 INFO [StandardService] Starting service jboss.web
                          22:46:57,358 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.0.GA
                          22:46:57,873 INFO [Catalina] Server startup in 524 ms
                          22:46:58,139 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
                          22:47:00,123 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/httpha-invoker.sar/invoker.war/
                          22:47:00,748 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../tmp/deploy/tmp61882jbossws-context-exp.war/
                          22:47:01,779 INFO [TomcatDeployer] deploy, ctxPath=/juddi, warUrl=.../deploy/juddi-service.sar/juddi.war/
                          22:47:02,983 INFO [RegistryServlet] Loading jUDDI configuration.
                          22:47:02,983 INFO [RegistryServlet] Resources loaded from: /WEB-INF/juddi.properties
                          22:47:02,983 INFO [RegistryServlet] Initializing jUDDI components.
                          22:47:04,029 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy-hasingleton/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
                          22:47:05,248 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
                          22:47:07,248 INFO [MailService] Mail Service bound to java:/Mail
                          22:47:08,295 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
                          22:47:08,389 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
                          22:47:08,451 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
                          22:47:08,529 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
                          22:47:08,842 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
                          22:47:08,920 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
                          22:47:08,936 INFO [QuartzResourceAdapter] start quartz!!!
                          22:47:09,029 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
                          22:47:09,076 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
                          22:47:09,076 INFO [RAMJobStore] RAMJobStore initialized.
                          22:47:09,076 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
                          22:47:09,076 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
                          22:47:09,076 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
                          22:47:11,920 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
                          22:47:12,904 INFO [A] Bound to JNDI name: queue/A
                          22:47:12,904 INFO [B] Bound to JNDI name: queue/B
                          22:47:12,904 INFO [C] Bound to JNDI name: queue/C
                          22:47:12,904 INFO [D] Bound to JNDI name: queue/D
                          22:47:12,904 INFO [ex] Bound to JNDI name: queue/ex
                          22:47:12,951 INFO [testTopic] Bound to JNDI name: topic/testTopic
                          22:47:12,951 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
                          22:47:12,951 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
                          22:47:12,951 INFO [testQueue] Bound to JNDI name: queue/testQueue
                          22:47:13,014 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
                          22:47:13,092 INFO [DLQ] Bound to JNDI name: queue/DLQ
                          22:47:13,920 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
                          22:47:13,983 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
                          22:47:15,123 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
                          22:47:15,248 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
                          22:47:15,264 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 1m:9s:438ms
                          Connected to server
                          [2007-10-29 10:47:15,467] Module app: Module is being deployed, please wait...
                          22:47:15,483 INFO [EARDeployer] Init J2EE application: file:/D:/Documents%20and%20Settings/Lave/IdeaProjects/AjaxProject/app/app.ear
                          22:47:18,733 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                          22:47:18,764 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=app.ear,jar=EJB3.jar,name=loggerEJB,service=EJB3 with dependencies:
                          22:47:19,076 INFO [EJBContainer] STARTED EJB: sample.loggerBean ejbName: loggerEJB
                          22:47:19,139 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                          22:47:19,139 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=app.ear,jar=EJB3.jar,name=NewEJBEJB,service=EJB3 with dependencies:
                          22:47:19,186 INFO [EJBContainer] STARTED EJB: com.NewEJBBean ejbName: NewEJBEJB
                          22:47:19,342 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp61923app.ear-contents/EJB3.jar
                          22:47:19,358 INFO [TomcatDeployer] deploy, ctxPath=/web, warUrl=.../tmp/deploy/tmp61923app.ear-contents/web-exp.war/
                          22:47:19,373 WARN [EjbUtil] Can't locate deploymentInfo for target: file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/EJB3.jar
                          22:47:19,654 INFO [EARDeployer] Started J2EE application: file:/D:/Documents%20and%20Settings/Lave/IdeaProjects/AjaxProject/app/app.ear
                          [2007-10-29 10:47:19,654] Module app: Module is deployed successfully
                          22:47:52,858 INFO [STDOUT] ejbservlet: Before look up
                          22:47:52,858 ERROR [[ejbservlet]] Servlet.service() for servlet ejbservlet threw exception
                          java.lang.ClassCastException
                          at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
                          at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
                          at newejb.ejbservlet.doGet(ejbservlet.java:39)
                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                          at java.lang.Thread.run(Thread.java:595)
                          Caused by: java.lang.ClassCastException: $Proxy81
                          at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
                          ... 22 more
                          ]

                          • 11. Re: ClassCastException on PortableRemoteObject.narrow(object
                            jaikiran pai Master

                            Let's move the next step now. The logs show that you are deploying app.ear which contains EJB3.jar and web.war. Run the following commands from the command prompt and post the output here:

                            - From the command prompt, go to the folder where the app.ear is present.
                            - Run

                            jar -tf app.ear


                            Similarly move to the folders containing EJB3.jar and web.war

                            Run

                            jar -tf EJB3.jar


                            and

                            jar -tf web.war


                            Post the output here. This will show us what's the contents of these archives. Note that i have assumed that these files are archives and not exploded folders.

                            While posting the output, remember to wrap the contents in a code block, by using the Code button in the message editor window.

                            • 12. Re: ClassCastException on PortableRemoteObject.narrow(object
                              jaikiran pai Master

                               

                              "lavkul" wrote:

                              I have seen the display class info method, it does not return any thing. I guess this method needs class name as i/p.



                              I did not pay attention to this comment earlier. Sorry about that.
                              Yes, you have to pass an input parameter to the displayClassInfo method. The ejb-jar that you posted earlier shows that the bean home is com.wiley.examples.HelloHome. So this com.wiley.examples.HelloHome string will be input to the displayClassInfo method. Just pass this parameter through the textbox which is provided for this method on that page. Note that if you have changed your sample application, and are using a different home class now, then use that fully qualified class name as the input. Post the output of that method here. That might help us in resolving this issue, quicker.

                              • 13. Re: ClassCastException on PortableRemoteObject.narrow(object
                                Lave Kulshreshtha Newbie

                                Here is the result of displayClassInfo for com.NewEJBHome

                                com.NewEJBHome Information
                                Repository cache version:
                                com.NewEJBHome(fea539).ClassLoader=org.jboss.mx.loading.UnifiedClassLoader3@c5dbb{ url=file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear ,addedOrder=46}
                                ..org.jboss.mx.loading.UnifiedClassLoader3@c5dbb{ url=file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear ,addedOrder=46}
                                ....file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear
                                ....file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear-contents/EJB3.jar
                                ....file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear-contents/web-exp.war/
                                ..org.jboss.system.server.NoAnnotationURLClassLoader@1de3f2d
                                ..sun.misc.Launcher$AppClassLoader@a39137
                                ....file:/D:/Program%20Files/Java/jdk1.5.0_06/lib/tools.jar
                                ....file:/D:/jboss-4.2.1.GA/bin/run.jar
                                ..sun.misc.Launcher$ExtClassLoader@92e78c
                                ....file:/D:/Program%20Files/Java/jdk1.5.0_06/jre/lib/ext/dnsns.jar
                                ....file:/D:/Program%20Files/Java/jdk1.5.0_06/jre/lib/ext/localedata.jar
                                ....file:/D:/Program%20Files/Java/jdk1.5.0_06/jre/lib/ext/sunjce_provider.jar
                                ....file:/D:/Program%20Files/Java/jdk1.5.0_06/jre/lib/ext/sunpkcs11.jar
                                ++++CodeSource: (file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear-contents/EJB3.jar )
                                Implemented Interfaces:
                                ++interface javax.ejb.EJBHome(1aec0d1)
                                ++++ClassLoader: org.jboss.mx.loading.UnifiedClassLoader3@32784a{ url=null ,addedOrder=2}
                                ++++CodeSource: (file:/D:/jboss-4.2.1.GA/server/all/lib/jboss-j2ee.jar )
                                
                                ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@c5dbb{ url=file:/D:/jboss-4.2.1.GA/server/all/tmp/deploy/tmp51458app.ear ,addedOrder=46}
                                


                                • 14. Re: ClassCastException on PortableRemoteObject.narrow(object
                                  Lave Kulshreshtha Newbie

                                  The result of jar -tf app.ear

                                  C:\jars>jar -tf app.ear
                                  META-INF/MANIFEST.MF
                                  EJB3.jar
                                  web.war
                                  META-INF/application.xml
                                  META-INF/jboss-app.xml
                                  


                                  The result of jar -tf EJB3.jar
                                  META-INF/MANIFEST.MF
                                  sample/
                                  sample/LocalloggerHome.class
                                  sample/Locallogger.class
                                  sample/loggerBean.class
                                  com/
                                  com/NewEJBBean.class
                                  com/NewEJBHome.class
                                  com/NewEJB.class
                                  META-INF/ejb-jar.xml
                                  META-INF/jboss.xml
                                  


                                  The result of jar -tf web.war
                                  WEB-INF/classes/
                                  WEB-INF/classes/sample/
                                  WEB-INF/classes/sample/ajaxservlet.class
                                  WEB-INF/classes/newejb/
                                  WEB-INF/classes/newejb/ejbservlet.class
                                  index.html
                                  WEB-INF/
                                  WEB-INF/web.xml
                                  WEB-INF/jboss-web.xml
                                  META-INF/
                                  META-INF/MANIFEST.mf
                                  


                                  I use ejbservlet to invoke remote ejb NewEJBHome.

                                  1 2 Previous Next