Everything looks good except you spelled hashCode incorrectly.  You have:

public int HashCode()
{
        return customerId.hashCode();
}

You should have:

public int hashCode()
{
        return customerId.hashCode();
}

-dain

Saroj Kumar wrote:
> Hi All,
> 
> 
> When I am using Custom Primary key with JBOSS 3 , CMP2 with HYPERSONIC
> then this error I am getting :
> 
> This is the full stack trace ...
> 
>  [java] java.rmi.ServerException: RemoteException occurred in server
> thread; nested exception is:
>  [java] Caught an unexpected exception while making contract!
>  [java]     java.rmi.ServerException: removing bean lock and it has tx
> set!; nested exception is:
>  [java]     java.lang.IllegalStateException: removing bean lock and it
> has tx set!
>  [java]     at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
>  [java]     at sun.rmi.transport.Transport$1.run(Transport.java:148)
>  [java]     at java.security.AccessController.doPrivileged(Native
> Method)
>  [java]     at
> sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>  [java]     at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>  [java]     at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
> va:701)
>  [java]     at java.lang.Thread.run(Thread.java:536)
>  [java]     at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRem
> oteCall.java:247)
>  [java]     at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223
> )
>  [java]     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
>  [java]     at
> org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
>  [java]     at
> org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvoker
> Proxy.java:128)
>  [java]     at
> org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:1
> 08)
>  [java]     at
> org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.jav
> a:73)
>  [java]     at
> org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
>  [java]     at
> org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:116)
>  [java]     at
> org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
>  [java]     at $Proxy1.getCustomerId(Unknown Source)
>  [java]     at test_ejbs.make_Customer(test_ejbs.java:84)
>  [java]     at test_ejbs.<init>(test_ejbs.java:43)
>  [java]     at test_ejbs.main(test_ejbs.java:101)
>  [java] Caused by: java.rmi.ServerException: removing bean lock and it
> has tx set!; nested exception is:
>  [java]     java.lang.IllegalStateException: removing bean lock and it
> has tx set!
>  [java]     at
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterce
> ptor.java:119)
>  [java]     at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptor
> CMT.java:167)
>  [java]     at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
>  [java]     at
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.jav
> a:129)
>  [java]     at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:166)
>  [java]     at
> org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
>  [java]     at org.jboss.ejb.Container.invoke(Container.java:705)
>  [java]     at
> org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
>  [java]     at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
>  [java]     at
> org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362
> )
>  [java]     at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown
> Source)
>  [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>  [java]     at java.lang.reflect.Method.invoke(Method.java:324)
>  [java]     at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
>  [java]     at sun.rmi.transport.Transport$1.run(Transport.java:148)
>  [java]     at java.security.AccessController.doPrivileged(Native
> Method)
>  [java]     at
> sun.rmi.transport.Transport.serviceCall(Transport.java:144)
>  [java]     at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
>  [java]     at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.ja
> va:701)
>  [java]     at java.lang.Thread.run(Thread.java:536)
>  [java] Caused by: java.lang.IllegalStateException: removing bean lock
> and it has tx set!
>  [java]     at
> org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedPess
> imisticEJBLock.java:469)
>  [java]     at
> org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:78)
>  [java]     at
> org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor
> .java:124)
>  [java]     at
> org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInt
> erceptor.java:69)
>  [java]     at
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterce
> ptor.java:96)
>  [java]     ... 19 more
> 
> ****************************
> **    CustomPK                 ***
> ****************************
> 
> I am using CustomPK like this:
> import java.io.*;
> 
> public class CustomerPK implements Serializable
> {
>       public String customerId ;
> 
>       public CustomerPK()
>       {
> 
>       }
> 
>       public CustomerPK(String customerId)
>       {
>               this.customerId = customerId;
>       }
> 
>       public String toString()
>       {
>               return  customerId.toString();
>       }
> 
>       public int HashCode()
>       {
>               return customerId.hashCode();
>       }
> 
>       public boolean equals(Object obj)
>       {
>               if (obj instanceof CustomerPK)
>               {
>                       CustomerPK c = (CustomerPK)obj;
> 
>                       if (c.customerId == null)
>                       {
>                               return customerId == null;
>                       }
> 
>                       return c.customerId.equals(customerId);
>               }
> 
>               return false;
>       }
> 
> }
> 
> 
> TIA,
> Saroj
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Two, two, TWO treats in one.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Two, two, TWO treats in one.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to