Hi,
I need to call a third-party .so from a message driven bean. The .so that 
belongs to the java "header" file is just some sort of wrapper for the actual 
library. 

The bean, the .so's and the java header declaring the native methods are all in 
the same JAR / EAR. I do only need to call the .so from classes within this EAR.

I have changed $JBOSS_HOME/bin/run.sh so that LD_LIBRARY_PATH as well as 
-Djava.library.path point to the directory JBoss extracts the .so's to.
I also commented out the "System.load" call in the java header.

The JBoss server is running on a 64 bit SUSE Linux. The JVM, JBoss and the 
native libraries are 64 bit versions.

When deploying I can see in the server output (linux console) that the native 
libraries are beeing loaded:
00:38:50,358 INFO  [EARDeployer] Init J2EE application: 
file:/usr/lib64/jboss-4.0.4.GA/server/default/deploy/Calculator.ear
  | 00:38:50,427 INFO  [EJBDeployer] Loading native library: 
/usr/lib64/jboss-4.0.4.GA/server/default/tmp/native/libren6.so
  | 00:38:50,439 INFO  [EJBDeployer] Loading native library: 
/usr/lib64/jboss-4.0.4.GA/server/default/tmp/native/librendjv6.so
  | 00:38:50,901 INFO  [EjbModule] Deploying Calculator
  | 00:38:51,034 INFO  [EJBDeployer] Deployed: 
file:/usr/lib64/jboss-4.0.4.GA/server/default/tmp/deploy/tmp62593Calculator.ear-contents/Calculator.jar
  | 00:38:51,080 INFO  [EARDeployer] Started J2EE application: 
file:/usr/lib64/jboss-4.0.4.GA/server/default/deploy/Calculator.ear

As you can see, both the JAR and the libraries are loaded by the same deployer 
(and therefore by the same classloader ?).

Now, if I send a message to the MDB using the native library, I get the 
following output in the console / logfile ("WpKurs2" is the name of the called 
method):
00:40:57,424 ERROR [CalculatorBean] java.lang.UnsatisfiedLinkError: WpKurs2
  |         at de.mmkf.rendjv6.WpKurs2(Native Method)
  |         at 
eu.valueprice.calculator.tasks.FixedBondTask.calculate(FixedBondTask.java:64)
  |         at 
eu.valueprice.calculator.ejb.CalculatorBean.onMessage(CalculatorBean.java:223)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:585)
  |         at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
  |         at 
org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
  |         at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
  |         at 
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
  |         at 
org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
  |         at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
  |         at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
  |         at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
  |         at 
org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
  |         at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
  |         at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
  |         at 
org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
  |         at org.jboss.ejb.Container.invoke(Container.java:954)
  |         at 
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:987)
  |         at 
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1287)
  |         at 
org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:266)
  |         at 
org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:902)
  |         at 
org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
  |         at org.jboss.mq.SpySession.run(SpySession.java:323)
  |         at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
  |         at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
  |         at java.lang.Thread.run(Thread.java:595)

How can I load the libraries so that the calls work ?

Thanks in advance !

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989122#3989122

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989122
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to