How to deploy Custom PK class with WebLogic Bean Deployer

Discussions

EJB programming & troubleshooting: How to deploy Custom PK class with WebLogic Bean Deployer



  1. Hi, all

    I am writing an entity bean(CMP) which has a custom defined
    primary key class. Up until now, I don't think to have any luck with this with either J2EE app server or WebLogic app server. The reason I think this has something to do with my custom primary key class is that I have another similar CMP entity bean which doesn't have a custom primary key class and it works fine. Though the problems I got from these two are different.

    I started with J2EE app server. I was able to deploy my bean as documented:
    1. Provide the custom class name in the deployer as the primary key class name.
    2. And leave the primary key field empty in the deployment tool.
    However, when I run my client that use this bean, I got an error when calling one of my finder method, The error looks like this:

    javax.ejb.FinderException: ERROR in database SELECT for find: java.lang.StringIn
    dexOutOfBoundsException: String index out of range: 77
            <
    Since I got no luck with J2EE app server, I moved onto Weblogic. However, I couldn't even go any further because I just don't seem to able to specify my custom primary key class with the WebLogic Deployer at all.

    I am sure I am missing something here. But can anybody gives me some hints.

    Following is my code snippet:
    In my home interface, the problematic finder method is:

        public Collection findByUserID(String strUserID)
            throws FinderException, RemoteException;
  2. is your bean ejb1.1 compliant? use weblogic's compliance check in deploytool to help u find out

  3. Yes, it is.
  4. For WLS5.1 using the deployer tool. Enter your
    fully qualified PK class under persistence->Primary Key
    Type. Don't fill in the Primary Key Field - it should
    remain none. If you don't have at least Service pack
    2 AND you enter a value in the Primary Key Field your
    hosed. It seems to want to remember that fact and
    your'll just need to fix the XML yourself or start over.

    The PK class already defined the field. If you use
    java.lang.Sring as a PK then you do need to enter
    a field as you probably already know.