Solved

JSP Error

Posted on 2011-09-18
6
1,079 Views
Last Modified: 2012-05-12
Hi ,

I'm using Oracle JDeveloper 11.1.2.0 and Oracle 11g and WebLogicserver 11gR1

I type in command prompt, java -version its shows 1.6.0_22

Please find below my code
 Connection conn = null;
     Statement stmt = null;
     ResultSet rset = null;
     try {
        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
        conn = DriverManager.getConnection("jdbc:oracle:oci:@",
                                           "scott", "tiger");
        stmt = conn.createStatement();
        // dynamic query
        rset = stmt.executeQuery ("SELECT ename, sal FROM scott.emp");
       
     } catch (SQLException e) {
           System.out.println( "Error1"+e );
     } finally {
         if (rset!= null) rset.close();
         if (stmt!= null) stmt.close();
         if (conn!= null) conn.close();
     }

i'm getting following Error

Error 500--Internal Server Error

java.lang.UnsatisfiedLinkError: oracle.jdbc.driver.T2CConnection.getLibraryVersionNumber()I
      at oracle.jdbc.driver.T2CConnection.getLibraryVersionNumber(Native Method)
      at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3987)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3982)
      at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:280)
      at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:670)
      at oracle.jdbc.driver.T2CConnection.(T2CConnection.java:164)
      at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:55)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:567)
      at java.sql.DriverManager.getConnection(DriverManager.java:582)
      at java.sql.DriverManager.getConnection(DriverManager.java:185)
      at jsp_servlet.__in._jspService(__in.java:137)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

0
Comment
Question by:ukerandi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 36558078
The class name is not normally done that way.  Usually it looks like this:

   Class.forName ("oracle.jdbc.OracleDriver");

   Connection conn = DriverManager.getConnection
     ("jdbc:oracle:thin:@//localhost:1521/orcl", "scott", "tiger");

(substitute your real host and port for //localhost:1521, if necessary).

See this FAQ from Oracle with good examples:
http://www.orafaq.com/wiki/JDBC
0
 
LVL 6

Expert Comment

by:tangchunfeng
ID: 36558656
change
jdbc:oracle:oci
to
jdbc:oracle:thin
is enough
0
 
LVL 10

Author Comment

by:ukerandi
ID: 36563061
if i used like that it will show following error
  Class.forName ("oracle.jdbc.OracleDriver");
onn = DriverManager.getConnection("jdbc.oracle:thin:@Admin-PC:1521:UK",
                                           "scott", "19770312");

i try using this but getting Error
java.sql.SQLException: No suitable driver found for jdbc.oracle:thin:@Admin-PC:1521/UK
      at java.sql.DriverManager.getConnection(DriverManager.java:602)
      at java.sql.DriverManager.getConnection(DriverManager.java:185)
      at jsp_servlet.__in._jspService(__in.java:91)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
      at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
0
Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

 
LVL 27

Expert Comment

by:mrcoffee365
ID: 36563265
You need to find out what the url is for your database.

Also -- in order for any of this to work, you have to have the Oracle driver in Tomcat's classpath.  That usually means in the WEB-INF/lib directory of your webapp.

What oracle driver jar do you have?
0
 
LVL 10

Author Closing Comment

by:ukerandi
ID: 36563673
Excellent
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 36563798
I'm assuming that means that getting the Oracle jar in your classpath solved the last problem.  Good luck!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
web project error add remove 1 51
DECLARATION OF CURSOR IS INCOMPLETE OR MALFORMED 5 40
error doing substr 3 36
error in oracle form 11 26
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question