Problem in ejbCreate (stateful session bean)

B

biebel

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)
 
A

Aidan

biebel said:
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
 
T

TT \(Tom Tempelaere\)

Aidan said:
biebel said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top