I've seen problems like this with other EJB servers when my classpath was
wrong or pointing to a different version of the class.

-Alexandre

On Fri, 01 Sep 2000 09:46:28 -0400
   Richard Deadman <[EMAIL PROTECTED]> wrote:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - -



Rickard,

I am using JBoss 2.0.  Here is my ejb-jar.xml:
-------
<?xml version="1.0" encoding="Cp1252"?>

<ejb-jar>
     <description>jBoss test application </description>
     <display-name>Test</display-name>
     <enterprise-beans>
       <entity>
         <description>Models a User</description>
         <ejb-name>UserBean</ejb-name>
         <home>ca.deadman.User.UserHome</home>
         <remote>ca.deadman.User.User</remote>
         <ejb-class>ca.deadman.User.UserEJB</ejb-class>
         <persistence-type>Container</persistence-type>
         <prim-key-class>ca.deadman.User.UserPK</prim-key-class>
         <reentrant>False</reentrant>
         <cmp-field><field-name>id</field-name></cmp-field>
         <cmp-field><field-name>firstName</field-name></cmp-field>
         <cmp-field><field-name>lastName</field-name></cmp-field>
         <cmp-field><field-name>address</field-name></cmp-field>
         <cmp-field><field-name>city</field-name></cmp-field>
         <cmp-field><field-name>region</field-name></cmp-field>
         <cmp-field><field-name>country</field-name></cmp-field>
         <cmp-field><field-name>postalCode</field-name></cmp-field>
         <cmp-field><field-name>telephone</field-name></cmp-field>
         <cmp-field><field-name>email</field-name></cmp-field>
         <primkey-field>id</primkey-field>
       </entity>
     </enterprise-beans>
   </ejb-jar>
----

My UserPK class identifies one public variable:
    public String id;

My UserEJB class identifies the same variable:
    public String id;

My UserHome defines:
    public User findByPrimaryKey(UserPK key)
        throws FinderException, RemoteException;

When I run a test program to findByPrimaryKey with a parameter of type
UserPK, the EJB container throws:
--------
[UserBean] java.rmi.ServerException: Load failed; nested exception is:
[UserBean]      java.lang.ClassCastException: ca.deadman.User.UserPK at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.setParameter(JAWSPersist
enceManager.java:1306)[UserBean]
java.lang.ClassCastException: ca.deadman.User.UserPK
at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersisten
ceManager.java:629)[UserBean]
at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.setParameter(JAWSPersist
enceManager.java:1306)


[UserBean]      at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke
(EntitySynchronizationInterceptor.java:240)     at
org.jboss.ejb.plugins.EntityS
ynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:240
)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
java:82)
[UserBean]      at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(
JAWSPersistenceManager.java:629)

        at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
Interceptor.java:88)[UserBean]  at
org.jboss.ejb.plugins.SecurityInterceptor.inv
oke(SecurityInterceptor.java:82)

        at
org.jboss.ejb.plugins.TxInterceptor.invoke(TxInterceptor.java:179)

        at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:140)[
UserBean]       at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(Entity
InstanceInterceptor.java:88)

[UserBean]      at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.ja
va:140) at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:212)
        at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPCon
tainerInvoker.java:129)

        at java.lang.reflect.Method.invoke(Native Method)[UserBean]     at
org.j
boss.ejb.EntityContainer.invoke(EntityContainer.java:212)

[UserBean]      at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke
(JRMPContainerInvoker.java:129)
        at sun.rmi.server.UnicastServerRef.dispatch(Unknown
Source)[UserBean]

at java.lang.reflect.Method.invoke(Native Method)

[UserBean]      at sun.rmi.server.UnicastServerRef.dispatch(Unknown
Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native
Method)[UserBean]
        at sun.rmi.transport.Transport$1.run(Unknown Source)

[UserBean]      at java.security.AccessController.doPrivileged(Native
Method)

        at sun.rmi.transport.Transport.serviceCall(Unknown
Source)[UserBean]
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)

[UserBean]      at
sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Sou
rce)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Sour
ce)[UserBean]   at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unkn
own Source)

        at java.lang.Thread.run(Unknown Source)
[UserBean]      at java.lang.Thread.run(Unknown Source)
[Default] java.rmi.ServerException: Load failed; nested exception is:
        java.lang.ClassCastException: ca.deadman.User.UserPK
[Default] java.lang.ClassCastException: ca.deadman.User.UserPK
[UserBean]      at
org.jboss.ejb.plugins.TxInterceptor.invoke(TxInterceptor.java
:179)

Any ideas?  Thanks


Richard
--

Rickard �berg wrote:

> Richard Deadman wrote:
> > I'm trying to move an CMP entity bean with a PrimaryKey defined in its
> > own class (i.e. UserPK) into JBoss.  This class has one field (id)
that
> > is a String and that maps to one of the bean's attributes that I have
> > mapped through JAWS to a VARCHAR field.
> >
> > The problem is that when I call "UserHome.findByPrimaryKey(key)",
JBoss
> > gets upset because it is expecting key to be a String not a UserPK
> > object.  ClassCastException and all that.
> >
> > I'm moving an EJB built using VisualCafe wizards and this is how the
> > wizards construct the bean.  Is VisualCafe wrong?  Do I need to do
some
> > mapping to tell JAWS to extract the real key somehow from the object?
> > Is this just a limitation of JBoss for now?
>
> There is no such limitation. I'm guessing that your ejb-jar.xml is
> weird. Can you please provide it?
>
> /Rickard
>
> --
> Rickard �berg
>
> Email: [EMAIL PROTECTED]
> http://www.telkel.com
> http://www.jboss.org
> http://www.dreambean.com
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]




---
Alexandre POLOZOFF
Project:  Diamond Technology Partners
Project Email: [EMAIL PROTECTED]
Tel +1 312-475-8751
Mobile +1 312-371-3015




---
Sent via the OfficeServant.com web-mail server
Come to the free anytime, anywhere web-based office applications server

Received: from cgi.clearink.com [205.227.191.14] by officeservant.com
  (SMTPD32-5.01) id AF314D2C0140; Fri, 01 Sep 2000 08:29:21 CST
Received: from magma.ca by cgi.clearink.com with SMTP; Fri, 1 Sep 2000
 06:28:37 -0700
Message-ID: <[EMAIL PROTECTED]>
Date: Fri, 01 Sep 2000 09:46:28 -0400
From: Richard Deadman <[EMAIL PROTECTED]>
Organization: Deadman Consulting
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: jBoss <[EMAIL PROTECTED]>
Subject: Re: [jBoss-User] Complex Primary key for CMP entity bean
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Reply-To:  jBoss  <[EMAIL PROTECTED]>
Sender: <[EMAIL PROTECTED]>
Precedence: Bulk
List-Software: LetterRip Pro 3.0.7 by Fog City Software, Inc.
List-Subscribe: <mailto:[EMAIL PROTECTED]>
List-Digest: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
X-RCPT-TO: <[EMAIL PROTECTED]>
X-UIDL: 82
Status: U





--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to