aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes HFEJB - compiling advice guy 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 "HFEJB - compiling advice guy" Watch "HFEJB - compiling advice guy" New topic
Author

HFEJB - compiling advice guy

Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Everyone.

I just started HFEJB and I'm all the way to page 30. That's where, after having j2ee1.3 installed, you're supposed to compile the Advice Guy application. But when I compile, I get a bunch of errors, all of which complaining that it can't resolve symbols -- package names and interface names and such. It's as though I have something wrong with my PATH. I have my SETs and PATH set up like this ...

SET J2EE_HOME=c:\j2sdkee1.3
SET JAVA_HOME=c:\Program Files\Java\jdk1.5.0_07
PATH C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;
c:\j2sdkee1.3\bin;c:\Program Files\Java\jdk1.5.0_07\bin

... (without the CR in the PATH line). I double checked and these are the correct directory names. And a c:>SET reveals that the environmental variables are being set correctly. Same with c:>PATH.

I know it's not a typo in the source code because I downloaded the source code from wickedlysmart.com.

I know this will turn out to be some simple needle-in-a-haystack thing, but I can't for the life of me see what I'm doing wrong. Does anything obvious jump out?

-Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi Brad,

you have to set some environment variables. Look beneath how it's done (I hope the screenshots speak for themselfs):





The last step is critical, you have to update your PATH environment variable just as shown above.

Because of the last step you can now start j2ee -verbose from whereever you are, you don't have to start it from your %J2EE_HOME%\bin directory. Just make sure that you open a new command shell after you updated all your environment variables to get access to all these new/updated environment variables.

You are ready now for a round trip: compilation - server start - client start
Compile:


Start Server:


Start Client:


That's it ,
Good Luck,
Darya


SCJP, SCJD, SCWCD, SCBCD
Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Darya.

Thanks for your response to my message.

I'm sad to report that did not do the trick. But you did open my eyes to the fact that I've been setting my environmental variables and path locally (with a .bat file) as opposed to globally. I'm setting them globally now the way you described. Path too. But alas it's still not working, the little dickens.

I'm trying the simple baby step that appears on HFEJB p30

%cd ~/projects/advice/src
%javac -d ../classes headfirst/*.java

... substituting Windows syntax, of course. And this is where it's complaining that it can't resolve package names and interface names etc. BTW, I am running Window XP Home Edition but I'm assuming that would not be a factor since j2se works just fine.

Here is how my environmental variables and path are set ...

c:>SET
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Brad\Application Data
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=NOTEBOOK
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Brad
J2SE_HOME=c:\Program Files\Java\jdk1.5.0_07
JAVA_HOME=c:\Program Files\Java\jdk1.5.0_07
JSEE_HOME=c:\j2sdkee1.3
LOGONSERVER=\\NOTEBOOK
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;c:\j2sdkee1.3\bin;c:\Program Files\Java\jdk1.5.0_07\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0d08
ProgramFiles=C:\Program Files
PROMPT=$N$G
SESSIONNAME=Console
SonicCentral=C:\Program Files\Common Files\Sonic Shared\Sonic Central\
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\Brad\LOCALS~1\Temp
TMP=C:\DOCUME~1\Brad\LOCALS~1\Temp
USERDOMAIN=NOTEBOOK
USERNAME=Brad
USERPROFILE=C:\Documents and Settings\Brad
windir=C:\WINDOWS

C:>PATH
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;c:\j2sdkee1.3\bin;c:\Program Files\Java\jdk1.5.0_07\bin

This is making me nuts.

Anyway, thanks again for your last reply.

-Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Can you post your command lines you use for compilation, server and client?
Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Darya.

These are my commands for compiling the HFEJB Advice Guy bean (see p30).

C>cd c:\BackupBundle\EJBWorld\Stuff01\projects\advice\src
C>javac -d ../classes headfirst/*.java

... and then the diagnostics appear from the AdviceBean.java source file about the unresolved symbols.

The book hasn't reach the point of launching the server yet, but when I try to do that as instructed on p31... it goes like this ...

C>cd c:\BackupBundle\EJBWorld\Stuff01\projects\advice
C>j2ee -verbose
'C:\Program' is not recognized as an internal or external command operable program or batch file.

So launching the server fails also.

My environmental variables are set as they were in my last post, except that a did correct one typo ...

JSEE_HOME=c:\j2sdkee1.3

is now

J2EE_HOME=C:\j2sdkee1.3

Although that was an error, it seems not to be the issue here as my failure to compile and launch the server remains the same.

Thanks again for your time, Darya.

-Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Originally posted by Brad Strausbaugh:
C>cd c:\BackupBundle\EJBWorld\Stuff01\projects\advice\src
C>javac -d ../classes headfirst/*.java


Hi Brad,

I miss the classpath in your call. Look the example I gave you (the yellow one )

Regards,
Darya
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Take care of spaces (between classes and headfirst) in your path. Put those paths in double quotes or use an underscore.
[ February 27, 2007: Message edited by: Darya Akbari ]
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Originally posted by Brad Strausbaugh:
My environmental variables are set as they were in my last post, except that a did correct one typo ...

JSEE_HOME=c:\j2sdkee1.3

is now

J2EE_HOME=C:\j2sdkee1.3

Although that was an error, it seems not to be the issue here as my failure to compile and launch the server remains the same.


That didn't matter because you never used it in your command line as classpath . Look how I used them in the given examples (the yellow and green ones).
Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Darya.

Thanks for your last reply.

I added %J2EE_JARS% to my environmental variables, then followed your "yellow" example and that did the trick for compiling. I was able to compile the source files into ~/advice/classes/headfirst/Advice*.class. I should have read your first message more carefully.

But I'm still having trouble launching the server. When I go to your "blue" example, instead of the server launching, it goes something like this ...

C>cd
C:\BackupBundle\EJBWorld\Stuff01\projects\advice

C>j2ee -verbose
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Somewhere it's associating "j2ee" with "C:\Program" but I don't know where it would be finding that association. It does not appear in my environmental variables. Here are my environmental variables and path. I've add quotation marks to my Path string.

C>SET
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Brad\Application Data
CLASSESDIR=C:\j2sdkee1.3\lib\classes
CLIENTNAME=Console
CLOUDJARS=C:\j2sdkee1.3\lib\system\cloudscape.jar;C:\j2sdkee1.3\lib\system\tools.jar;C:\j2sdkee1.3\lib\cloudscape\RmiJdbc.jar;C:\j2sdkee1.3\lib\cloudscape\cloudclient.jar
CLOUDSCAPE_INSTALL=C:\j2sdkee1.3\lib\cloudscape
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=NOTEBOOK
ComSpec=C:\WINDOWS\system32\cmd.exe
CPATH=C:\j2sdkee1.3\lib\system\cloudscape.jar;C:\j2sdkee1.3\lib\system\tools.jar;C:\j2sdkee1.3\lib\cloudscape\RmiJdbc.jar;C:\j2sdkee1.3\lib\cloudscape\cloudclient.jar;C:\j2sdkee1.3\lib\classes;C:\j2sdkee1.3\classes;C:\j2sdkee1.3\lib\j2ee.jar;C:\j2sdkee1.3\lib\locale;;C:\Program Files\Java\jdk1.5.0_07\lib\tools.jar;C:\j2sdkee1.3\lib\jhall.jar
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Brad
J2EEJARS=C:\j2sdkee1.3\lib\j2ee.jar
J2EE_HOME=C:\j2sdkee1.3
J2EE_JARS=C:\j2sdkee1.3\lib\j2ee.jar
J2SE_HOME=C:\Program Files\Java\jdk1.5.0_07
JAAS_OPTIONS=-Djava.security.auth.policy=C:\j2sdkee1.3\lib\security\jaas.policy
JAVACMD=C:\Program Files\Java\jdk1.5.0_07\bin\java -Xmx128m -Djavax.net.ssl.trustStore=C:\j2sdkee1.3\lib\security\cacerts.jks -Djava.security.auth.policy=C:\j2sdkee1.3\lib\security\jaas.policy
JAVAHELPJARS=C:\j2sdkee1.3\lib\jhall.jar
JAVATOOLS=C:\Program Files\Java\jdk1.5.0_07\lib\tools.jar
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_07
JMS_CLASSESDIR=C:\j2sdkee1.3\classes
JMS_DB_PATH=C:\j2sdkee1.3\repository\NOTEBOOK\db\
JMS_HOME=C:\j2sdkee1.3
JMS_RI_JDBC=C:\j2sdkee1.3\lib\system\cloudscape.jar;C:\j2sdkee1.3\lib\system\tools.jar
LIBDIR=C:\j2sdkee1.3\lib
LISTEN_OPTIONS=-Dcom.sun.CORBA.connection.ORBListenSocket=SSL:0,SSL_MUTUALAUTH:0,PERSISTENT_SSL:1060
LOCALEDIR=C:\j2sdkee1.3\lib\locale
LOGONSERVER=\\NOTEBOOK
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;c:\j2sdkee1.3\bin;"c:\Program Files\Java\jdk1.5.0_07\bin"
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0d08
ProgramFiles=C:\Program Files
PROMPT=$N$G
SESSIONNAME=Console
SonicCentral=C:\Program Files\Common Files\Sonic Shared\Sonic Central\
SSL_OPTIONS=-Djavax.net.ssl.trustStore=C:\j2sdkee1.3\lib\security\cacerts.jks
SystemDrive=C:
SystemRoot=C:\WINDOWS
SYSTEM_LIB_DIR=C:\j2sdkee1.3\lib\system
TEMP=C:\DOCUME~1\Brad\LOCALS~1\Temp
TMP=C:\DOCUME~1\Brad\LOCALS~1\Temp
USERDOMAIN=NOTEBOOK
USERNAME=Brad
USERPROFILE=C:\Documents and Settings\Brad
windir=C:\WINDOWS

C>PATH
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;c:\j2sdkee1.3\bin;"c:\Program Files\Java\jdk1.5.0_07\bin"

I'm getting so close, Darya.

-Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Originally posted by Brad Strausbaugh:
I'm getting so close, Darya.
-Brad


Can you check your folder and look for the j2ee batch file?

Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Darya.

Yes, I have the j2ee batch file in the bin folder you pointed to. BTW, the j2ee install package created a C:\j2ee1.3.1 directory and that's where the \bin and other folders are. Mine is not the "...\J2EE\1.3.1..." like in your screenshot. I also perused the j2ee.bat file (didn't change a thing) and it looks like it should run okay unless I missed something.

Separately, I found that by changing my J2SE_HOME and JAVA_HOME environmental variables from C:\Program Files\... to C:\PROGRA~1\... , I can then at invoke the server, but not without a new cavalcade of errors. Here is a cut-and-past from my DOS shell session...


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Brad>c:\setj2ee02

C:\Documents and Settings\Brad>PROMPT $N$G

C>CD c:\BackupBundle\EJBWorld\Stuff01\projects\advice
C>j2ee -verbose
J2EE server listen port: 1050
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/inte
rnal/util/IdentityHashtable
at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.<clinit>(Util.java:87)

at com.sun.corba.ee.internal.POA.POAImpl.activate(POAImpl.java:935)
at com.sun.corba.ee.internal.POA.POAImpl.activate_object(POAImpl.java:89
5)
at com.sun.corba.ee.internal.CosNaming.TransientNameService.initialize(T
ransientNameService.java:117)
at com.sun.corba.ee.internal.CosNaming.TransientNameService.<init>(Trans
ientNameService.java:70)
at com.sun.enterprise.iiop.POAProtocolMgr.initializeNaming(POAProtocolMgr.java:103)
at com.sun.enterprise.server.J2EEServer.run(J2EEServer.java:226)
at com.sun.enterprise.server.J2EEServer.main(J2EEServer.java:972)
C>

I'm kinda running out of straws to grasp.

-Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Try it with JDK 1.4.2
Rahul Toaikani
Ranch Hand

Joined: Feb 14, 2007
Posts: 36
See if this thread helps.

http://www.coderanch.com/t/162554/java-EJB-SCBCD/certification/help&p=
Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
Hello, Rahul and Darya.

Got it!!!

The problem was that my installed J2SE was version 1.5. and appearantly this has some kind of bug that makes J2EE hicup. Sun, bless their hearts, sees no reason to trouble programmers with this information. So the remedy was to download and install j2ee v1.4, adjust environmental variables, etc, and badda-bing, everything works. Life can be beautiful.

So thanks to you both. Darya, you open my eyes to the environmental variable stuff, and Rahul, that thread you turned me on to is where I learned about the J2SE1.5 issue. So I own each of you a beer... or three.

Happiness and Joy, -Brad
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Originally posted by Brad Strausbaugh:
So the remedy was to download and install j2ee v1.4, ... So I own each of you a beer... or three.


Hi Brad,

I'm glad that it worked out. Did you really meant j2ee v1.4 or was it maybe j2se v1.4 .



Regards,
Darya
Brad Strausbaugh
Greenhorn

Joined: Feb 25, 2007
Posts: 21
I meant j2se 1.4, Darya. Thanks again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HFEJB - compiling advice guy