classpath, JRuby, and Tomcat

View: New views
3 Messages — Rating Filter:   Alert me  

classpath, JRuby, and Tomcat

by John Woodward-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a JRuby 1.1RC2 application, with Rails 2.0.2, almost ready to deploy. I've built a war file with warbler. Configuration of warbler is very vanilla, as is my dev installation of tomcat.

The problem that I"m having is that the application relies on a set of jar files; all the required jar files are in lib (and so I've confirmed that they are packaged properly in WEB-INF/lib). Unfortunately, they don't appear to be being added to the classpath of the running webapp. An inspection of the property java.class.path shows only a few tomcat related jar files in the classpath; the library I'm using also fails miserably when it searches for resources amongst it's jar files.

In a standalone mode, with test code, everything works fine as long as I set CLASSPATH to contain all the relevant jar files. Without setting the classpath (despite any require or load statements I may have), the app fails miserably; the failure is the same as when running under tomcat.

Is there something I'm missing? Should the jars show up in the property java.class.path?

Thanks!

john

Re: classpath, JRuby, and Tomcat

by John Woodward-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You ever have one of those days .... well, I guess we all have.

My problem wasn't that my jars weren't being found --- it was that one config file had to be specified as lib/<file> instead of just <file> like my test code.

Sorry to have bothered everyone!

john



On Tue, Mar 4, 2008 at 4:13 PM, John Woodward <doctor.jw@...> wrote:
I have a JRuby 1.1RC2 application, with Rails 2.0.2, almost ready to deploy. I've built a war file with warbler. Configuration of warbler is very vanilla, as is my dev installation of tomcat.

The problem that I"m having is that the application relies on a set of jar files; all the required jar files are in lib (and so I've confirmed that they are packaged properly in WEB-INF/lib). Unfortunately, they don't appear to be being added to the classpath of the running webapp. An inspection of the property java.class.path shows only a few tomcat related jar files in the classpath; the library I'm using also fails miserably when it searches for resources amongst it's jar files.

In a standalone mode, with test code, everything works fine as long as I set CLASSPATH to contain all the relevant jar files. Without setting the classpath (despite any require or load statements I may have), the app fails miserably; the failure is the same as when running under tomcat.

Is there something I'm missing? Should the jars show up in the property java.class.path?

Thanks!

john


Re: classpath, JRuby, and Tomcat

by Lenny Marks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tomcat has its own set of class loaders so java.class.path doesn't  
really apply fully.

http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

If you are trying to load classes/resources in WEB-INF/lib via one of  
the classloaders other than the WebApp class loader(e.g from a class  
in a jar not in WEB-INF/lib), I think you will have problems.

-lenny

On Mar 4, 2008, at 5:13 PM, John Woodward wrote:

> I have a JRuby 1.1RC2 application, with Rails 2.0.2, almost ready  
> to deploy. I've built a war file with warbler. Configuration of  
> warbler is very vanilla, as is my dev installation of tomcat.
>
> The problem that I"m having is that the application relies on a set  
> of jar files; all the required jar files are in lib (and so I've  
> confirmed that they are packaged properly in WEB-INF/lib).  
> Unfortunately, they don't appear to be being added to the classpath  
> of the running webapp. An inspection of the property  
> java.class.path shows only a few tomcat related jar files in the  
> classpath; the library I'm using also fails miserably when it  
> searches for resources amongst it's jar files.
>
> In a standalone mode, with test code, everything works fine as long  
> as I set CLASSPATH to contain all the relevant jar files. Without  
> setting the classpath (despite any require or load statements I may  
> have), the app fails miserably; the failure is the same as when  
> running under tomcat.
>
> Is there something I'm missing? Should the jars show up in the  
> property java.class.path?
>
> Thanks!
>
> john


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email