Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EJBC ClassNotFound

0 views
Skip to first unread message

Mahendra Dhamdhere

unread,
Nov 20, 2001, 9:10:26 PM11/20/01
to
Hi,
I am using WLS 6.0sp1.
I have an entity bean that is accessing a stateful session bean.
To deploy that entity bean, I have to add home and remote interfaces of that
session bean in my entity bean jar.
First I created std_entity.jar that contains all these classes (entity bean
clasess + home and remote interfaces of session bean).
Then I passed that std_entity.jar to ejbc. In my ejbc classpath, I added
necessary classes that I need compile std_entity.jar.
When I ran ejbc, I got ClassNotFound exception for that Session bean remote
and home interfaces, which are present in same std_entity.jar.
How this is possible?
Ejbc cannot find classes that are present in the same jar ?
In std_entity.jar, I can see home and remote interface .class files with
correct package structure.

Am I missing something here ?
Thank you,
Mahendra


Rob Woollen

unread,
Nov 20, 2001, 11:31:40 PM11/20/01
to
Mahendra Dhamdhere wrote:

> Hi,
> I am using WLS 6.0sp1.
> I have an entity bean that is accessing a stateful session bean.

Does the entity bean call the stateful session bean? That's an odd and probably
incorrect design. Can you tell us some more about what you are trying to do?

>
> To deploy that entity bean, I have to add home and remote interfaces of that
> session bean in my entity bean jar.
> First I created std_entity.jar that contains all these classes (entity bean
> clasess + home and remote interfaces of session bean).
> Then I passed that std_entity.jar to ejbc. In my ejbc classpath, I added
> necessary classes that I need compile std_entity.jar.

I would suggest that you package the entity and session bean together in a
single jar. It will save you a lot of headaches.

If you're still having problems, you'll need to show us the contents of your jar
file, and your classpath setting for ejbc.

-- Rob

Mahendra Dhamdhere

unread,
Nov 21, 2001, 12:21:59 PM11/21/01
to

"Rob Woollen" <rob@trebor_nelloow.moc> wrote in message
news:3BFB2E2B.B061D87D@trebor_nelloow.moc...

> Mahendra Dhamdhere wrote:
>
> > Hi,
> > I am using WLS 6.0sp1.
> > I have an entity bean that is accessing a stateful session bean.
>
> Does the entity bean call the stateful session bean? That's an odd and
probably
> incorrect design. Can you tell us some more about what you are trying to
do?
I have home methods on my entity bean that instantiate Session Bean.
In one of my home method, I am call ejbFindAllCustomers (). I pass the
result of that method to a Session bean.
So in a way, I am not calling SFSB from entity bean business methods. I am
calling it from home method which I guess is not a bad design.

>
> >
> > To deploy that entity bean, I have to add home and remote interfaces of
that
> > session bean in my entity bean jar.
> > First I created std_entity.jar that contains all these classes (entity
bean
> > clasess + home and remote interfaces of session bean).
> > Then I passed that std_entity.jar to ejbc. In my ejbc classpath, I added
> > necessary classes that I need compile std_entity.jar.
>
> I would suggest that you package the entity and session bean together in a
> single jar. It will save you a lot of headaches.

I can't do that as this SFSB is generic. It's a part of core framework.

Rob Woollen

unread,
Nov 21, 2001, 1:17:43 PM11/21/01
to
It's still a little strange. It sounds like the stateful session bean just
caches query results. Why not just a java object for this? Stateful session
beans cannot be accessed concurrently among other problems with them.

You'll have to show me your classpath, the jar file contents, and the exception
if you want help with the ejbc problem.

-- Rob

Mahendra Dhamdhere

unread,
Nov 21, 2001, 2:53:30 PM11/21/01
to
Thank you Rob for your help.

Unfortunately I can't send all the code and jars as that is not my client's
policy. But here is my command to create ejb jar.

SET WL_HOME=c:\bea\wlserver6.0sp1
SET CODEBASE=c:\entitymanager\trial

set PATH=%PATH%;c:\bea\jdk130\bin
java -classpath
%WL_HOME%\lib\weblogic_sp.jar;%WL_HOME%\lib\weblogic.jar;%CODEBASE%\codejars
\dmtestapp_local.jar;%CODEBASE%\codejars\datamap_core.jar;%CODEBASE%\codejar
s\datamap_util.jar;%CODEBASE%\jars;%CODEBASE%\codejars
weblogic.ejbc -compiler javac build\std_ejb_Customer.jar
deployedejb\ejb_Customer.jar

If I run above command, It's giving me this exception

Exception in thread "main" java.lang.NoClassDefFoundError:
com/datamap/ejb/Entit
yCollection
at java.lang.Class.getMethods0(Native Method)
at java.lang.Class.getMethods(Class.java:742)
at
weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.initializeMethodInfo
s(ClientDrivenBeanInfoImpl.java:513)
at
weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenB
eanInfoImpl.java:148)
at
weblogic.ejb20.deployer.EntityBeanInfoImpl.<init>(EntityBeanInfoImpl.
java:79)
at
weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.
java:210)
at
weblogic.ejb20.deployer.DeploymentInfoImpl.initializeBeanInfos(Deploy
mentInfoImpl.java:157)
at
weblogic.ejb20.deployer.DeploymentInfoImpl.<init>(DeploymentInfoImpl.
java:86)
at weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:106)
at weblogic.ejbc20.runBody(ejbc20.java:346)
at weblogic.utils.compiler.Tool.run(Tool.java:81)
at weblogic.ejbc.main(ejbc.java:20)

The class com/datamap/ejb/EntityCollection.class is present in
ejb_std_Customer.jar.


If I include ejb_std_Customer.jar in my classpath (which I suppose I don't
have to), I don't get any error and I can create ejb jar.
Do I need to include std.jar in my classpath ?

Thank you,
Mahendra

"Rob Woollen" <rob@trebor_nelloow.moc> wrote in message

news:3BFBEFC7.280E346F@trebor_nelloow.moc...

Mahendra Dhamdhere

unread,
Nov 21, 2001, 3:12:40 PM11/21/01
to
Pl. ignore my earlier post.
I need to clarify few more items before writing.

"Mahendra Dhamdhere" <nos...@hotmail.com> wrote in message
news:3bfc065b$1...@newsgroups.bea.com...

Mahendra Dhamdhere

unread,
Nov 21, 2001, 3:23:55 PM11/21/01
to
Yes. My earlier post was correct.
I confirmed.
If I put my std_ejb_Customer.jar in ejbc classpath, I can create ejb jar.
This is weird.

Mahendra

"Mahendra Dhamdhere" <nos...@hotmail.com> wrote in message

news:3bfc0ada$1...@newsgroups.bea.com...

Mahendra Dhamdhere

unread,
Nov 23, 2001, 12:22:15 PM11/23/01
to
Thank you.
But if classloader doesn't find that referenced class, then it should not
throw the ClassNotFound exception for EntityCollection. It should throw
exception for that other referenced class. Am I correct ?

Mahendra

"Rob Woollen" <rob@trebor_nelloow.moc> wrote in message

news:3BFC8AA4.F1703FE4@trebor_nelloow.moc...
> This makes more sense. A NoClassDefFoundError indicates that the
classloader
> was able to find a class but not resolve all of its dependent classes.
The
> usual cause is when something is loaded in a parent classloader but
depends on a
> class only found in a child classloader.
>
> I suspect that you have a class in the $CLASSPATH that references the
> EntityCollection (directly or indirectly), and the EntityCollection is
only
> found in the jar file.

Rob Woollen

unread,
Nov 23, 2001, 1:21:07 PM11/23/01
to
It's throwing NoClassDefFoundError which is different than a
ClassNotFoundException.

A ClassNotFoundException is thrown when a class loader and its parent class
loaders could not find/load the requested class. i.e if you ask a class loader
for a class that does not exist, you will get a cnfe.

A NoClassDefFoundError occurs when the requested class was found, but a class on
which it depends could not be resolved. That's the case that you are running
into.

0 new messages