wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Help! (Basic Stuff) Headfirst EJB, Chapter 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Help! (Basic Stuff) Headfirst EJB, Chapter 1" Watch "Help! (Basic Stuff) Headfirst EJB, Chapter 1" New topic
Author

Help! (Basic Stuff) Headfirst EJB, Chapter 1

Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
I'm having a heck of a time getting the very first "AdviceBean" project up and running. I have everything written and ready to go, but from page 30 onwards I can't accomplish a single task. I realize that I am quite possibly not-the-brightest-guy, so I come seeking help:
Firstly, I do not understand the:
javac -d ../classes headfirst/*.java
command. I can only call javac from C:\j2sdk1.4.2_03\bin directory, and I'm just not "getting" what I'm supposed to be doing here. I'm not super-fluent on command line stuff, as I've been compiling and running all my programs from NetBeans and Textpad for the most part. So, again I make a cry for help.
Secondly, I cannot run the following command (page 31) either:
j2ee -verbose
I get the following error message:
'j2ee' is not recognized as an internal or external command, operable program, or batch file.
I have my Sun One Application server up and running. I can do that much, though I'm not so sure I should even be doing that as it hasn't been mentioned to do so.
I want to weep! This stuff looks like a lot of fun, and I can't even get started! I've been monkeying around for a couple hours now, with no visual result...and so I plead with you to set me upon the path to EJB goodness!
(I have no doubt that I'll feel like a total wiener once this has been explained to me.)
Did I mention I need help?


SCJP 1.4
Murat Balkan
Ranch Hand

Joined: Sep 10, 2002
Posts: 127
Hi,
In order to get javac.exe you have to put it in the PATH environment variable. And for your second question, you have to be in the same folder with j2ee.jar file and you have to use J2EE 1.3. -verbose works fine when you work with RI.
Hope this helps
Murat
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
Thanks, I just added the location(s) to PATH. I can get: j2ee -verbose to work now (whooo!), and I can get javac to actually compile by typing the exact commands from page 30 into the book (I'm making progress!), but I'm getting compiler errors from seemingly anything to do with EJB.
For example:
cannot resolve symbol
symbol: class EJBObject
package javax.ejb does not exist

...and so on. Any ideas? Im sure I'm missing something simple, but it's not the code. I know that much.
Thanks for your help so far!
[ March 11, 2004: Message edited by: Adam Altmann ]
Sri Ram
Ranch Hand

Joined: Sep 08, 2002
Posts: 48
Looks like your CLASSPATH is not having j2ee.jar. I run on a Windows 2000 PC and I had given C:\j2sdkee1.3.1\lib\j2ee.jar in my CLASSPATH and it works fine for me.
Vanniarajan
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
I have added that exact line to my PATH variable and it's still not working. Other ideas?
Thanks.
Rama Krishna Yalamanchili
Greenhorn

Joined: Feb 11, 2004
Posts: 25
Servus Adam,
j2ee.jar must be added to your CLASSPATH not your PATH...
If you dont have a classpath defined you must define an environment variable to windows.
Something like this
CLASSPATH = D:\j2sdkee1.3.1\lib\j2ee.jar;D:\j2sdkee1.3.1\lib;.;D:\jdk1.3.1_02\lib
Hope it helps.
Cheers
YRK


You are not fed, if you dont ask. <img src="wink.gif" border="0"> <p>SCJP 1.4, i2CP, IBM s390 CP
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
I believe I've figured it out. Thanks Murat. I was adding the j2ee.jar to PATH and had no CLASSPATH variable. I just created one and it seems to have worked.
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
Ack! This is SO disappointing, I've got new problems...
I've gotten my Bean compiled fine, and have gone through the deploytool just fine. "Deployment of AdviceApp is complete." Now all I need is the client.
I've written it, it's flawless code-wise, and in the directory it's supposed to be in, but when I try to compile with the following:
javac -classpath {$CLASSPATH}:AdviceAppClient.jar AdviceClient.java

I get six fabulous compiler errors:
package headfirst does not exist
package javax.ejb does not exist
cannot resolve symbol
symbol: class AdviceHome
location: class AdviceClient
..and so on.
So I can't figure out why I can compile everything just peachy from c:\projects\advice\src, but not compile from c:\projects\advice.
I'm sure I'm missing something simple, just as I was earlier. This is getting to be pretty discouraging. Again, thanks for the continued help. I really appreciate it!
(I'm running XP Pro, if that helps any.)
[ March 11, 2004: Message edited by: Adam Altmann ]
Rajnish Bhasin
Greenhorn

Joined: Mar 01, 2004
Posts: 29
Tyr it by giving the following:
javac -classpath AdviceAppClient.jar;c:\j2ee.jar;c:\beans AdviceClient.java
1)Where c:\j2ee.jar should be the exact classpath to j2ee.jar
2)c:\beans is the exact path to the folder from where u ran the javac -d . *.java command for the bean compilation(non inclusive of the package folder.
This will run for sure....
I know it doesent sound too good becoz u already added these things to yr classpath before.
But this will work out for u...
lemme know if it doesent.


Best Regards,<br />Rajnish Bhasin.<br />SCJP<br />SCWCD<br />SCBCD
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
When I use that command, I get:
error: cannot read: AdviceClient.java
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
I am seriously going crazy here. I moved elements around in my PATH list, and it seems to compile now, if I use this command:
javac -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient.java
An AdviceClient.class shows up in the directory, so I assume it's working. However, when I go to run it, I get:
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient
Words cannot express how happy this makes me. I appreciate the help, I really do. Any ideas what I need to do now? I would hope I'm getting closer.
Adam Altmann
Greenhorn

Joined: Nov 15, 2003
Posts: 21
Heh, I'm sure you people are growing tired of me by now, but here's a new problem! (I know you're as excited as I am)
I believe I actually got it to run by using the command:
java -cp %CLASSPATH%;AdviceAppClient.jar;. AdviceClient
Only now when it runs (if it is indeed running, though I believe it is), I get this madness spit back at me:

java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is:
org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemExceptio
n(ShutdownUtilDelegate.java:137)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.go(AdviceClient.java:21)
at AdviceClient.main(AdviceClient.java:10)
Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed:
No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(ReplyMessage_1_2.java:93)
at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(
ClientResponseImpl.java:108)
at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
entSC.java:132)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
... 2 more
Rajnish Bhasin
Greenhorn

Joined: Mar 01, 2004
Posts: 29
U will find a solution to that here:
http://www.coderanch.com/t/158262/java-EJB-SCBCD/certification/CORBA-bad-operation-error-RI
Although the same did not happen with me...
But i guess it is becoz of the method getAdvice() and u havr to change the name to something else e.g getSurname() what ever....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help! (Basic Stuff) Headfirst EJB, Chapter 1
 
Similar Threads
HF EJB compile error
Simple .focus() Solution for a form
Advice Client problem
Need Help With Compiling Head First Java Code Examples
Is Eclipse really this hard? And how did it get so popular?