-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 42 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Urgent Help needed. Proxy error with JBoss/Hibernate
PostPosted: Tue Dec 23, 2003 2:12 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
Hi,

I am getting this when running HIbernate objects under JBoss as a MBean:

java.lang.ClassCastException: cannot assign instance of net.sf.hibernate.proxy.SerializableProxy to field com.db.device.NetPortalSubnetwork.network of type com.db.device.NetPortalNetwork in instance of com.db.device.NetPortalSubnetwork

If I run the same code outside of JBoss everything works fine !

pls help,

TIA,

--steve p.

(mappings)

Code:
  <class name="com.db.device.NetPortalSubnetwork" table="subnet" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" proxy="com.db.device.NetPortalSubnetwork">
      <id name="id" type="long" unsaved-value="0">
         <generator class="native">
         </generator>
      </id>
       
        <property name="name" column="name" type="string"/>
        <property name="description" column="description" type="string"/>
      <many-to-one name="network" class="com.db.device.NetPortalNetwork" column="net_subnet_id"/>

      <set name="mgmtInfo" table="ne_subnet" inverse="true" lazy="false">
         <key column="subnet_id"/>
         <many-to-many class="com.db.device.NEMgmtInfo" column="ne_subnet"/>
      </set>

      <set name="ems" table="subnet_ems" inverse="true" lazy="false">
         <key column="ems_id"/>
         <many-to-many class="com.db.device.Ems" column="ne_subnet"/>
      </set>

        <property name="netPortalControlled" type="boolean"/>
        <property name="layerNumber" type="int"/>
        <property name="topologyType" type="com.db.device.TopologyEnum"/>
        <property name="technologyType" type="com.db.qos.DomainType"/>
      <many-to-one name="moHistory" class="com.db.device.MOHistory" cascade="all"/>
       
    </class>

and
Code:
<class name="com.db.device.NetPortalNetwork" table="network" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" proxy="com.db.device.NetPortalNetwork">
      <id name="id" type="long" unsaved-value="0">
         <generator class="native">
         </generator>
      </id>
       
        <!--property name="name" column="name" type="string"/-->
      <many-to-one name="netName" class="com.db.device.NEName"  column="net_name" cascade="all"/>
       
        <property name="description" column="description" type="string"/>

       <set name="subnet" cascade="all-delete-orphan" inverse="true" lazy="true">
         <key column="net_subnet_id"/>
         <one-to-many class="com.db.device.NetPortalSubnetwork"/>
       </set>
       
       <set name="sites" cascade="all-delete-orphan" inverse="true" lazy="true">
         <key column="net_site_id"/>
         <one-to-many class="com.db.device.NetPortalSite"/>
       </set>

       <set name="pools" cascade="all-delete-orphan" lazy="true">
         <key column="pool_info_id"/>
         <one-to-many class="com.db.device.NetPortalPoolInfo"/>
       </set>

       <set name="ems" cascade="all-delete-orphan" lazy="true">
         <key column="net_ems_id"/>
         <one-to-many class="com.db.device.Ems"/>
       </set>

       <set name="networkElements" inverse="false" lazy="true">
         <key column="network_ne_id"/>
         <one-to-many class="com.db.device.NEMgmtInfo"/>
       </set>
      <many-to-one name="moHistory" class="com.db.device.MOHistory" cascade="all"/>

    </class>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 2:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Any cglib mismatch in your CP ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 2:40 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
epbernard wrote:
Any cglib mismatch in your CP ?


I use 2.1 beta6 and I have

cglib.jar
cglib-asm.jar

in
D:\jboss-3.2.2\server\default\lib

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 2:49 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No more idea :-(

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:25 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
You should not have both of those JARs in there! From memory, just cglib-asm.jar.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:31 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
sgwood wrote:
You should not have both of those JARs in there! From memory, just cglib-asm.jar.


Sherman


Tried with each of them (one at a time)
Same result ...

What else ... :(

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:34 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Try 2.1.1?


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:41 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
sgwood wrote:
Try 2.1.1?


Sherman


With 2.1.1 I get errors even before , when parsing the mapping files. Looks like cglib2 hangs with something like:

Code:
..................
reflection optimizer disabled for: com.db.device.SupportedNeType, IllegalAccessError: null
[ServiceController] Problem starting service jboss.jca:service=HibernateFactory,
java.lang.IllegalAccessError
at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:87)
...................

where the previous versions of cglib worked fine ...


Quite disappointed ... :(

Thx again.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 4:02 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
A few things to look into:

1. How are you packaging your SAR?

2. For Hibernate 2.1.1, the only JARs you need are:

hibernate2.jar
cglib2.jar
commons-collections.jar
commons-logging.jar
dom4j.jar
odmg.jar
ehcache.jar

3. There is a FAQ related to your XXX problem: http://forum.hibernate.org/viewtopic.php?t=926219&highlight=illegalaccesserror

4. You don't need any Hibernate related JARs in the lib directory any more - they can live in your SAR or EAR. Check out http://www.hibernate.org/66.html


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 4:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is surely some cglib problem, please double check that you have only cglib2.jar in your classpath, check all JBoss directorys. Compare http://hibernate.org/74.html#A3


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 1:51 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
gloeglm wrote:
This is surely some cglib problem, please double check that you have only cglib2.jar in your classpath, check all JBoss directorys. Compare http://hibernate.org/74.html#A3


OK, I got it running with 2.1.1 (CGLIB2) but I still have the original problem:

java.lang.ClassCastException: cannot assign instance of net.sf.hibernate.proxy.SerializableProxy to field com.db.device.NetPortalSubnetwork.network of type com.db.device.NetPortalNetwork in instance of com.db.device.NetPortalSubnetwork

If I run the same code outside of JBoss everything works fine !

I made sure only CGLIB2 is in the JBoss directories.

Please help [again]...

Thanks so much!

--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 3:30 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
I don't use proxies at all. Hmmm, can you try running it without the proxy tags in the class metadata?

Can you post the code and the full stack trace you are getting?

Also, log it in Hibernate JIRA.


Sorry I can't help on this too much,


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 4:10 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
sgwood wrote:
I don't use proxies at all. Hmmm, can you try running it without the proxy tags in the class metadata?

Can you post the code and the full stack trace you are getting?

Also, log it in Hibernate JIRA.


Sorry I can't help on this too much,


Sherman


Hi,

stack trace:
14:40:15,479 ERROR [STDERR] java.lang.ClassCastException: cannot assign instance of net.sf.hibernate.proxy.SerializableProxy to field com.diatem.db.device.NetPortalSubnetwork.network of type com.diatem.db.device.NetPortalNetwork in instance of com.diatem.db.device.NetPortalSubnetwork
14:40:15,479 ERROR [STDERR] at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:1840)
14:40:15,479 ERROR [STDERR] at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1062)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1851)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
14:40:15,479 ERROR [STDERR] at java.util.HashMap.readObject(HashMap.java:985)
14:40:15,479 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)
14:40:15,479 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:40:15,479 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:40:15,479 ERROR [STDERR] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:824)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,479 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1603)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1271)
14:40:15,495 ERROR [STDERR] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
14:40:15,495 ERROR [STDERR] at org.jboss.invocation.MarshalledValue.get(MarshalledValue.java:78)
14:40:15,495 ERROR [STDERR] at org.jboss.invocation.MarshalledInvocation.getArguments(MarshalledInvocation.java:346)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
14:40:15,495 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
14:40:15,495 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:700)
14:40:15,495 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:40:15,495 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:40:15,495 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:40:15,495 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:40:15,495 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
14:40:15,495 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
14:40:15,495 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
14:40:15,495 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:40:15,495 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:40:15,495 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:40:15,495 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:40:15,495 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
14:40:15,495 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:148)
14:40:15,495 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
14:40:15,495 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
14:40:15,495 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
14:40:15,495 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
14:40:15,495 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)
14:40:15,510 ERROR [LogInterceptor] RuntimeException:
java.lang.IllegalArgumentException: wrong number of arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)


tia,
--steve p.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 6:13 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
This is some problem with serializing your objects as they are passed as arguments into the session bean. There are some issues in JIRA related to this.

Do they implement Serializable?


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 10:15 pm 
Pro
Pro

Joined: Mon Sep 08, 2003 4:30 pm
Posts: 203
sgwood wrote:
This is some problem with serializing your objects as they are passed as arguments into the session bean. There are some issues in JIRA related to this.

Do they implement Serializable?


Sherman


They do, as far as I know.
But I'll double check.

Thanks again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 42 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.