Jayesh,
Welcome to the club, man.
Technically speaking, you are not allowed to use native
libraries in EJB.
Wanna reason?
OK. Each bean works in its own thread. Pretend that
one instance of your bean is created and loads native
library. Then another instance is created and what?
Yep, trying to load the library again. But it's
already loaded, and unfortunately in another thread.
Dead end?
Actually, the right place to load native libraries is
your custom MBean (JMX service). Then your beans will
look up that service and use it.
However, there is a dirty solution if you don't want JMX.
Create a class which only loads a native library and
put it in the main jboss classpath (into lib/ext for instance)
Then call this class from your beans. The library will be
loaded only once in the main jboss thread and you are in business.
But again, I would not recommend that. Sorry.
> "Parayali, Jayesh 1065" wrote:
>
> I deployed a message driven bean which is listening on a queue. I sent
> some messages to the queue. MDB was working fine.
>
> Then I recompiled the MDB and copied the jar to deploy directory. Auto
> deploy was successful.
> Then I sent some more message to the queue. Now I see the message shown
> below.
>
> Note : I am using a native dll. I don't know how the classloader stuff
> works.
>
> It's not a big deal. I can afford to stop and start jboss again. Please
> let me know if someone knows how it works.
>
> Thanks,
> Jayesh
>
> [GeoCoderBean] [ID4-0] onMessage(TextMessage@11)
> [GeoCoderBean] TRANSACTION ROLLBACK EXCEPTION:Native Library
> C:\WINNT\system32\geostnj.dll already loaded in another classloader;
> nested exception is: java.lang.UnsatisfiedLinkError: Native Library
> C:\WINNT\system32\geostnj.dll already loaded in another classloader
>
> [GeoCoderBean] java.lang.UnsatisfiedLinkError: Native Library
> C:\WINNT\system32\geostnj.dll already loaded in another classloader
>
> [GeoCoderBean] at
> java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1346)
> [GeoCoderBean] at
> java.lang.ClassLoader.loadLibrary(ClassLoader.java:1306)
> [GeoCoderBean] at java.lang.Runtime.loadLibrary0(Runtime.java:749)
> [GeoCoderBean] at java.lang.System.loadLibrary(System.java:820)
> [GeoCoderBean] at GeoCode.<clinit>(GeoCode.java:16)
> [GeoCoderBean] at GeoCoderBean.<clinit>(GeoCoderBean.java:9)
> [GeoCoderBean] at java.lang.Class.newInstance0(Native Method)
> [GeoCoderBean] at java.lang.Class.newInstance(Class.java:237)
> [GeoCoderBean] at
> org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:106)
>
> [GeoCoderBean] at
> org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke
--
__________________________________________________
Alexander Kogan PTC www.ptc.com
[EMAIL PROTECTED] 140 Kendrick St. Needham MA 02494
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user