- This topic has 10 replies, 3 voices, and was last updated 16 years, 5 months ago by
schanamolu.
-
AuthorPosts
-
Martin BurkertMemberI’m a newbie in developing J2EE Applications.
However I decided to implement a small Webapplication to list some rows of my Oracle 9i Database (9.2.0.6) with Hibernate.My configuration:
WinXP
Tomcat 5.0.28
Eclipse 3.1
MyEclipse 4.0 M2
ODBC-Driver for Oracle 9R2Wheneve accessing my jsp a exception is raised:
java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
the full path:
javax.servlet.ServletException: no ocijdbc9 in java.library.path
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.AddUser_jsp._jspService(AddUser_jsp.java:191)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)root cause
java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
java.lang.Runtime.loadLibrary0(Runtime.java:788)
java.lang.System.loadLibrary(System.java:834)
oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
java.sql.DriverManager.getConnection(DriverManager.java:512)
java.sql.DriverManager.getConnection(DriverManager.java:140)
net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1172)
net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
com.roche.hibernate.SessionFactory.currentSession(SessionFactory.java:50)
com.roche.hibernate.BearbeiterService.getBearbeiterList(BearbeiterService.java:165)
org.apache.jsp.AddUser_jsp._jspService(AddUser_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)my hibernate.xml looks like this:
[…]
<hibernate-configuration><session-factory>
<!– mapping files –>
<property name=”myeclipse.connection.profile”>MeCIS2</property>
<property name=”connection.url”>jdbc:oracle:oci:@mecis2</property>
<property name=”connection.username”>burkert</property>
<property name=”connection.password”>******</property>
<property name=”connection.driver_class”>oracle.jdbc.driver.OracleDriver</property>
<property name=”dialect”>net.sf.hibernate.dialect.Oracle9Dialect</property>
<mapping resource=”com/roche/hibernate/Bearbeiter.hbm.xml” /></session-factory>
</hibernate-configuration>
The ocijdbc9 location is referenced by my CLASSPATH, the JDBC/lib is refereced with my PATH-environment.
Anybody an idea whats the problem?
greetings
MartinAugust 3, 2005 at 2:20 pm #234160
Riyad KallaMemberMartin,
The OCI driver has a native DLL element to it, you need to find where it lives and then add that dir to your Window > Prefs > MyEclipse > App Server > Oracle 9 > Paths > “Append to Library Path” settings so the driver can find it when run from ME.August 8, 2005 at 3:29 am #234355
Martin BurkertMember@support-rkalla wrote:
Martin,
The OCI driver has a native DLL element to it, you need to find where it lives and then add that dir to your Window > Prefs > MyEclipse > App Server > Oracle 9 > Paths > “Append to Library Path” settings so the driver can find it when run from ME.Thx for the answer – sorry for my delay – had some holidays. 8)
The native DLLis named ocijdbc9.dll and “lives” in my Oracle_home\bin directory. (I think, thats the native DLL element corresponding to the ojdbc14.jar library I included to my workspace [of course the project compiles without errors])
I added this DLL to my Application Server (Tomcat 5, not Oracle 9iAS) [Window > Pref > ME > App S. > Tomcat5 > Paths > Append to libary path => add Dir c:\programs files\oracle\db9i\bin]
After Adding this path, it is not possible to start the tomcat again! 🙁
Error messages (2 boxes):
Java Virtual Machine Launcher: “Could not find the main class. Programm will exit.”Error starting Tomcat: “A configuration error occurred during startup. Please verify the preference field with the prompt: java.lang.NoClassDefFound: Files\oracle\db9i\bin Exception in thread “main” ”
greetings Martin
August 8, 2005 at 9:14 am #234366
Riyad KallaMemberThe problem is that you are adding dirs to your library path that contain a space in the path name (notice how it thinks the class name is Files\oracle\etc.etc.?). The workaround for now is to reinstall to a directory withour spaces, we have fixed this in 4.0 M3 which will be out within a week, so the alternative is to wait for that release.
August 10, 2005 at 6:24 am #234499
Martin BurkertMemberThx for the answer.
That was the problem. But it is not necessary to reinstall oracle in a different location. After copying the *.dll to c:\tmp and adding this directory to the libary path it was working. 😛
greetings Martin
December 23, 2008 at 2:14 pm #292717
schanamoluMemberThis message has not been recovered.
December 24, 2008 at 2:01 pm #292788
Riyad KallaMemberThis message has not been recovered.
December 25, 2008 at 8:53 pm #292815
schanamoluMemberThis message has not been recovered.
December 25, 2008 at 10:51 pm #292816
schanamoluMemberThis message has not been recovered.
December 29, 2008 at 11:41 am #292863
Riyad KallaMemberThis message has not been recovered.
January 19, 2009 at 12:16 pm #293678
schanamoluMemberKalla,
I’m still getting the following error message. “Connections could not be acquired from the underlying database!”
The detail exception is as follow
“Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!”
ApplicationContext.xml
<property name=”jdbcUrl”>
<value>
jdbc:oracle:oci:@${jdbc.host}:${jdbc.port}:${jdbc.database}
</value>
</property>startup.bat
We modified startup.bat in tomcat/bin directory
@echo off
if “%OS%” == “Windows_NT” setlocal
rem —————————————————————————
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat 302918 2004-05-27 18:25:11Z yoavs $
rem —————————————————————————set CATALINA_OPTS=-Djava.library.path=E:\oracle\ora92\bin
rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not “%CATALINA_HOME%” == “” goto gotHome
set CATALINA_HOME=%CURRENT_DIR%………………………
Enviornemnt Variable changes:
we referenced ocijdbc9.dll library by setting path enviornment variable ORALCE_HOME/bin
We copied ojbdc14.jar to this directory C:\tomcat\shared\lib
-
AuthorPosts