Bugs item #562972, was opened at 2002-05-31 13: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: Closed
Resolution: Invalid
Priority: 1
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: Alvaro Mota Goncalves (alvaromota)
Date: 2002-11-24 21:16

Message:
Logged In: YES 
user_id=354157

Hi
I have in 3.0.4, Linux, JVM 1.3.1 - Blackdown
A session Bean packaged in a jar file (Session01) is calling
one  entity bean packaged in another jar file Entity01 .
Works great.
I have one client in Tomcat in another machine.

If I hot-deploy Session01.jar, it's work. But hot-deploy
Entity01 
get 
20:34:59,449 ERROR [LogInterceptor] RuntimeException:
java.lang.ClassCastException: $Proxy156
        at
com.da.motion.testeAlvaro.model.statelessEJB.SManterTesteEJB.findAll(SManterTes
teEJB.java:75)

The solution is to hot-deploy Entity01 and Session01 works fine.

Alvaro

----------------------------------------------------------------------

Comment By: S. von Knellehekje (sandigo)
Date: 2002-11-01 13:49

Message:
Logged In: YES 
user_id=640469

Oh, thanks man! 

I have been looking for a solution for that problem and all
I had to do was remove the jndi.properties, which was still
there from the time we sepperated tomcat and jboss onto
different servers.

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2002-10-29 20:34

Message:
Logged In: YES 
user_id=175228

The only time I have seen this is when the deployment unit 
includes a jndi.properties file that causes the home proxies 
to be marshalled via RMI MarshalledObjects. These cache 
classes in the VM and defeat the hot deploy feature. In the 
absence of a contrary testcase I'm marking this as invalid.

----------------------------------------------------------------------

Comment By: Marius Kotsbak (mkotsbak)
Date: 2002-10-06 06:32

Message:
Logged In: YES 
user_id=366650

Time to close this now, as invalid/works for me? I reported
it initially, but havent't seen it in the recent versions of
jboss and JVMs. If you get this, I think it is because of
multiple versions of the same classes in .wars and .jars,
compiling on different version of JVM than running on (e.g.
1.3/1.4)

----------------------------------------------------------------------

Comment By: Gerald Benischke (beny23)
Date: 2002-10-04 05:19

Message:
Logged In: YES 
user_id=390777

Good morning,

I have the same ClassCastException problem with an EJB/Web
application running JBoss 3.0.2 on on JDK1.4.1 on Win2K.
I downgraded to the JDK1.3.1_04 and when I change my EJB and
redeploy, the exception reads:
ClassCastException: $Proxy45$ instead of just
ClassCastException

hope that helps,
Gerald.

----------------------------------------------------------------------

Comment By: Lo�c Lef�vre (jvsd)
Date: 2002-09-30 03:16

Message:
Logged In: YES 
user_id=614368

Hello,
I don't know where you are about this bug but what Rune 
says (Directory not deleted after re-deploy) reminds me 
something:

I currently work on an application that heavily use Files 
creation/deletion with 2 concurrent JVMs. And I encountered 
bugs because of the new way Files are managed between 
different process. If a handle is still active on a File then 
deleting it with an other process failed with the JDK 1.4+. 
This problem don't seem to appear with JDK 1.3.1+. At least, 
deleting the files work... Perhaps because of the new 
package java.nio that uses system libraries... :-(
Solution to resolve this bug: close ALL the Files "handled" 
taking care of inter-process behaviours.

Hope it helps,
Loic



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-09-30 02:10

Message:
Logged In: NO 

I experienced this problem with jboss 3.0.2 and jdk 1.4.0_01
and jdk 1.4.1.

I just switched to jdk 1.3.1_04 and things work fine.


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-09-18 04:54

Message:
Logged In: NO 

I investigated the problem as it arise on jboss-3.0.1_tomcat-4.0.4 
on Win2000. 

I use the following code to look-up a local home interface from a 
servlet deployed in the same ear as my ejbs: 

--- code begin ---
logger.debug("SomeEJBHome was loaded by: " + 
   SomeEJBHome.class.getClassLoader().toString());
InitialContext ic = new InitialContext();
Context ejbCtx = (Context) ic.lookup("java:comp/env/ejb");
Object o = ejbCtx.lookup(ejbRefName);
Class[] intfs = o.getClass().getInterfaces();
logger.debug("intf : " + intfs[0].toString() + " was 
   loaded by: " + intfs[0].getClassLoader().toString());
home = (SomeEJBHome)o;
--- code end ---

Log before hot redeploy:
12:41:30,866 DEBUG [SomeEJBFactory] SomeEJBHome was 
   loaded by:    org.jboss.mx.loading.UnifiedClassLoader@2b9f14
{    url=file:...
12:41:31,067 DEBUG [SomeEJBFactory] intf : interface    
SomeEJBHome was loaded by:    
org.jboss.mx.loading.UnifiedClassLoader@2b9f14{    url=file:...

Log after hot redeploy:
12:42:37,142 DEBUG [SomeEJBFactory] SomeEJBHome was    
loaded by: org.jboss.mx.loading.UnifiedClassLoader@c0d0a8   { 
url=file:...
12:42:37,212 DEBUG [SomeEJBFactory] intf : interface 
SomeEJBHome was loaded by:    
org.jboss.mx.loading.UnifiedClassLoader@2b9f14{    url=file:...

The JBoss-generated proxy-class that implements my home 
interface is not reloaded after re-deploy. It therefore still 
implements the home-interface that was loaded from the previous 
deployment (or rather by the UnifiedClassLoader object created 
during the first deployment). When my code tries to cast to the 
home-interface loaded from this deployment I get the 
ClassCastException.

I also see that the temporary files that JBoss 
create ...server\default\tmp\deploy... are not removed, and are 
still held by JBoss after my re-deploy.

Rune

----------------------------------------------------------------------

Comment By: Brian Huang (kinmen)
Date: 2002-08-18 22:41

Message:
Logged In: YES 
user_id=597050

 Normally PortableRemoteObject will return a Proxy object. 
However, in case it returns a MarshalledValuePair object, the 
ClassCastException will be thrown. This is because you don't 
have all the jar files in your ${JBOSS_HOME}/client directory 
in your classpath. Please discover if you got a 
MarshalledValuePair object back. 
 
Brian Hunag 

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-12 11:40

Message:
Logged In: NO 

I get the same error as before with 3.0.0.  Does the problem for you go away on both 
IBM's 1.3 JVM and Sun's 1.4 
JVM?  Also I am on Sun's 1.4.0_01 JVM on W2K.

Matt

----------------------------------------------------------------------

Comment By: Steve Harvey (sgharvey)
Date: 2002-08-12 04:50

Message:
Logged In: YES 
user_id=593359

If you are using 3.0.0, have you tried 3.0.1?

I went through the same thing as Matt about a week ago,
except I also examined the class loader delegation chains
for both obj and the homeIF class with code like:

    try {
      // traverse the chain of delegated
classloaders              // towards the bootstrap
      Class currClass = clazz;
      ClassLoader cl;
      while ( (cl = currClass.getClassLoader()) != null ) {
        System.out.println(label+":classloader is " + cl);
        currClass = cl.getClass();
      }
    } catch ( Exception e ) {
      System.out.println("looking for CLs, got " + e);
    }

and got discrepancies (more details in my followup for bug
563120) which went away (with the ClassCastException) with
3.0.1 .  I too was getting CCE whether or not I used
PortableRemoteObject.narrow.

- Steve

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-09 12: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 12: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 20: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 20: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 05: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 23: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 21: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 19: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 18: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 12: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 15: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

Reply via email to