Forum: JRuby jruby on rails deployment problem tomcat/ibm db2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Finegan, Richard [HDS - WC] (Guest)
on 2008-12-31 05:24
(Received via mailing list)
hello, this is sort of a plea for help and/or to see if anyone else is
having the same problem...i am trying to deploy a jruby on rails app, i
have a working configuration (my staging/development environment) using:



jruby 1.1.6

tomcat 6.0.16

rails 2.2.2

activerecord-jdbc-adapter 0.9

ibm db2 8.2.8 on aix64





i am using warbler 0.9.12 to package everything up...for my production
environment the only difference is the database server is



ibm db2 9.5.1 on red hat linux



...the app blows up when communicating with the database...all the stack
traces look like this:





Dec 30, 2008 10:10:29 PM org.apache.catalina.core.ApplicationContext log

SEVERE: Exception caught

java.lang.NullPointerException

        at com.ibm.db2.jcc.c.s.q(s.java:722)

        at com.ibm.db2.jcc.c.wf.c(wf.java:2901)

        at com.ibm.db2.jcc.c.wf.b(wf.java:2883)

        at com.ibm.db2.jcc.c.p.b(p.java:2586)

        at com.ibm.db2.jcc.b.b.b(b.java:3173)

        at com.ibm.db2.jcc.c.p.d(p.java:2653)

        at com.ibm.db2.jcc.c.j.o(j.java:353)

        at com.ibm.db2.jcc.b.a.o(a.java:994)

        at
com.ibm.db2.jcc.c.DisconnectException.<init>(DisconnectException.java:53
)

        at com.ibm.db2.jcc.b.db.l(db.java:927)

        at com.ibm.db2.jcc.b.db.c(db.java:366)

        at com.ibm.db2.jcc.b.db.r(db.java:979)

        at com.ibm.db2.jcc.b.eb.O(eb.java:430)

        at com.ibm.db2.jcc.b.gb.a(gb.java:590)

        at com.ibm.db2.jcc.b.gb.l(gb.java:542)

        at com.ibm.db2.jcc.b.gb.k(gb.java:330)

        at com.ibm.db2.jcc.b.gb.e(gb.java:96)

        at com.ibm.db2.jcc.b.w.e(w.java:83)

        at com.ibm.db2.jcc.b.vb.i(vb.java:164)

        at com.ibm.db2.jcc.c.fg.q(fg.java:1311)

        at com.ibm.db2.jcc.c.gg.d(gg.java:2386)

        at com.ibm.db2.jcc.c.hg.V(hg.java:146)

        at com.ibm.db2.jcc.c.t.a(t.java:7384)

        at com.ibm.db2.jcc.c.t.be(t.java:7167)

        at com.ibm.db2.jcc.c.t.getTypeInfo(t.java:7106)

        at
jdbc_adapter.JdbcAdapterInternalService.set_native_database_types(JdbcAd
apterInternalService.java:373)

        at
jdbc_adapter.JdbcAdapterInternalService$s_method_0_0$RUBYINVOKER$set_nat
ive_database_types.call(jdbc_adapter/JdbcAdapterInternalService$s_method
_0_0$RUBYINVOKER$set_native_database_types.gen)

        at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.
java:260)

        at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:75)

        at org.jruby.ast.VCallNode.interpret(VCallNode.java:82)

        at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)

        at org.jruby.ast.BlockNode.interpret(BlockNode.java:68)

...

<rest of giant stack omitted>





to further complicate matters, i've had success embedding jruby as a
scripting engine in this environment (including calls to activerecord,
but not regular-stack rails) using:



jruby 1.1.4

activerecord-jdbc-adapter 0.8.2

activerecord 2.1.2



so naturally as a shot in the dark i tried reverting to
activerecord-jdbc-adapter 0.8.2 with no luck...



does anyone out there have any ideas?  thanks for any help at all!



Richard F.
Nick S. (Guest)
on 2008-12-31 06:56
(Received via mailing list)
On Tue, Dec 30, 2008 at 9:23 PM, Finegan, Richard [HDS - WC]
<removed_email_address@domain.invalid> wrote:
>
>
> activerecord 2.1.2
>
> does anyone out there have any ideas?  thanks for any help at all!

My first guess would be something related to Rails/ActiveRecord 2.2.
From the stack trace above, it looks like you're losing a connection
to the database (or failing to connect at all?) when the adapter tries
to load the type metadata. Not sure what about 2.2 would make that
different, but the connection pooling logic is in 2.2, so that's a
fairly big, new piece.

Are you connecting via JNDI, or a normal connection?

As a next step for debugging, see if you can write a script that just
uses AR (and ar-jdbc) by itself, outside of Rails and Tomcat. If you
can reproduce, try poking around in ar-jdbc with some puts statements
to see if you can isolate the problem any further.

Good luck!

/Nick

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

    http://xircles.codehaus.org/manage_email
Finegan, Richard [HDS - WC] (Guest)
on 2008-12-31 20:57
(Received via mailing list)
thanks for the ideas nick...i'll see what i can find out

and to answer your question, i'm connecting via jndi

Richard F.
Finegan, Richard [HDS - WC] (Guest)
on 2008-12-31 23:20
(Received via mailing list)
it turns out there are 2 jdbc drivers from ibm:

db2jcc.jar - JDBC 3.0 and earlier functions
db2jcc4.jar - JDBC 4.0 and later, as well as JDBC 3.0 and earlier
functions

got the info from here:

http://publib.boulder.ibm.com/infocenter/db2luw/v9...
m.ibm.db2.luw.apdv.java.doc/doc/t0010264.html

changing to db2jcc4.jar did the trick!

Richard F.
This topic is locked and can not be replied to.