RE: Classpath Conundrum (2nd try)

2003-07-18 Thread Thomas Davis
For the sake of argument, I moved all the classes from /native into
/WEB-INF/classes and I moved all the classes from /foreign into
/WEB-INF/lib.  Also, for the sake of being extra careful, I packaged up
everthing in /WEB-INF/lib into classes.jar (so there's two copies
there, the raw directory tree and the JAR file).

Then I restarted Tomcat and loaded the servlet.  The servlet itself
(from the /classes tree) attempted to load, but it broke because one of
its dependencies (from the /lib tree) was missing.  

According to the Application Developer's Guide to which you referred
me...

When you install an application into Tomcat (or any other
2.2/2.3-compatible server), the classes in the WEB-INF/classes/
directory, as well as all classes in JAR files found in the
WEB-INF/lib/ directory, are made visible to other classes within your
particular web application. ... no adjustment to the system class path
(or installation of global library files in your server) will be
necessary.

So I expected the contents of /WEB-INF/lib, either the raw files or the
packaged JAR, to be automatically loaded.  Was I mistaken?  Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classpath Conundrum (2nd try)

2003-07-17 Thread Thomas Davis
[I apologize is this message is a dupe.  I had trouble sending messages
to this group from a hotmail account.]

I have been tasked with trying to get a legacy Java Servlet based
application running under Tomcat 4.1.24 -- The application currently
runs on JRun 2.3.3

On of the requirements imposed upon me is that I can't disturb the
existing directory structure.  I can't rename or move any directories
(or their contents).

Our third-party Java classes are in:

c:\myapp\foreign

Our application and development Java classes are in:

c:\myapp\native

The root directory of the web server is:

c:\myapp\native\web

I created the following Context in server.xml:

Context path=/tomcat docBase=c:/myapp/native/web debug=0/

Then I created the servlet deployment file:

c:\myapp\native\web\WEB-INF\web.xml

The contents of said file:

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app

servlet
servlet-namemyapp/servlet-name
servlet-classcom.myapp.servlet.BootStrap/servlet-class
/servlet

servlet-mapping
servlet-namemyapp/servlet-name 
url-pattern/myapp/url-pattern 
/servlet-mapping

/web-app

So now I'm all set to go, except that I'm going to (and did) get a
class not found error because there is no /classes directory under
WEB-INF and as mentioned above I can't copy the classes from
/foreign and /native there.  

I can't create a symbolic link from /classes to /native since that
would be recursive, and it wouldn't include /foreign which is also
required.

The /native and /foreign directories are in the CLASSPATH
environment variable, but as documented in Class Loader HOW-TO that
variable is ignored by the class loaders.

It would seem to me that the easiest and most straight-forward solution
is to get the class loaders to honor the CLASSPATH environment
variable.  I tried to accomplish this by hacking the start-up scripts,
but could not get it to work.

Could somebody please help me out here?  What's the best way to get the
class loader to look in /native and /foreign?  Or is there a better
solution (other than shuffling the directories around, which I can't
do).  Thanks a million!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Classpath Conundrum (2nd try)

2003-07-17 Thread Thomas Davis

--- Norris Shelton [EMAIL PROTECTED] wrote:
 
 To start our Tomcat's on W2K, we modify setclasspath.bat to
 include %CLASSPATH% when it constructs it's classpath.

I tried that but could not get it to work.  I'm apparently putting it
in the wrong place.  Could you please detail the change(s) you made to
the batch file(s)?  Thanks.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Classpath Conundrum (2nd try)

2003-07-17 Thread Thomas Davis

--- Norris Shelton [EMAIL PROTECTED] wrote:
 Remember, these changes were for W2K PRO, should work on other
 environments but YMMV.
 
 setclasspath.bat
 set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
  I added %CLASSPATH% after the = sign

Thanks for the tip.  I tried that (which was the same as my original
attempt, but I tried again just for kicks) and it didn't work.  Further
investigation revealed that the shortcut to start Tomcat doesn't call
catalina.bat at all!  Instead, it calls this:

C:\j2sdk1.4.2\bin\java.exe -jar -Duser.dir=C:\Program Files\Apache
Group\Tomcat 4.1 C:\Program Files\Apache Group\Tomcat
4.1\bin\bootstrap.jar start

So I tried hacking the shortcut in the following ways:

C:\j2sdk1.4.2\bin\java.exe -classpath %CLASSPATH% -jar
-Duser.dir=C:\Program Files\Apache Group\Tomcat 4.1 C:\Program
Files\Apache Group\Tomcat 4.1\bin\bootstrap.jar start

C:\j2sdk1.4.2\bin\java.exe -classpath
c:\myapp\native;c:\myapp\foreign -jar -Duser.dir=C:\Program
Files\Apache Group\Tomcat 4.1 C:\Program Files\Apache Group\Tomcat
4.1\bin\bootstrap.jar start

But neither worked.  After restarting the server, I'm still presented
with the expected error:

javax.servlet.ServletException: Wrapper cannot find servlet class 
com.myapp.servlet.BootStrap or a class it depends on

Somehow there must be a way to get the class loader to look in the
/foreign and /native directories :-(


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Classpath Conundrum (2nd try)

2003-07-17 Thread Thomas Davis

--- Shapira, Yoav [EMAIL PROTECTED] wrote:
 
 Searching the list archives reveals that every now and then someone
 comes along with your situation 

Could you please refer me to one of those threads?  I checked the
archives before posting here and was unable to find any discussions
that resolved this issue.

 2. They do manage to make a hack work, 

Do you happen to recall what that hack is?  Much appreciated.  

Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Classpath Conundrum (2nd try)

2003-07-17 Thread Thomas Davis

--- Cox, Charlie [EMAIL PROTECTED] wrote:
 can't you just set up an ant script to (also)copy the files to the
 tomcat directory each time they are updated?

Unfortunately, I cannot.  I must, if possible, get it working with the
existing directory structure.  I realize this is not an optimal
configuration, but I have no say in the matter.  Thank you all for your
suggestions.  I'll keep my fingers crossed that somebody reveals a
clever solution to me soon :-)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]