java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver - Java Server Pages (JSP)(Archived)

When I try to run my jsp program by entering the address
http://localhost:8080/examples/bab/oraconn.jsp I receive the
classnotfoundexception. Any help would be appreciated.
my classpath: CLASSPATH=C:\Program Files\PhotoDeluxe 2.0
\AdobeConnectables;C:\jdk1.3.0_02\lib\
tools.jar;C:\jdk1.3.0_02;C:\oracle\ora81
\jdbc\lib\classes111.zip;C:\j21work;C:\P
rogram Files\Apache Tomcat 4.0\webapps\examples\bab;C:\Program
Files\NetDirect\J
DataConnect\classes
my path:
Path=C:\ORACLE\ora9ias\BIN;C:\ORACLE\ora9ias\Apache\Perl\5.00503
\bin\mswin32-x86
;C:\oracle\ora81\bin;C:\Program Files\Oracle\jre\1.1.7
\bin;C:\WINNT\system32;C:\
WINNT;C:\WINNT\System32\Wbem;C:\J21work;C:\jdk1.3.0_02\bin;\bin
my jsp program:
<%#page import="java.sql.*" %>
<html>
<head></head>
<body>
<%
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String dbURL = "jdbc:oracle:thin:#myhostname:1521:orclbb";
Connection con = DriverManager.getConnection
(dbURL,"scott","tiger");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM emp");
while (rs.next())
{
String s = rs.getString("ename");
%>
<%= s %><br>
<%
}
rs.close();
stmt.close();
con.close();
}
catch (Exception ex)
{
%>
<%= ex %>
<%
}
%>
</body>
</html>

try to remove classes111.zip from your classpath, and put
classes12.zip instead of 

Actually classes111.zip should also work. please see whether the
Database coonecting string is proper or check with the port 1521
with your database server. sometimes it creates problem when
multiple appliactions are accessing the common database server.
thanks
Arnab 

I am having similar problems connecting to Oracle through a JSP page. I get this error: ClassNotFoundException: oracle.jdbc.driver.OracleDriver. I am new to Java and am very confused about the CLASSPATH. I am using JDK 1.3 on Win 2k Server. My environment variable CLASSPATH is empty, but tomcat is pulling values for it from somewhere. I think it is coming from the xml config stuff in tomcat. I tried setting the CLASSPATH in the environ. var. to point towards my classes111.zip file. That didnt work either. Can anyone tell me how and where to set the classpath in the xml, or any other way I can use the OraceDriver.
Thanks 

tomcat 4.0 no longer looks to classpath envrionmental variable but builds the the class path it will use by reading the files in the various lib directories.
for example I have my classes12.jar in
\jakarta-tomcat-4.0\common\lib\ 

I also face the same problem!
I really don't know how to set classpath and path.
I set it through my autoexe.bat file it is any problem?
currently i am using JDK 1.3, and Resin server under Win 2000 Advanced server.
The important thing i really don't know is, it is necessary for use to uzip all the file in the [oracle_home]\jdbc\lib\
Thanks for your help! 

hi,suggest me a good server for jsp
murali 

i'm encountering the same problem. and just like jeff, i have an empty listing on my Enviroment classpath. here's a sample error:
500 Internal Server Error
OracleJSP:
JSP Error:
-----------------------------------------------------------------
Request URI:/main.jsp
Exception:
java.lang.NoClassDefFoundError: myBean (wrong name: /beans/myBean)
     at java.lang.ClassLoader.defineClass0(Native Method)
     at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:117)
     at com.evermind.naming.ContextClassLoader.defineClass(ContextClassLoader.java:974)
     at com.evermind.naming.ContextClassLoader.findClass(ContextClassLoader.java(Compiled Code))
     at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
     at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
     at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Class.java:212)
     at com.evermind.server.ApplicationContextClassLoader.findClass(ApplicationContextClassLoader.java:19)
     at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
     at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
     at oracle.jsp.parse.JspUtils.loadClassJDK(JspUtils.java:219)
     at oracle.jsp.parse.JspUtils.loadClass(JspUtils.java:209)
     at oracle.jsp.parse.JspBeanInfo.loadBean(JspBeanInfo.java:201)
     at oracle.jsp.parse.OpenJspTagHandler.defineBeans(OpenJspTagHandler.java:298)
     at oracle.jsp.parse.OpenJspTagHandler.defineBeans(OpenJspTagHandler.java:258)
     at oracle.jsp.parse.OpenJspTagHandler.validateTagAttributes(OpenJspTagHandler.java:221)
     at oracle.jsp.parse.JspParseTag.parse(JspParseTag.java(Compiled Code))
     at oracle.jsp.parse.OpenJspTagHandler.parse(OpenJspTagHandler.java:467)
     at oracle.jsp.parse.JspParseTag.parseNextTag(JspParseTag.java:548)
     at oracle.jsp.parse.JspParseTagFile.parse(JspParseTagFile.java:159)
     at oracle.jsp.parse.OracleJsp2Java.transform(OracleJsp2Java.java:40)
     at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:280)
     at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:173)
     at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:362)
     at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:357)
     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:145)
     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:356)
     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:306)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
     at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62
-------------------------------------
i've already added a bunch of library paths in the application.xml file, including the path for ojsp.jar and ojsputil.jar. what classpath do you thing is missing?

Well, i don't know much about Tomcat as i never worked on it, but i have worked on JRun and also on Apache. Generally the classpath is set in the respective Configuration/Properties file of the Web/Application server. Please chek the documentations of your respective server, there must be mention of setting the classpath somewhere. If you find the location of that file then you have to set the classpath accordingly.
For e.g in Apache the classpath has to be entered in the jserv.properties file and in case of JRun the classpath has to be entered in the local.properties file. There you have to enter the classpath for the classes111.zip as well.
Thanks

Related

problem with getVendorConnection method

Hello All,
From reading (many) posts, this topic has come up before on numerous occasions. Joe Weinstein's answers have given me a lot of info over the last few days but this is still not working for me. I'm running this as a deployed ear on WL8.1 SP5 and it's a JUnit Test class being debugged in Eclipse with the remote debugger on. The database is Oracle 8i (I believe 8.1.7).
We're using Oracle 10.2.0.1 drivers, the latest when we kicked off the project for our version of the DBMS. We add these to the classpath by editing startweblogic.cmd
JDBC_LIB_DIR=C:\jdbc_lib
JDBC_JARS=%JDBC_LIB_DIR%\10.2.0.1\ojdbc14.jar;%JDBC_LIB_DIR%\orai18n.jar;%JDBC_LIB_DIR%\8i-classes12\nls_charset12.zip
set CLASSPATH=...;%JDBC_JARS%;%WEBLOGIC_CLASSPATH%;...
We've got a connection pool defined that is the provider for a DataSource, jdbc/datasource1
The driver clasname for the pool is oracle.jdbc.pool.OracleDataSource (it tests successfully and has successfully been used for months now. I believe that this driver is needed to get out user defined Array types out of the database which is working fine too)
At present, I understand that to create a descriptor, that I need to get the physical connection and manage that carefully. This should be done using ((WLConnection)con).getVendorConnection();. Further, this won't work on code that is running outside of Weblogic.
I'n now getting an exception that occurs on the line where I try to call getVendorConnection, and is:
java.rmi.MarshalException: error marshalling return; nested exception is:
     java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
     at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:164)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAO.addPartnersToPolicy(SSGIOSFunctionDAO.java:726)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAOTest.testAddPartnersToPolicy(SSGIOSFunctionDAOTest.java:171)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at java.io.ObjectOutputStream.writeObject0(Unknown Source)
     at java.io.ObjectOutputStream.writeObject(Unknown Source)
     at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:120)
     at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:93)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_WLSkel.internalInvoke1(Unknown Source)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_WLSkel.invoke(Unknown Source)
     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
     at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
     at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
     at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
     at java.lang.Thread.startThreadFromVM(Unknown Source)
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
[java.rmi.MarshalException: error marshalling return; nested exception is:
     java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection]
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAO.addPartnersToPolicy(SSGIOSFunctionDAO.java:726)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAOTest.testAddPartnersToPolicy(SSGIOSFunctionDAOTest.java:171)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
     
     
The relevant code segments are given here, starting with the DAO object
static final String ADD = "{? = call xyz.add (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
...
{
CallableStatement st = this.getPreparedStatement(ADD); //code below
Connection con = st.getConnection();
WLConnection wlCon = ((WLConnection)con);
String poolName = wlCon.getPoolName();
System.out.println("pool name is: " + poolName); //successful
Connection vCon = wlCon.getVendorConnection(); //exception thrown here
OracleConnection orConn = (OracleConnection)vCon;
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor(PLSQL_SCHEMA + "SS_PARTNERS_REC",orConn);
ARRAY oraArray = new ARRAY(descriptor, con, newToAdd);
...
}
CallableStatement getPreparedStatement(String dbCall) {
     Connection con = dataSourceHelper.getDataSourceCon(); //from WL's context, code below (again!)
     CallableStatement st = con.prepareCall(dbCall);
     st.registerOutParameter(1, OracleTypes.CURSOR); //always 1
     st.registerOutParameter(2, Types.ARRAY,
               PLSQL_ERROR_DETAILS_OBJ); //always 2
     return st;
     } catch (SQLException sqle) {
     //log this
     }
}
//condensed/abbreviated dataSourceHelper method to keep the post smaller
//asCtx is a context kicked off from weblogic.jndi.WLInitialContextFactory
public Connection getDataSourceCon() {
     try {
          Object dsObj = return asCtx.lookup("jdbc/datasource1");
          if (null != dsObj) {
               ds = (javax.sql.DataSource)dsObj;
               return ds.getConnection();
          } else {
               return null;
          }
     } catch (NamingException ne) {
          //log this
     } catch (SQLException sqle) {
          //log this
     }
}
con gets successfully created as:
weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub
con remains the same after the WLConnection cast
st gets successfully created as:
weblogic.jdbc.rmi.SerialCallableStatement_weblogic_jdbc_rmi_internal_CallableStatementStub_weblogic_jdbc_rmi_internal_CallableStatementImpl_weblogic_jdbc_wrapper_CallableStatement_oracle_jdbc_driver_T4CCallableStatement_815_WLStub
One of Joe's answers to "akerberg" (Nov 2, 2004 8:36 AM) suggested changing the DataConnectionFactory code. hence I've included the code to get the data source above. Is there something that I'm missing which causes the rmi type stub to be automatically generated instead of a "local" logical connection?
Any help/pointers would be very much appreciated.
Thanks and Best Regards,
Conor 
Conor D'Arcy wrote:
Hello All,
From reading (many) posts, this topic has come up before on numerous occasions. Joe Weinstein's answers have given me a lot of info over the last few days but this is still not working for me. I'm running this as a deployed ear on WL8.1 SP5 and it's a JUnit Test class being debugged in Eclipse with the remote debugger on. The database is Oracle 8i (I believe 8.1.7).
We're using Oracle 10.2.0.1 drivers, the latest when we kicked off the project for our version of the DBMS. We add these to the classpath by editing startweblogic.cmd
JDBC_LIB_DIR=C:\jdbc_lib
JDBC_JARS=%JDBC_LIB_DIR%\10.2.0.1\ojdbc14.jar;%JDBC_LIB_DIR%\orai18n.jar;%JDBC_LIB_DIR%\8i-classes12\nls_charset12.zip
set CLASSPATH=...;%JDBC_JARS%;%WEBLOGIC_CLASSPATH%;...
We've got a connection pool defined that is the provider for a DataSource, jdbc/datasource1
The driver clasname for the pool is oracle.jdbc.pool.OracleDataSource (it tests successfully and has successfully been used for months now. I believe that this driver is needed to get out user defined Array types out of the database which is working fine too)
At present, I understand that to create a descriptor, that I need to get the physical connection and manage that carefully. This should be done using ((WLConnection)con).getVendorConnection();. Further, this won't work on code that is running outside of Weblogic.
I'n now getting an exception that occurs on the line where I try to call getVendorConnection, and is:
java.rmi.MarshalException: error marshalling return; nested exception is:
     java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
     at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:164)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAO.addPartnersToPolicy(SSGIOSFunctionDAO.java:726)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAOTest.testAddPartnersToPolicy(SSGIOSFunctionDAOTest.java:171)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
     at java.io.ObjectOutputStream.writeObject0(Unknown Source)
     at java.io.ObjectOutputStream.writeObject(Unknown Source)
     at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:120)
     at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:93)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_WLSkel.internalInvoke1(Unknown Source)
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_WLSkel.invoke(Unknown Source)
     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
     at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
     at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
     at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
     at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
     at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
     at java.lang.Thread.startThreadFromVM(Unknown Source)
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
[java.rmi.MarshalException: error marshalling return; nested exception is:
     java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection]
     at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub.getVendorConnection(Unknown Source)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAO.addPartnersToPolicy(SSGIOSFunctionDAO.java:726)
     at com.vhi.ss.dao.gios.SSGIOSFunctionDAOTest.testAddPartnersToPolicy(SSGIOSFunctionDAOTest.java:171)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:324)
     at junit.framework.TestCase.runTest(TestCase.java:154)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
     
     
The relevant code segments are given here, starting with the DAO object
static final String ADD = "{? = call xyz.add (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
...
{
CallableStatement st = this.getPreparedStatement(ADD); //code below
Connection con = st.getConnection();
WLConnection wlCon = ((WLConnection)con);
String poolName = wlCon.getPoolName();
System.out.println("pool name is: " + poolName); //successful
Connection vCon = wlCon.getVendorConnection(); //exception thrown here
OracleConnection orConn = (OracleConnection)vCon;
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor(PLSQL_SCHEMA + "SS_PARTNERS_REC",orConn);
ARRAY oraArray = new ARRAY(descriptor, con, newToAdd);
...
}
CallableStatement getPreparedStatement(String dbCall) {
     Connection con = dataSourceHelper.getDataSourceCon(); //from WL's context, code below (again!)
     CallableStatement st = con.prepareCall(dbCall);
     st.registerOutParameter(1, OracleTypes.CURSOR); //always 1
     st.registerOutParameter(2, Types.ARRAY,
               PLSQL_ERROR_DETAILS_OBJ); //always 2
     return st;
     } catch (SQLException sqle) {
     //log this
     }
}
//condensed/abbreviated dataSourceHelper method to keep the post smaller
//asCtx is a context kicked off from weblogic.jndi.WLInitialContextFactory
public Connection getDataSourceCon() {
     try {
          Object dsObj = return asCtx.lookup("jdbc/datasource1");
          if (null != dsObj) {
               ds = (javax.sql.DataSource)dsObj;
               return ds.getConnection();
          } else {
               return null;
          }
     } catch (NamingException ne) {
          //log this
     } catch (SQLException sqle) {
          //log this
     }
}
con gets successfully created as:
weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub
con remains the same after the WLConnection cast
st gets successfully created as:
weblogic.jdbc.rmi.SerialCallableStatement_weblogic_jdbc_rmi_internal_CallableStatementStub_weblogic_jdbc_rmi_internal_CallableStatementImpl_weblogic_jdbc_wrapper_CallableStatement_oracle_jdbc_driver_T4CCallableStatement_815_WLStub
One of Joe's answers to "akerberg" (Nov 2, 2004 8:36 AM) suggested changing the DataConnectionFactory code. hence I've included the code to get the data source above. Is there something that I'm missing which causes the rmi type stub to be automatically generated instead of a "local" logical connection?
Any help/pointers would be very much appreciated.
Thanks and Best Regards,
ConorHi. Two things. I don't like getting a connection from a statement. Get it
from your DataSource. Then make a statement and use it. What version of
WebLogic is this? How many servers are involved, and is the DataSource
deployed to all servers? It looks like a class in one WLS server got
a connection from a pool in another server, which means it will fail
like an external client as far as getVendorConnection() is concerned.
Joe 
Hi Joe et al,
Thanks for your prompt response. I've been trying to tie down the problem this morning and have not yet managed, but I can answer your questions anyway.
1) I can confirm my statement of yesterday that it is WebLogic 8.1 SP5 (bea\jrockit81sp5_142_08 installed).
2) There is only one WL81 server involved, on my local machine for development. There is only one data source, mapped to one connection pool, both deployed on the one server. The database itself is on a different machine: it's on a big VMS box :-)
3) FWIW, I turned around the Connection / Statement order.
Your comment about the source being remote led me to trace the DataSource object. The context returned a "RmiDataSource_815_WLStub" which I could cast to a javax.sql.DataSource and get a
"weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub". In turn I traced a potential source of the problem back to my InitialContext setup, where I pass in a Hashtable to create it. It was being set up like
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001/");
asCtx = new InitialContext(ht);
I think now that even though the references were local, it was being treated as a remote Context because I was passing in the Hashtable.
However, simply giving the Context as
asCtx = new InitialContext();
throws an exception if I try to do a lookup, viz.:
public static Object getObjFromContext(String inputKey) throws DAOException {
try {
asCtx = new InitialContext();
return asCtx.lookup(inputKey);
} catch (NamingException ne) {
//log this
}
throws
Caught NamingException in getObjFromContext
     at com.vhi.ss.dao.PropertyLoader.getObjFromContext(PropertyLoader.java:115)
...
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
     at javax.naming.InitialContext.lookup(InitialContext.java:347)
     at com.vhi.ss.dao.SSPropertyLoader.getObjFromContext(SSPropertyLoader.java:111)
     ... 20 more
obviously, if I don't pass in the factory class name in the HashTable, the InitialContext will need to get it some other way, but none of our other ear files seem to specify it.
Yuor post yesterday prompted me to greatly change my search terms and I've since seen another post "Pool Driver vs RMI Driver" from Nov 6, 2002 12:07 PM. I've setup a new Connection Pool with the thin driver oracle.jdbc.Driver instead of oracle.jdbc.pool.OracleDataSource and a weblogic data source with the JNDI name weblogic.jdbc.jts.selfservice instead of jdbc/selfservice or jdbc/datasource1.
I've tried calling the new DataSource using
"java:comp/env/jdbc/selfservice" as the inputKey but that's not working either (same java.naming.initial.factory exception as above).
THe JNDI Tree for weblogic says that the class is
     weblogic.jdbc.common.internal.RmiDataSource
The RMI in the DataSource class name leaves me wary that I'll get a remote object in any case if I try to get a connection from this new connection pool, but I'll see what happens when I can eventually instantiate the InitialContext.
At this stage, I'm a bit stuck...if Joe or anyone else has any ideas for getting the java.naming.factory.initial to the server I'd be delighted to hear them. E.g. is it necessary to pass it in as a -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory command line variable?
Thanks again and Best Regards,
Conor 
Conor D'Arcy wrote:
Hi Joe et al,
Thanks for your prompt response. I've been trying to tie down the problem this morning and have not yet managed, but I can answer your questions anyway.
1) I can confirm my statement of yesterday that it is WebLogic 8.1 SP5 (bea\jrockit81sp5_142_08 installed).
2) There is only one WL81 server involved, on my local machine for development. There is only one data source, mapped to one connection pool, both deployed on the one server. The database itself is on a different machine: it's on a big VMS box :-)
3) FWIW, I turned around the Connection / Statement order.
Your comment about the source being remote led me to trace the DataSource object. The context returned a "RmiDataSource_815_WLStub" which I could cast to a javax.sql.DataSource and get a
"weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_815_WLStub". In turn I traced a potential source of the problem back to my InitialContext setup, where I pass in a Hashtable to create it. It was being set up like
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001/");
asCtx = new InitialContext(ht);
I think now that even though the references were local, it was being treated as a remote Context because I was passing in the Hashtable.
However, simply giving the Context as
asCtx = new InitialContext();
throws an exception if I try to do a lookup, viz.:
public static Object getObjFromContext(String inputKey) throws DAOException {
try {
asCtx = new InitialContext();
return asCtx.lookup(inputKey);
} catch (NamingException ne) {
//log this
}
throws
Caught NamingException in getObjFromContext
     at com.vhi.ss.dao.PropertyLoader.getObjFromContext(PropertyLoader.java:115)
...
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
     at javax.naming.InitialContext.lookup(InitialContext.java:347)
     at com.vhi.ss.dao.SSPropertyLoader.getObjFromContext(SSPropertyLoader.java:111)
     ... 20 more
obviously, if I don't pass in the factory class name in the HashTable, the InitialContext will need to get it some other way, but none of our other ear files seem to specify it.
Yuor post yesterday prompted me to greatly change my search terms and I've since seen another post "Pool Driver vs RMI Driver" from Nov 6, 2002 12:07 PM. I've setup a new Connection Pool with the thin driver oracle.jdbc.Driver instead of oracle.jdbc.pool.OracleDataSource and a weblogic data source with the JNDI name weblogic.jdbc.jts.selfservice instead of jdbc/selfservice or jdbc/datasource1.
I've tried calling the new DataSource using
"java:comp/env/jdbc/selfservice" as the inputKey but that's not working either (same java.naming.initial.factory exception as above).
THe JNDI Tree for weblogic says that the class is
     weblogic.jdbc.common.internal.RmiDataSource
The RMI in the DataSource class name leaves me wary that I'll get a remote object in any case if I try to get a connection from this new connection pool, but I'll see what happens when I can eventually instantiate the InitialContext.
At this stage, I'm a bit stuck...if Joe or anyone else has any ideas for getting the java.naming.factory.initial to the server I'd be delighted to hear them. E.g. is it necessary to pass it in as a -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory command line variable?
Thanks again and Best Regards,
ConorHi Conor!
I just ran a JSP that printed out:
JSP GETS CON... weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_sqlserver_SQLServerConnection#43
It's a WLConnection
Vendor Connection is a weblogic.jdbc.sqlserver.SQLServerConnection#1316264
I got my connection like this:
java.util.Hashtable ht = new java.util.Hashtable();
ht.put(javax.naming.Context.PROVIDER_URL, "t3://localhost:7001");
ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ctx = new javax.naming.InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("MS");
c = ds.getConnection();
System.out.println("JSP GETS CON... " + c );
if ( c instanceof weblogic.jdbc.extensions.WLConnection)
System.out.println("It's a WLConnection");
else
System.out.println("It's not a WLConnection");
Connection vc = ((weblogic.jdbc.extensions.WLConnection)c).getVendorConnection();
System.out.println("Vendor Connection is a " + vc );
I also tried
java.util.Hashtable ht = new java.util.Hashtable();
/*
ht.put(javax.naming.Context.PROVIDER_URL, "t3://localhost:7001");
ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
*/
ctx = new javax.naming.InitialContext(ht);
and it worked...
Joe 
Hi again Joe,
Thanks for your time and for your help. You've saved me a lot time where I've been barking up the wrong tree, where I was trying to get the InitialContext to initialise! I'll post the cause tomorrow (we're a few hours ahead of you) if I get it working but it's nice to see that I can put the Hashtable back the way it was and it should still work!
Best Regards,
Conor 
Hello All,
I've spent today eating humble pie. The problem is, exactly as Joe said, that the client was remote. I thought that by deploying my xyzTest.class files into the .ear file along with the junit.jar in the APP-INF/lib folder, that junit would run within the container. But of course, it fires up it's own JVM by default and I hadn't done anything to change that behaviour :-(
Anyway, the .ear file has a .war and a .jar ... by using a call to the .war as the route in to the JDBC call, it all intialised locally and works beautifully. Now I just have to refactor this method to get it back to production code quality and not the hacked harness it has become!
Thanks very much for your time and help Joe.
Best Regards,
Conor
Chalk one up to a schoolboy error 
Conor D'Arcy wrote:
Hello All,
I've spent today eating humble pie. The problem is, exactly as Joe said, that
the client was remote. I thought that by deploying my xyzTest.class files
into the .ear file along with the junit.jar in the APP-INF/lib folder, that
junit would run within the container. But of course, it fires up it's own
JVM by default and I hadn't done anything to change that behaviour :-(
Anyway, the .ear file has a .war and a .jar ... by using a call to the .war
as the route in to the JDBC call, it all intialised locally and works
beautifully. Now I just have to refactor this method to get it back to
production code quality and not the hacked harness it has become!
Thanks very much for your time and help Joe.
Best Regards,
ConorVery glad to help.
We want you successful.
Joe Weinstein at BEA Systems

problem using Toplink with JUnit

Hi,
I have a problem using Toplink with JUnit. Method under test is very simple: it use a static EntityManager object to open a transaction and persists data to db. When I invoke the method from a test method, it gives me the exception:
java.lang.AssertionError
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.computePURootURL(PersistenceUnitProcessor.java:248)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:232)
     at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:216)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:239)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:278)
     at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:81)
     at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:119)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
     at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
     at it.valerio.electromanager.model.EntityFacade.<clinit>(EntityFacade.java:12)
     at it.valerio.electromanager.business.ClienteBiz.insertIntoDatabase(ClienteBiz.java:36)
     at it.valerio.electromanager.test.model.ClienteTest.insertDBTest(ClienteTest.java:30)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
     at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
     at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
     at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
     at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
     at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
     at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
     at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Where is the problem???
Regards,
Valerio 
Valerio,
How does your it.valerio.electromanager.model.EntityFacade work?
In my JUnit testing with JPA I typically have a singleton EntityManagerFactory and each test case acquires and closes its own EntityManager.
Doug 
The error is occurring because the persistence XML URL is not a file, but for some reason its protocol is file, which seems odd. I have never seen this before in running tests in JUnit.
If you run the test using a main method instead of JUnit does it still occur?
How have you deployed your persistence.xml in your classpath, is it in a jar, or in a directory?
What build of TopLink Essentials are you using, did you try the latest build? 
EntityFacade class is very simple and it uses a static EntityManager object. Here the code:
public class EntityFacade {
     private static EntityManager em = Persistence.createEntityManagerFactory("ElectroManager").createEntityManager();
     private static Logger logger=Logger.getLogger(EntityFacade.class);
          
     public static void insertCliente(Cliente c)
     {
          logger.debug("Inserisco cliente nel db: " + c);
          em.getTransaction().begin();
          c.setId(getNextIdForTable("Cliente"));
          em.persist(c);
          em.getTransaction().commit();
     }
}
If I call the method from inside a main it works well, so I think the problem is not the classpath neither the URL in the persistence.xml. However the URL is:
<property name="toplink.jdbc.url" value="jdbc:derby:c:/programmi/ElectroManager/db/electroManager"/>
I use the latest build version of TopLink.
Thanks. 
I meant the URL that TopLink had to your persistence.xml.
Where is your persistence.xml on your classpath, it is in a jar or in a folder? Do you have more than one? 
Now it's in the META-INF folder. But I'm developing now and when I launch my program using a main class it works well. The problem is only when I launch it using the junit. However my file hierarchy is:
src
|____ it.valerio.electromanager.test.ClienteTest
|____ it.valerio.electromanager.model.*
|____ META-INF
|_____ persistence.xml
and obviously the classpath is set on the src directory. 
Problem with forum layout.
The persistence.xml is in the META-INF folder.... 
Your src configuration looks correct. When running with JDeveloper or the Eclipse IDE I have a similar configuration. In both cases the IDE copies the XML configuration file over to the classes folder which is on my classpath and TopLink JPA discovers it there.
Doug 
I had the similar problem if the file path for the persistence.xml has spaces in it. If the persistence.xml path does not have spaces, then it works fine. It might be a bug in the TopLink. 
I believe the spaces issues was fixed some time ago, you may wish to try the latest EclipseLink or TopLink 11g release.
----
James : http://www.eclipselink.org 
Valerio,
As James mentioned we fixed this issue in June 2008 in EclipseLink 1.0 M11.
To help out with details on the fix see comment #29 at the end of Eclipse bug# 210280 as a reference.
"running with assertions on was failing on encoded %20 space characters in the persistence.xml file path"
http://bugs.eclipse.org/210280
You may obtain the binaries and source for EclipseLink below.
http://wiki.eclipse.org/EclipseLink/Source
thank you
/michael

no class def found exception for com.plumtree.remote.rat.XPTransportExcepti

Hi all...
I am running version 5.4 of the edk and trying to retrieve a content item. Here is the code I am executing:
IPortletContext portletContext = PortletContextFactory
.createPortletContext(request, response);
IRemoteSession session = portletContext.getRemotePortalSession();
IContentFactory contentFactory = session.getContentFactory();
IContentItemManager contentItemMgr = contentFactory.getContentItemManager();
IContentItem item = contentItemMgr.getContentItem(docUUID);
However, when it executes, the following error is being thrown:
Exception thrown : java.lang.NoClassDefFoundError: com.plumtree.remote.rat.XPTransportException
     at java.lang.J9VMInternals.verifyImpl(Native Method)
     at java.lang.J9VMInternals.verify(J9VMInternals.java:68)
     at java.lang.J9VMInternals.initialize(J9VMInternals.java:129)
     at com.plumtree.remote.prc.content.transport.client.XPContentItemProceduresFactory.getProcedures(XPContentItemProceduresFactory.java:17)
     at com.plumtree.remote.prc.xp.XPRemoteSession.getContentItemProcedures(XPRemoteSession.java:630)
     at com.plumtree.remote.prc.content.item.XPContentItemManager.getContentItem(XPContentItemManager.java:230)
     at com.plumtree.remote.prc.content.item.ContentItemManagerWrapper.getContentItem(ContentItemManagerWrapper.java:191)
     at com.wrberkley.berkleynetadmin.actions.PreparePHRegisterAction.execute(PreparePHRegisterAction.java:64)
     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:413)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:225)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1855)
     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:447)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
     at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3276)
     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
     at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)
     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:113)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
     at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
Is there a jar missing? I don't see any references to this class in any documents, and it's not in the jar.
Thanks 
Hello,
Where do you run your application? Is it on IBM WebSphere?
My guess is that you may have some web service library conflict that shipped with websphere and been loaded versus library shipped with idk. If this is a case you may try:
1) test your application on tomcat
2) on websphere setup option for your application to use local jars from lib folder (servlet specification recommended this way but don't force to use one, so some servers, for example, weblogic doesn't follow this recommendation, I don't remember for websphere).
Dmitry 
That's a great thought... I am running it locally within RAD on IBM WebSphere v7.1. And, from the error message it does appear that it is using a different version of the jar at runtime. However, I verified on the admin console that the classloader is configured to use parent last/application first. I tried changing it to parent first just to see if the error message would change, which it didn't. I also scanned my machine to check for conflicting versions of the edk.jar in any other libraries, and didn't find any. Any other ideas?

Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.dr

Hi I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment: Setting Up Your Environment --------------------------- On Win95/Win98/NT: - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH. (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.) - Make sure [ORACLE_HOME]\bin is in your PATH. Still I am getting the following error during runtime: Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at jdbc.InsertQueryEx.main(InsertQueryEx.java:11) Below is the source code: import java.sql.*; import java.io.*; public class InsertQueryEx { public static void main(String[] args)throws Exception{ Class.forName("oracle.jdbc.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:#Prashy:1521:orcl", "scott", "tiger"); DataInputStream din = new DataInputStream(System.in); Statement stmt = con.createStatement(); while(true){ try{ System.out.println("enter emp name"); String name = din.readLine(); System.out.println("enter emp no"); int no = Integer.parseInt(din.readLine()); System.out.println("enter emp salary"); float sal = Float.parseFloat(din.readLine()); System.out.println("enter emp address"); String addr = din.readLine(); int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')"); if(count>0) System.out.println("Record added"); else System.out.println("Failed"); } catch (Exception e){ System.err.println("Exception: "+e.getMessage()); } } } } Any help is appreciated Thanks Prashant
added in the C:\Oracle9i\jdbc\lib pathBut is it in your classpath? 
According to the exception it is not.
If you're executing your Java application using java.exe, then use the -cp or -classpath argument to set the classpath. 
I am sorry but I did add those in the classpath but still getting this error:
This is what I have for user variable in classpath:
.;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
error is:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
     at java.net.URLClassLoader$1.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClassInternal(Unknown Source)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Unknown Source)
     at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
Thanks 
I am not sure if ojdbc14.jar is compatible with my jdk version 1.6.0
i have oracle 9i installed btw 
ojdbc14.jar requires JDK 1.4. For JDK 6 use the ojdbc6.jar in Oracle database 11g JDBC drivers. 
Thanks for the reply...I tried that as well but i got the same error mesg as I posted in previous message. 
How exactly are you executing the application? 
I am running the program through MyEclipse IDE..Run As ->Java Application
I also tried adding the jar file ojdbc6 in my project through build path but no go. 
I SOLVED MY PROBLEM:)
thanks to everybody for your replies
this did the trick:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
i used that instead of Class.forName("oracle.jdbc.driver.OracleDriver "); and worked ..connected with db and succesfuly performing the operations. 
just FYI....
adding ojdbc14.jar file as external jar using build path is sufficient. I didnt need to set environment variables that way.
thanks all 
prashant82 wrote:
I am running the program through MyEclipse IDE..Run As ->Java ApplicationThe environment variable %CLASSPATH% is ignored by the IDE. It is only used by javac.exe and java.exe when you do NOT specify any of the -cp, -classpath or -jar arguments.
I also tried adding the jar file ojdbc6 in my project through build path but no go.Then you did it wrong.

jsp PortalRenderRequest to get UserName

I am having problems getting the username from portal to display within a jsp page.
The following error occurs:
Exception:
java.lang.NoClassDefFoundError: oracle/portal/provider/v1/PortletRenderRequest
     at java.lang.Class.newInstance0(Native Method)
     at java.lang.Class.newInstance(Class.java:237)
     at oracle.jsp.runtimev2.JspPageInstFacade.createInst(JspPageInstFacade.java:103)
     at oracle.jsp.runtimev2.JspPageInstFacade.getInstance(JspPageInstFacade.java:121)
     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:287)
     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
     at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
     at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:151)
     at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
The example JSP page from the PDK :
<%# page language = "java" import = "java.io.*, java.util.*, java.text.*,oracle.portal.provider.v1.*, oracle.portal.provider.v1.http.*" %>
<%
PortletRenderRequest pr = (PortletRenderRequest)request.getAttribute(HttpProvider.PORTLET_RENDER_REQUEST);
String user = pr.getUser().getName();
String title = null;
NameValuePersonalizationObject o = (NameValuePersonalizationObject)PortletRendererUtil.getEditData(pr);
title = o.getPortletTitle();
out.print("username = " + user);
%>
The PortletRenderRequest is an interface and so abstract. Do we have to create our own class that implements the interface or is there a class that already does this?
We are trying to display this in portal using Portal Provider URL link and defining the url in this way.
Any help would be appreciated.
Thanks,
Gareth.
From the stack trace you provide, it looks like you're trying to run the V1 JPDK (version numbers like 1.x or 3.x) inside the OC4J servlet container.
This will not work, you need to be using the V2 JPDK (which has a version number like 9.x).
You probably have already downloaded this and are trying to get your v1 implemented portlets working against the v2 APIs. This is destined for failure unless you migrate your portlets properly.
Have a look at the migration how-to article that comes with the 9.0.2 PDK download.
Regards,
Gareth
---------
JPDK Development Team. 
Thanks for your reply.
I've been looking through a doc called Upgrading to PDK-Java v2. Am i right in assuming that from the document each v1 class needs to be updated using the v2 class definitions i.e. creating a new class and refering everything with v1 to v2 using the API documentation?

Categories

Resources