File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes problem on hfejsb page 57 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "problem on hfejsb page 57" Watch "problem on hfejsb page 57" New topic
Author

problem on hfejsb page 57

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
when i try to compile AdviceClient.java, ising the javac command on page 57 i get this error -



i tried adding c:\projects\advice\classes to the CLASSPATH, but this did not solve the problem.

whats worng ?
i believe this is a core java problem, but whats wrong


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i also tired adding this to the CLASSPATH -

c:\projects\advice\AdviceAppClient.jar

and then compiling as

c:\projects\advice>javac AdviceClient.java, but still i get the same error

so i tried the unconvetional way

toop all the .java to c:\j2sdk_dir\bin
compiled there
got the AdviceClient.class
and pasted it in c:\projects\advice

and tird this

c:\projects\advice>java AdviceClient
but got this error -
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient

guys, please help me !
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i got this server log on the console, when i deployed the bean

Deploy the application in C:\projects\advice\AdviceApp.ear on the server localho
st saving the client jar as C:\projects\advice\AdviceAppClient.jar
Sender object Deploy Tool : Deploy AdviceApp on localhost
Remote message: Contacted Server....
Remote message: Application AdviceApp transferred.
Remote message: AdviceApp has 1 ejbs, 0 web components to deploy.
Remote message: Deploying Ejbs....
Remote message: Processing beans ....
Remote message: Compiling wrapper code ....
Remote message: Compiling RMI-IIOP code ....
Remote message: Making server JARs ....
Remote message: Making client JARs ....
Remote message: Deployment of AdviceApp is complete..
Sender object Deploy Tool : client code at http://10.168.110.71:9191/AdviceAppCl
ient.jar
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i tried restarting the server, got this on the command prompt, and got this trace -

C:\j2sdkee1.3.1\bin>j2ee -verbose
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
DB;create=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
te=true
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
eDB;create=true
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB
;create=true
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
te=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.co
re.RemoteXaDataSource@82751
Starting JMS service...
Initialization complete - waiting for client requests
Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties
>
Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties
>
Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Starting web service at port: 8000
Starting secure web service at port: 7000
J2EE SDK/1.3.1
Starting web service at port: 9191
J2EE SDK/1.3.1
Loading jar:/C:/j2sdkee1.3.1/repository/hpp6062/applications/AdviceApp1171297764
441Server.jar
J2EE server startup complete.

recompiled the AdviceClient.jar but got same 6 errors as above.

tried to re run,
but again got a Exception in main( ) error

guys please help me
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
what command did you use to get server side class files?
[ February 12, 2007: Message edited by: Rajan Murugan ]

With Regards,<br /> Rajan<br />"Java Rocks"
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i got the code from wickedlysmart.com
unziped the file to get two folders - advice, customer
copied the advice folder to c: ad
c:\projects\advice
made sure that all the folder strucutre is as per the book

actually i never needed to compile anything as the downloaded code has
.class files also

but i have probles as mentioned in posts above

please help

i am stuck here !

thanks in advance !
Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

I remember getting this error too.

I modified the command, like this :

javac -classpath c:\j2sdkee1.3.1\lib\j2ee.jar;AdviceAppClient.jar AdviceClient.java

with AdviceAppClient.jar in the same path of course.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
i ahve already added the j2ee.jar to the classpath
do i need to add AdviceAppClient.jar in the classpath ?

if yes, does this mean, every .jar related to my bean development needs to be added like this


please help me out guys
why am i seeing myself beg in this bcd forum ?
the wcd forum was so hot and happening

please help
Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

i added it in the command line.
Forget the CLASSPATH environment variable, it's buggy in that case as you can see.
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
javac -classpath c:\j2sdkee1.3.1\lib\j2ee.jar;AdviceAppClient.jar AdviceClient.java

this is compiling fine now.

but the

java -cp AdviceAppClient.jar AdviceClient sint working
even if i append the class path in it
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
guys
still the same issues -

1. cant compile AdviceClient.java
2. cant run it ( though i do have the pre compiled class file with me )
from wickedly smart

in 1 in get cannot resolve symbol for Advice and AdviceHome
in 2 i get NoClassDefFound error

he he ... this is what i feel -
Rahul Toaikani
Ranch Hand

Joined: Feb 14, 2007
Posts: 36
Hi Niranjan,

NOt sure if you got past the problem you have specified.If not, see if following can help.(I am able to compile fine without any problem).

1.If you are getting NoClassDefError it generally means it is able to find the jar file but the other jar files that it depends on are not found.

2.In the HFEJB book the syntax for the classpath was for unix environment.For windows use ";" instead of ":" and %classpath% instead of "$CLASSPATH".

3.Try adding -verbose and see if it gives any useful information

(
I have a seperate issue though , I get an error when running the client (java -cp.... ).Compiles fine.I have posted here.
http://www.coderanch.com/t/162655/java-EJB-SCBCD/certification/HELP-HFEJB-AdviceClient-Error-javax
)

-Rahul

[ February 17, 2007: Message edited by: Rahul Toaikani ]
[ February 17, 2007: Message edited by: Rahul Toaikani ]
 
 
subject: problem on hfejsb page 57