Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem in ejbCreate (stateful session bean)

Reply
Thread Tools

Problem in ejbCreate (stateful session bean)

 
 
biebel
Guest
Posts: n/a
 
      02-26-2004
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/yUserProfileV
at yToolsBeans.yComboDataBean.ejbCreate(yComboDataBea n.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)


 
Reply With Quote
 
 
 
 
Aidan
Guest
Posts: n/a
 
      02-27-2004
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/yUserProfileV
> at
> yToolsBeans.yComboDataBean.ejbCreate(yComboDataBea n.java:25)


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

A
 
Reply With Quote
 
 
 
 
TT \(Tom Tempelaere\)
Guest
Posts: n/a
 
      02-27-2004
"Aidan" <(E-Mail Removed)> wrote in message
news:c1msun$88o$06$(E-Mail Removed)-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/yUserProfileV
> > at
> > yToolsBeans.yComboDataBean.ejbCreate(yComboDataBea n.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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
What Happens After Exception in ejbCreate() for MDB? johnhurt@gmail.com Java 0 04-13-2006 12:37 AM
modify the ejbCreate of a CMP Bean using XDoclet denis Java 0 05-24-2004 03:24 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM



Advertisments