wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes ejbc error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ejbc error" Watch "ejbc error" New topic
Author

ejbc error

aslesha choudhari
Greenhorn

Joined: Apr 24, 2001
Posts: 10
hi all,
can any body help me..
i have trying to deploy the ejb since yesterday..
but bad luck..
i an able to create the deployment des,i compiled all the source files.i set the environment variable.
but when i try ejbc command it says
"unable to load class (the bean class) from u r ejb-jar.xml file."
error:ejbc error found.
can anybody tell me where i am wrong??
thanks & regards,
aslesha
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Unable to load a class means WL can't find the class. Either it is spelled incorrectly in the ejb-jar.xml or is not in you classpath.
aslesha choudhari
Greenhorn

Joined: Apr 24, 2001
Posts: 10
i checked the spelling.nothing is wrong.
but it doesn't create the output .jar file when i try ejbc command in the "ebjcgen" folder.
Is there any thing other than above that should be looked into??
thanks & regards
aslesha
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
And you verified that the class is in your classpath?
aslesha choudhari
Greenhorn

Joined: Apr 24, 2001
Posts: 10
when u say class is in u r classpath ,it means it is under correct directory/subdirectory..where all other related classes have been saved??
i am really very sorry to ask the basic question..but how do i verify that the related class is in the classpath..
at this time i think my brain has stopped working..
regards
aslesha
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
ClassPath is the path, which the compiler will look for the classes. That means after putting your compiled classes in the correct directory, u have to set the classpath in u'r OS, such a way that the directory in which u have put u'r classes, should be included.
To include the classpath in u'r system, if it is Windows, go to environment settings and create a property classpath(if it is not there) and include the directory.

[This message has been edited by Saran Vel (edited April 26, 2001).]


Saran
Sun Certified Java2 Programmer
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Dear aslesha,
Never be sorry to ask questions. I do it all the time
I seems like the ejb compiler cannot see the class specified in you ejb-jar.xml. This class is specified within the < ejb-class > tag. I have one that looks like:

On my machine the .class file is located in:
C:\xpresstrade\classes\com\xpresstrade\server\ejb\user
The class is in a package named com.xpresstrade.server.ejb.user
So my classpath must include c:\xpresstrade\classes for a Java program to see it, the ejb compiler is a Java program.
One can verify the classpath (Win32) by typing echo %classpath% in the command prompt.
I hope this helps. If you can't successfully run the ejb compiler, it would help if you posted:
The relevant section of you ejb-jar.xml
Your classpath right before you run the ejb compiler
The package your bean class is in
I do believe you only have a simple problem. I'm sure your brain is working fine, at least you're smart enough to hang out in a saloon
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
Maybe you try using a deployment tool which does all the annoying things either automatically or by just letting you
fill in some parameters AND such a tool comes with documentation.
I have no difficulties up to now with the 'deploytool' from Sun, to be downloaded from there : the J2EE package.
aslesha choudhari
Greenhorn

Joined: Apr 24, 2001
Posts: 10
hi michael,
thanks for u r reply..
i could understand properly what exactly is happening..
but still i am getting the ejbc error...
i will tell u in detail..the steps & directory structure i have got..may be then i think u can tell me what is the exact problem.
currently i am using weblogic6.0
i tried 2 examples that comes along with weblogic6.0..
now i have written my own "helloworld" bean & related classes.
i am not using any deplyoment tool.
the weblogic server example comes with build.cmd file & ejb-jar.xml file.
i copied those file & changed it according to my requirements.
i have created all my java source files in c:/bea/wlserver6.0/samples/examples/ejb/basic/myexample1 directory.
the build.cmd file is also in the same direcotory.
the bean related classes r in the package "examples.ejb.basic.myexamples.helloworld"
To deplyo the bean first i set the environment.
then i run the build .cmd file which compiles all the java classes create the .jar file.
all the compiled classes r kept in build folder under myexample1 directory.
i think the above explanation is enoug to figure out the problem.
as u told i checked the spelling of the classes,set the classpath which is "c:/bea/wlserver6.0/samples"
thanks & regards
aslesha
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
I think we're getting closer...
If I read this correctly, you have your compiled classes in c:/bea/wlserver6.0/samples/examples/ejb/basic/myexample1/build, yet these classes are in a package named examples.ejb.basic.myexamples.helloworld. This is a problem.
Try this:
- Rename your package to reflect your directory structure, i.e. examples.ejb.basic.myexample1
- Make sure the compiled classes are in the myexample1 directory.
Your classpath looks good.
Run the ejb compiler.
I hope this makes sense. You see, if your classpath is set to c:/bea/wlserver6.0/samples, and you have classes in a package named examples.ejb.basic.myexample1, then these compiled classes need to be in c:/bea/wlserver6.0/samples/examples/ejb/basic/myexample1 for java to find them.
Give it a try.
aslesha choudhari
Greenhorn

Joined: Apr 24, 2001
Posts: 10
hi michael,
i am able to deploy the ejb successfully..
thanks & regards,
Aslesha
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Dear aslesha,
Congrats
Amit Dabri
Greenhorn

Joined: Apr 26, 2003
Posts: 1
hi,
i have a problemm deploying a ejb.
when i use weblogic.ejbc to create a .jar file.i get a warning saying
"Network(ejbname) has a class com.scenario.network.NetworkProvider(remote interface) which is in classpath.This class shud only be located in ejb-jar.xml)
the same warning is issued for bean class as well as home interface class.n a message saying
ejbc successful.
when i deploy it a error is thrown on console saying "unable to load class specified in your ejb-jar.xml file "
also i have a ejb-jar.xml file which includes
"<home>com.scenario.network.NetworkProviderHome</home>" where the classpath is d:\classes and
the class files are kept in
d:\classes\com\scenario\network\
Please help me out.I hope i am not doin n e silly mistake here .
Thanks & Regards,
Amit Dabri
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ejbc error