• Post Reply Bookmark Topic Watch Topic
  • New Topic

classpath Catch-22  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my first post so please bear with me.

I'm following along with Head First EJB and having some difficulty getting j2ee, javac, and deploytool to play nice with each other.

Per the book's instruction, I am using j2sdkee1.3.1 and jdk1.3.1_02. I already had been using j2sdk1.4.2_05, but am trying to toe the line.

After downloading and installing j2sdkee1.3.1, I made my paths be as such:

J2EE_HOME C:\j2sdkee1.3.1
JAVA_HOME C:\jdk1.3.1_02
Path C:\j2sdkee1.3.1\bin; C:\jdk1.3.1_02\bin

I skipped ahead a little, tested j2ee -verbose, and got the desired outcome (J2EE server startup complete)

First problem: trying to compile *.java brought errors - Compiler couldn't find javax.ejb. Much searching brought a solution - add j2ee.jar to C:\jdk1.3.1_02\jre\lib\ext. javac'd again - SUCCESS. But it was only temporary....

I started over with the book, compiled the files, restarted j2ee -verbose... and was met with an ugly stream of "No local string for..."'s

More searching led me to a solution - REMOVE j2ee.jar from C:\jdk1.3.1_02\jre\lib\ext. (sound of hand slapping forehead).

I did, and of course j2ee worked, but I once again could not compile.

So at this point I continued with the book example using the classes I had earlier compiled, shelving the javac problem for a bit.

This led me to deploytool. Without j2ee in C:\jdk1.3.1_02\jre\lib\ext, deploytool doesn't even load at all (unable to create ui). WITH j2ee in there, the GUI appears, but behind it in the console you get a neverending stream of "No local string for..."'s and a complaint that Help could not be found.

Following thru the book example nonetheless, I made it all the way to Deploy. At this point, I got the error: java.lang.NoClassDefFoundError: javax/ejb/EJBMetaData.

Further investigation of the javac issue led me to a temporary solution:
javac -extdirs \j2sdkee1.3.1\lib\ -d ..\classes hf\*.java. This allowed me to remove j2ee.jar to make j2ee happy and still make the compiler happy.

However, deploytool is still unhappy.


Methinks the problem lies somewhere in the classpaths, but no amount of searching has come up with a working solution.

Please help.


jim
 
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
Welcome to JavaRanch!

I think the problem is where you are placing j2ee.jar. Try putting it in a directory other than C:\jdk1.3.1_02\jre\lib\ext. For example, try c:\j2ee.jar for now. Then put the new path in the classpath.

J2ee and deploy tool might by getting stuck because j2ee.jar is under the jre folder.
 
jim bonafede
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your assistance.

If anyone else has this problem, this is how I was eventually able to get everything (j2ee, deploytool, javac) to work correctly:

J2EE_HOME C:\j2sdkee1.3.1
JAVA_HOME C:\jdk1.3.1_02
Path C:\j2sdkee1.3.1\bin; C:\jdk1.3.1_02\bin

And this is the key:

Make sure the following files are in C:\j2sdkee1.3.1\lib:
j2ee.jar
j2ee-ri-svc.jar
j2eetools.jar
jaws.jar
jhall.jar
ejb10deployment.jar

One caveat:
when you compile your java files, you have to include -extdirs CLASSPATH

for example:
javac -extdirs C:\j2sdkee1.3.1\lib -d ..\classes headfirst\*.java

(this is again primarily from Head First EJB p.30)

If anyone knows a better way to compile without using -extdirs please let me know.


Thanks,
jim
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!