Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sqlite java.lang. UnsatisfiedLinkError

 
tarun modi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using sqlite database for my small web aplication.
my application works fine, but after a small interval i got the following error as below:
Please help me regarding this.. Thanks.

May 15, 2008 6:38:40 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
java.lang.UnsatisfiedLinkError: Native Library C:\jakarta-tomcat-5.5.9-preconfigured\jakarta-tomcat-5.5.9\temp\sqlitejdbc.dll already loaded in another classloader
java.sql.SQLException: no SQLite library found
at org.sqlite.Conn.<init>(Conn.java:74)
at org.sqlite.JDBC.connect(JDBC.java:53)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.aumni.common.Connect.getConnection(Connect.java:18)
at com.aumni.models.KeywordModel.getKeywords(KeywordModel.java:27)
at com.aumni.servlets.Keywords.doGet(Keywords.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
May 15, 2008 6:39:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet keywords threw exception
java.lang.NullPointerException
at com.aumni.models.KeywordModel.getKeywords(KeywordModel.java:28)
at com.aumni.servlets.Keywords.doGet(Keywords.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
May 15, 2008 6:44:52 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
 
Jaffer Sadiq
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please have a glance of youur session management...
Thanks,
Jaffer
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's extremely unlikely that sessions have anything to do with an issue about library loading.
 
K Aditi
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.UnsatisfiedLinkError: Native Library C:\jakarta-tomcat-5.5.9-preconfigured\jakarta-tomcat-5.5.9\temp\sqlitejdbc.dll already loaded in another classloader

Though I am not aware of sqlite but looks like it uses JNI.
This exception happens because Tomcat uses separate classloaders for each web application. So when you have multiple instances of your webb-app getting loaded you will encounter this problem.I am sure this problem goes away when you restart Tomcat and run your web-app for the first time.
I think if you somehow manage to load the native code only once through Tomcat's ClassLoader instead of your web-app's ClassLoader it might solve your problem. You can give the following method a try,
Place all the jars required for sqlite in tomcat\common\lib and/or place the code where you use the native APIs in tomcat\common\lib folder if it's a jar or tomcat\common\classes if it's in .class format (i.e. unpacked).
 
tarun modi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have sorted my problem by using different jar for sqlite driver. Previously i was using sqlite driver that uses JNI, but now i found another driver using 100% java, which is based on nestedVM and that solves my problem.
Thanks K Aditi, as i haven't tried your method but i am founding useful for what you have said. I try that way too...
Thanks buddy for all your replies
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic