Problem in ejbCreate (stateful session bean)

Discussion in 'Java' started by biebel, Feb 26, 2004.

  1. biebel

    biebel Guest

    Hi,

    We have a big problem with the creation of an object in the ejbCreate method
    of our bean (yComboDataBean). We construct an object that makes a database
    connection (yServerCtx). This object is then used in methods of the bean as
    a way to access the database.

    Constructing the bean fails, because creating the server context object
    fails. The error we get is the following (our JBoss server tells us:)
    ERROR [LogInterceptor] Unexpected Error:
    java.lang.NoSuchMethodError:
    yTools.Server.yServerCtx.<init>(LyTools/yUserProfile;)V
    at yToolsBeans.yComboDataBean.ejbCreate(yComboDataBean.java:25)

    There are no problems with deployment, only execution. The code is as
    follows:

    // The bean (simplified)
    // ...
    public class yComboDataBean implements SessionBean
    { SessionContext sessionContext;
    yServerCtx serverCtx;

    public void ejbCreate(yUserProfile userProfile) throws CreateException
    { try {
    serverCtx = new yServerCtx( userProfile );
    }
    catch(Exception e)
    { /*...*/ }
    }
    // ...
    }

    // The server context class (simplified)
    package yTools.server;
    public class yServerCtx
    { private yUserProfile userProfile;
    public DatabaseOps dbOps = new DatabaseOps();

    public yServerCtx(yUserProfile userProfile) throws Exception
    { this.userProfile = userProfile; }
    }

    The yUserProfile class is a simple data class.

    We are absolutely baffled. The code compiles and deploys without problems,
    but execution tells us "NoSuchMethodError"??? The bean is stateful,
    bean-managed session bean. The environment is JBoss 3.2.1 / JBuilder 9 /
    Windows2k.

    Does anyone have a clue as to what is going wrong here?

    Tom & Bart.
    Upsilon SA (Luxembourg)
     
    biebel, Feb 26, 2004
    #1
    1. Advertising

  2. biebel

    Aidan Guest

    biebel wrote:
    > Constructing the bean fails, because creating the server context
    > object fails. The error we get is the following (our JBoss server
    > tells us:)
    > ERROR [LogInterceptor] Unexpected Error:
    > java.lang.NoSuchMethodError:
    > yTools.Server.yServerCtx.<init>(LyTools/yUserProfile;)V
    > at
    > yToolsBeans.yComboDataBean.ejbCreate(yComboDataBean.java:25)


    Old version of the yServerCtx class on the CP somewhere? Deployment
    not picking up the correct class file??

    A
     
    Aidan, Feb 27, 2004
    #2
    1. Advertising

  3. "Aidan" <> wrote in message
    news:c1msun$88o$06$-online.com...
    > biebel wrote:
    > > Constructing the bean fails, because creating the server context
    > > object fails. The error we get is the following (our JBoss server
    > > tells us:)
    > > ERROR [LogInterceptor] Unexpected Error:
    > > java.lang.NoSuchMethodError:
    > > yTools.Server.yServerCtx.<init>(LyTools/yUserProfile;)V
    > > at
    > > yToolsBeans.yComboDataBean.ejbCreate(yComboDataBean.java:25)

    >
    > Old version of the yServerCtx class on the CP somewhere? Deployment
    > not picking up the correct class file??
    >
    > A


    One small question, what is CP?

    About the deployment. I also thought about that, but our
    JBuilder9/JBoss3.2.1 config does a lot automatically. At least I don't know
    enough about Java beans to check a version problem (I just right-click a
    bean to deploy - automagically ;-).

    Maybe I can describe what we do. We make a session bean that has one create
    function, and this create function takes the user profile of the caller as
    parameter (the yUserProfile). In the create function we establish a
    db-connection through construction of a yServerCtx object. The session bean
    keeps a reference to that server-context object, so that ejb methods can use
    the connection. I made the bean stateful because the bean has a member; is
    this correct? Should I make it stateful when I only keep a db-connection and
    some user profile objects as members of the bean?

    When we write the bean, we just import some package with implementation
    classes (regular java) in the bean implementation. When we build the bean, I
    notice that the java classes are somehow included in the bean; I think it
    ships the bean as a jar with the java implementation classes. I checked the
    stubs and they seem ok (correct interface).

    Maybe something goes wrong during deployment. But I don't know what could go
    wrong (not enough experience) and what options influence this deployment
    process. All I do is press '(re-)deploy' in the context menu. Before
    deploying I rebuild the bean of course.

    Anyway, we can't figure it out.

    Thank you.
    ---
    Cheers,
    Tom Tempelaere
     
    TT \(Tom Tempelaere\), Feb 27, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. denis
    Replies:
    0
    Views:
    354
    denis
    May 24, 2004
  2. Replies:
    0
    Views:
    1,043
  3. Replies:
    1
    Views:
    792
  4. Rob Dennis
    Replies:
    1
    Views:
    819
    JThangiah
    Apr 14, 2008
  5. Giovanni Azua
    Replies:
    0
    Views:
    684
    Giovanni Azua
    May 3, 2009
Loading...

Share This Page