Require java class seems to fail when dploying as .war

Dir[“lib/extensions/*.jar”].each do |jar|
puts jar
val = require jar
puts val.to_s
end

require ‘lib/classes.jar’

require ‘exceptions’

class ApplicationController < ActionController::Base
include Java
include Exceptions
#include_class ‘MIPS’
java_import ‘MyClass’

  1. When I don’t use a .war file but deploy from an Eclipse Tomcat
    server, I get:

INFO: Server startup in 9572 ms
lib/extensions/aia.jar

lib/extensions/base.jar

lib/extensions/esboegen.jar

lib/extensions/o4glrt.jar

lib/extensions/o4glrth.jar

As you can see, no “false” or “true” is printed.
But, everything works.

  1. When I deploy as .war file under Tomcat,

I get “true” for each of these requires printed as well.
And I get the error that “MyClass” could not be linked because of a
missing dependency (it seems as if the requires didn’t work and the
classes are not loaded as ruby extensions).

Does anybody know what’s going on? Is the wrong ‘require’ used when
deployed as .war file or something?


Maarten


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I think I know what’s going on here. Your working directory when
running under tomcat is not what you assume it is. You need to set
the lib paths relative to the context root. I think you can find this
set as a java property.

-Justin

On Wed, Mar 3, 2010 at 4:11 AM, Maarten M.
[email protected] wrote:

class ApplicationController < ActionController::Base


Maarten


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Mar 3, 2010 at 7:31 AM, Justin C. [email protected]
wrote:

I think I know what’s going on here. Â Your working directory when
running under tomcat is not what you assume it is. Â You need to set
the lib paths relative to the context root. Â I think you can find this
set as a java property.

Another option would be putting the jar files in the normal WAR file
location (WEB-INF/lib) so they’ll be picked up by Tomcat
automatically. In that case, you would not do the jar requires.

I’m not sure of the current recommendation for how to have both
command-line and WAR-file deploys work the same without a lot of
fiddling with jar requires and classpath, though.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

It worked by configuring them explictly in warble.rb.

There were several subdirectories in (WEB-INF/)lib that contained the
.jar’s.
These subdirectories were also copied into the .war file, so I thought
I did not have to explictly add them in the warble.rb config file.
I was wrong, you need to add jars of all subdirectories there too.

Thank you,

On Wed, Mar 3, 2010 at 2:48 PM, Charles Oliver N.
[email protected] wrote:

I’m not sure of the current recommendation for how to have both


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs