Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC8C2D2F4 for ; Thu, 9 Aug 2012 22:22:44 +0000 (UTC) Received: (qmail 77795 invoked by uid 500); 9 Aug 2012 22:22:41 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 77741 invoked by uid 500); 9 Aug 2012 22:22:41 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 77730 invoked by uid 99); 9 Aug 2012 22:22:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 22:22:41 +0000 X-ASF-Spam-Status: No, hits=1.0 required=5.0 tests=FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.139.212.169] (HELO nm10.bullet.mail.bf1.yahoo.com) (98.139.212.169) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 22:22:34 +0000 Received: from [98.139.212.150] by nm10.bullet.mail.bf1.yahoo.com with NNFMP; 09 Aug 2012 22:22:12 -0000 Received: from [98.139.211.192] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 09 Aug 2012 22:22:12 -0000 Received: from [127.0.0.1] by smtp201.mail.bf1.yahoo.com with NNFMP; 09 Aug 2012 22:22:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1344550932; bh=dKksaodXAha3elDD7k9eO2hs7QMgCvMFkvH5JLnF8E8=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=nJX60vUHBlfvT1HlGAT2AevElPVUUMb3PQJ1G1aCPScIRXXqRwOEIN+CmhhJGcg2imtXfyQcwhZ1OjACREZKahZwE347Zp6RSEjqKM5s4A+pzli0E1Ehso7dUA6mOICcmlJ5BZZTXNDFcDYkybX3pFJgpC/BMm+qiNj3ngHwg48= X-Yahoo-Newman-Id: 733500.93095.bm@smtp201.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 73dxrsUVM1kIw3V.x6bWm.ytV5OkSK3Q2p.5LBG5xn6i7Ow 2iXJ8bbLa7KhNAh_9iBrLOF_X6gMLSxN9PiGvuCSDVk4rQd.4I6A1wjJwFXf u38LvzCM7SL7gZshH8_or2xVnIDGOZKniMnuSBJ8zPoVFTOigY4o465eizz5 WgGvWrab8maAm_ARZxvlzP2e4EYqw_2vIHWKxqTN0JhB8tKVU20xMYa1qelY jbo74d6bmtvh1Q26..8Aaf.9WYGBerR4AIlbxI.liqbmOk0_.msjKq9qeGRj sXoxZ9.YLPHoV4xUcIYJrIH4d7vQcwA0.L.pUH.efQuUcTBV3dSTNxpkksIr A_hYUKIZW8VKSLWbHnP41knHwKrSV8fxB6UT1JGA6HL5z1TNBX97SqujqEuV AsE2s1qR.0rLPsjjOee9YAiWRlApnamOnfe1yp4usfWaAoxtg2DrjEe2T.dl 19rKYYCPZIA.WBFktav.4X8Yu302jQZQlywtQwCNta5h9MnsLTeh9P_CBYcw IbZH0N58vt6KvzeLZOqQGHTbSWsmbkUSEugPAu08ID7tIE0RKo8p.IOJFkjH WQcGZxWjlhBt5j9rxtoQIIE2m._tT8G7lBXbTFanlXLMOMk57evZIEy2p3cV 6GS_GFLeAGqifFAez73KByHyNBlgXN9CSvRMTrS2qnrKQQio7SOLb2zg1a1v Ek8..tciFVXvG5KsLqTn4.cvX8R3kR486TIvoG0U6vOumhUbcGwXfq_y3CA7 LzYZrzuVWFpHZQ805kbZgmkJzstPczht5YhhiIGNE4CYLrZVYzVXbBe8rGv8 OtiO.hjCZnahWGl8cqqp9lLmPWSHMCw3IPBKFFaAJ6AD_kLn4n_7E6tSX_zr B5PKinc2C0P9da04_vLA_bNR4cfuso9IJhpDxdPcIr7msPYUiF41wA4Bb9Sc pncfufmU4yVO6y8MaJIgWoRh.eWXM8It7AGw0gBW_7JcWRwvbBjBkW3G7.jz 4DuVLrupznNASTAgl03iKL3ekUUSHVHaqW3WVbm9MbqbWbyCAS2btkNVyAm8 Q0YraNyUusM5IwgU- X-Yahoo-SMTP: PKuT8k2swBCeFOHzkGy5rTOUTa2hBxlR Received: from [127.0.0.1] (its_toasted@71.129.44.8 with plain) by smtp201.mail.bf1.yahoo.com with SMTP; 09 Aug 2012 15:22:12 -0700 PDT Message-ID: <50243806.8060706@yahoo.com> Date: Thu, 09 Aug 2012 15:21:58 -0700 From: Mark Eggers User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: users@tomcat.apache.org Subject: Re: Problem with tomcat 7 and java ld_library_path under centos 6 using IANYWHERE JDBC DRIVER References: <502297E0.2040008@yahoo.com> ,<5023CEDF.6080203@yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 8/9/2012 3:06 PM, Martin Gainty wrote: > > Mark > > did > JAVA_OPTS="-Djava.library.path=directory-with-libdbodbc12.so" > export JAVA_OPTS > work? > > What does Sybase say? > Martin > ______________________________________________ > >> Date: Thu, 9 Aug 2012 07:53:19 -0700 >> From: its_toasted@yahoo.com >> To: users@tomcat.apache.org >> Subject: Re: Problem with tomcat 7 and java ld_library_path under centos 6 using IANYWHERE JDBC DRIVER >> >> Moving this back on the list. >> >> In general it's a good idea to keep the discussion (and the solution) on >> the mailing list. That way everyone benefits (and everyone can help). >> >> Comments are surrounded with ==== COMMENT ==== >> >> On 8/9/2012 4:18 AM, CHRISTOS STAVRINOU wrote: >>> Thank you for your answer that solved the problem. But now I get the >>> error below that >>> >>> [Sybase][ODBC Driver Manager] Unable to load resource file >>> >>> I can't understand what happens and how to fix it. >>> >>> Please help if you have any answer. >>> >>> Thanks a lot. >>> >>> org.apache.jasper.JasperException: javax.servlet.ServletException: >>> java.sql.SQLException: [Sybase][ODBC Driver Manager] Unable to load >>> resource file >>> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:548) >>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456) >>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) >>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>> >>> root cause >>> >>> javax.servlet.ServletException: java.sql.SQLException: [Sybase][ODBC >>> Driver Manager] Unable to load resource file >>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911) >>> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840) >>> org.apache.jsp.sybread_jsp._jspService(sybread_jsp.java:157) >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433) >>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) >>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>> >>> root cause >>> >>> java.sql.SQLException: [Sybase][ODBC Driver Manager] Unable to load >>> resource file >>> ianywhere.ml.jdbcodbc.jdbc3.IDriver.makeODBCConnection(Native Method) >>> ianywhere.ml.jdbcodbc.jdbc3.IDriver.connect(IDriver.java:768) >>> java.sql.DriverManager.getConnection(DriverManager.java:579) >>> java.sql.DriverManager.getConnection(DriverManager.java:221) >>> org.apache.jsp.sybread_jsp._jspService(sybread_jsp.java:95) >>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433) >>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) >>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>> >> >> ==== COMMENT ==== >> >> This looks like you are placing the SQL inside of a JSP page. In >> general, this is not best practice. I am not sure that this list is the >> place to discuss DAO (data access object) architecture, although the >> following blog post by Christopher Schultz is quite instructive: >> >> http://blog.christopherschultz.net/index.php/2009/03/16/properly-handling-pooled-jdbc-connections/ >> >> ==== COMMENT ==== >> >>> On Wed, Aug 8, 2012 at 7:46 PM, Mark Eggers wrote: >>>> On 8/8/2012 6:06 AM, CHRISTOS STAVRINOU wrote: >>>>> >>>>> Problem with tomcat 7 and java ld_library_path under centos 6 using >>>>> IANYWHERE JDBC DRIVER >>>>> >>>>> At what path I must copy the file dbjodbc12.so? What is the correct >>>>> configuration? >>>>> >>>>> How I can configure the java.library.path under under centos 6 and >>>>> tomcat 7 in order to fix the problem? >>>>> >>>>> Please help me. If you have any answers please email me to >>>>> stavrinc@gmail.com >>>>> >>>>> Thanks in advance >>>>> >>>>> The connection string is as follows: >>>>> >>>>> "jdbc:ianywhere:driver=libdbodbc12.so;ENG=host;DBN=database" >> >> ==== COMMENT ==== >> >> According to a discussion on the SQL Anywhere forum, you no longer need >> to put driver and DBN=database (shouldn't that be DSN=database) in the >> connection string. >> >> However, they're using sajdbc4.jar -> sybase.jdbc4.sqlanywhere.IDriver >> and you appear to be using the jdbc3 driver? >> >> Here's the discussion link: >> >> http://sqlanywhere-forum.sybase.com/questions/8551/sybasejdbc4sqlanywhereidriver-problems-java-hangs-when-connecting >> >> ==== COMMENT ==== >> >>>>> But when running the program, I get the following exception (with the >>>>> relevant stack trace) - >>>>> Exception in thread "main" java.lang.UnsatisfiedLinkError: no >>>>> dbjodbc12 in java.library.path >>>>> at >>>>> java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682) >>>>> at java.lang.Runtime.loadLibrary0(Runtime.java:823) >>>>> at java.lang.System.loadLibrary(System.java:1030) >>>>> at >>>>> ianywhere.ml.jdbcodbc.IDriver.try_load(IDriver.java:247) >>>>> at >>>>> ianywhere.ml.jdbcodbc.IDriver.(IDriver.java:216) >>>>> at java.lang.Class.forName0(Native Method) >>>>> at java.lang.Class.forName(Class.java:169) >>>> >>>> >>>> I just did a quick yum search on a CentOS 6 machine, and I guess you're >>>> running a self-installed version of Tomcat 7 from tomcat.apache.org. >>>> >>>> If that's the case, you can do the following to add to your >>>> java.library.path. >>>> >>>> 1. Create a file called setenv.sh in $CATALINA_BASE/bin >>>> 2. Add the following lines >>>> >>>> JAVA_OPTS="-Djava.library.path=directory-with-libdbodbc12.so" >>>> export JAVA_OPTS >>>> >>>> 3. Restart Tomcat >>>> >>>> Technically you could place this in CATALINA_OPTS instead, and the path >>>> would only be available to Tomcat (and not the separate shutdown JVM). For >>>> memory parameters, this is important. For java.library.path, probably not as >>>> much. >>>> >>>> If you've installed Tomcat 7 from a third party RPM, then you'll have to >>>> find the bin directory and create the file as above. Hopefully the packager >>>> didn't alter catalina.sh so that it doesn't parse setenv.sh. >>>> >>>> I've not tried this since I use pure Java drivers for databases, and have >>>> not used this database. I do load the APR native library this way. >> >> ==== COMMENT ==== >> >> I don't know where you've placed the dbjodbc12.so and corresponding JAR >> file. Here are some thoughts on that. >> >> 1. dbjodbc12.so location >> >> Place this outside of your Tomcat installation. Since this is a system >> resource, you might consider placing it in /opt/Sybase/lib or something >> similar. >> >> Make sure that the file (and directory) are readable by the user running >> your Tomcat process. In general for a directory 0755 is appropriate, and >> for the file itself 0755 (libraries are executable?). >> >> Another possibility is to place the library in a system location (/lib, >> /usr/lib, /usr/local/lib) and let ldconfig make this available. If you >> do this, then the java.library.path should not be needed. However, that >> will impact your entire system so it may not be what you want. >> >> 2. sajdbc4.jar >> >> I'm guessing that you're actually using sajdbc3.jar? Again, I don't know >> since I've not worked with the Sybase database. >> >> At any rate, since you're doing this all in JSP (and I assume for now >> NOT using JNDI), you need to place the appropriate JAR file in >> WEB-INF/lib of your application. >> >> It should be found ONLY in the WEB-INF/lib of your application. Placing >> the JAR file in multiple places will just lead to the issues you're seeing. >> >> One of these days I'm going to walk through the classloader mechanics so >> I can understand why multiple JAR locations creates issues. >> >> ==== COMMENT ==== >> >> . . . . just my two cents. >> /mde/ Well considering I'm not the person with the original problem, and I don't use Sybase (also not particularly fond of web applications that load JNI stuff), I don't know. I suspect that it's the combination of java.library.path and the database URL the original requester is using. We'll have to see if the original person responds concerning the Sybase forum link I posted. I'm sort of curious to know as well. . . . . just my (sort of interested) 2 cents /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org