Bugs item #562972, was opened at 2002-05-31 09:30 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=562972&group_id=22866
Category: JBossServer Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 8 Submitted By: Marius Kotsbak (mkotsbak) Assigned to: Nobody/Anonymous (nobody) Summary: Error in PortableRemoteObject.narrow() Initial Comment: 18:30:30,517 ERROR [STDERR] java.lang.ClassCastException 18:30:30,518 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293) 18:30:30,519 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134) When running narrow after lookup from a servlet. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2002-08-09 08:33 Message: Logged In: NO This bug is killing my development efforts, but it doesn't look like JBoss fault, but rather the VM's. First a few investigative notes. This ClassCastException happens on both remote and local interfaces using PortableRemoteObject and without. PortableRemoteObject has nothing to do with this bug. If some investigative code is put in like this in the setSessionContext: Context ctx = new InitialContext(); Object obj = ctx.lookup("local/BeanAHome"); Class[] c = obj.getClass().getInterfaces(); System.out.println(obj.getClass().getSuperclass().getName()); for (int i=0; i<c.length; i++) { System.out.println(c[i].getName()); } BeanAHome home = (BeanAHome)obj; We find the following out. First, as expected, obj is of java.lang.reflect.Proxy class. Next we check to see what interfaces it implements. The output show com.mycompany.BeanAHome as an implemented interface in the Proxy. However, when a cast is made to this object an exception occurs. This makes no sense because reflection shows it implements the desired interface. I have looked at Sun's bug parade have not found anything like this. I however didn't look to hard at it. There is a chance that JBoss could be responsible for this bug, but I don't feel like searching in the code and my next project is on Oracle 9iAS. If I get some more time, I will look into this more. A good test would be to download java 1.3 and see if the bug goes away. My guess is that is does. Matt ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2002-08-09 08:30 Message: Logged In: NO This bug is killing my development efforts, but it doesn't look like JBoss fault, but rather the VM's. First a few investigative notes. This ClassCastException happens on both remote and local interfaces using PortableRemoteObject and without. PortableRemoteObject has nothing to do with this bug. If some investigative code is put in like this in the setSessionContext: Context ctx = new InitialContext(); Object obj = ctx.lookup("local/BeanAHome"); Class[] c = obj.getClass().getInterfaces(); System.out.println(obj.getClass().getSuperclass().getName()); for (int i=0; i<c.length; i++) { System.out.println(c[i].getName()); } BeanAHome home = (BeanAHome)obj; We find the following out. First, as expected, obj is of java.lang.reflect.Proxy class. Next we check to see what interfaces it implements. The output show com.mycompany.BeanAHome as an implemented interface in the Proxy. However, when a cast is made to this object an exception occurs. This makes no sense because reflection shows it implements the desired interface. I have looked at Sun's bug parade have not found anything like this. I however didn't look to hard at it. There is a chance that JBoss could be responsible for this bug, but I don't feel like searching in the code and my next project is on Oracle 9iAS. If I get some more time, I will look into this more. A good test would be to download java 1.3 and see if the bug goes away. My guess is that is does. Matt ---------------------------------------------------------------------- Comment By: Brian Topping (topping) Date: 2002-07-21 16:23 Message: Logged In: YES user_id=99236 See 584663. Couldn't attach a file here. HTH ---------------------------------------------------------------------- Comment By: Scott M Stark (starksm) Date: 2002-07-21 16:13 Message: Logged In: YES user_id=175228 Many of our unit tests make use of PortableRemoteObject.narrow without any problems so post a testcase that demonstrates this if you want to get this resoved. ---------------------------------------------------------------------- Comment By: Brian Topping (topping) Date: 2002-07-20 01:10 Message: Logged In: YES user_id=99236 Okay, this is curious: I've been setting up JUnit, trying to localize this bug, figuring it's something to do with my code. Nothing but ClassCastException, over and over again. Then I turned *off* the "Reload classes every run" option on the JUnit GUI. Suddenly my test passes. I can run the test multiple times, turn on the switch, down it goes, ClassCastException. Ad nauseum, no differences from the script. I can reproduce this 100%. I'm not familiar with the what this switch does, but it might be a clue into this bug. ---------------------------------------------------------------------- Comment By: Brian Topping (topping) Date: 2002-07-19 19:04 Message: Logged In: YES user_id=99236 By the way, I've tested this with only a single copy of the ejb jar (or anything that would contain the interfaces) in deploy, the tmp and work directories blown away, and confirmed that the remote interfaces work properly from a web container client. This shouldn't be this hard, FWIW it's definitely got everything here at a standstill. ---------------------------------------------------------------------- Comment By: Brian Topping (topping) Date: 2002-07-19 17:58 Message: Logged In: YES user_id=99236 I'm having this problem as well, here is my test code: Properties params = new Properties(); params.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.Na mingContextFactory"); params.put(Context.PROVIDER_URL, "localhost"); params.put (Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.int erfaces" ); InitialContext initialContext = new InitialContext(params); try { java.lang.Object objRef = initialContext.lookup (com.bill2.ejb.CustomerHome.JNDI_NAME); return (com.bill2.ejb.CustomerHome) PortableRemoteObject.narrow(objRef, com.bill2.ejb.CustomerHome.class); } finally { initialContext.close(); } ---------------------------------------------------------------------- Comment By: Kenny Smith (subsstuff1) Date: 2002-06-04 15:06 Message: Logged In: YES user_id=548391 hell no spoke to soon - problem still exists, disguised as a different exception: ---- 00:03:26,130 ERROR [STDERR] java.lang.ClassCastException 00:03:26,130 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableR emoteObject.narrow(PortableRemoteObject.java:293) 00:03:26,140 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(Portabl eRemoteObject.java:134) 00:03:26,150 ERROR [STDERR] at com.foo.account.AccountUtil.getHome(Unknown Source) 00:03:26,160 ERROR [STDERR] at com.foo.account.AccountRegistryBean.createAccount (Unknown Source) 00:03:26,170 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method) 00:03:26,180 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N ativeMethodAccessorImpl.java:39) 00:03:26,190 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo ke(DelegatingMethodAccessorImpl.java:25) 00:03:26,200 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3 24) 00:03:26,210 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta inerInterceptor.invoke(StatelessSessionContainer.java:664) 00:03:26,220 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo nnectionInterceptor.invoke (CachedConnectionInterceptor.java:186) 00:03:26,230 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc eInterceptor.invoke (StatelessSessionInstanceInterceptor.java:77) 00:03:26,240 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i nvokeNext(AbstractTxInterceptor.java:96) 00:03:26,250 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit hTransactions(TxInterceptorCMT.java:167) 00:03:26,260 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke (TxInterceptorCMT.java:61) 00:03:26,270 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv oke(SecurityInterceptor.java:129) 00:03:26,280 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L ogInterceptor.java:166) 00:03:26,300 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.invok e(StatelessSessionContainer.java:313) 00:03:26,310 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java :705) 00:03:26,320 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB eanServerImpl.java:491) 00:03:26,330 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker. invoke(JRMPInvoker.java:362) 00:03:26,340 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor30.invoke( Unknown Source) 00:03:26,350 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo ke(DelegatingMethodAccessorImpl.java:25) 00:03:26,360 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3 24) 00:03:26,370 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(Unic astServerRef.java:261) 00:03:26,380 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.j ava:148) 00:03:26,390 ERROR [STDERR] at java.security.AccessController.doPrivileged(N ative Method) 00:03:26,390 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Trans port.java:144) 00:03:26,400 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMess ages(TCPTransport.java:460) 00:03:26,410 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$Connection Handler.run(TCPTransport.java:701) 00:03:26,440 ERROR [STDERR] at java.lang.Thread.run (Thread.java:536) ---------------------------------------------------------------------- Comment By: Kenny Smith (subsstuff1) Date: 2002-06-04 14:36 Message: Logged In: YES user_id=548391 just installed JBoss 3.0.0 (2002.05.31) - problem gone ---------------------------------------------------------------------- Comment By: Kenny Smith (subsstuff1) Date: 2002-06-04 08:55 Message: Logged In: YES user_id=548391 samew problem here and Im using a session bean same as the --- [ jboss-Bugs-563120 ] ClassCastException after redeploy bug ---------------------------------------------------------------------- Comment By: Christian Riege (lqd) Date: 2002-05-31 11:44 Message: Logged In: YES user_id=176671 can you pls. attach a simple testcase for this? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=562972&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development