• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help! (Basic Stuff) Headfirst EJB, Chapter 1

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have added that exact line to my PATH variable and it's still not working. Other ideas?
Thanks.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I use that command, I get:
error: cannot read: AdviceClient.java
 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U will find a solution to that here:
https://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....
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic