aspose file tools*
The moose likes JDBC and the fly likes I got java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement when trying to use UCP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "I got java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement when trying to use UCP" Watch "I got java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement when trying to use UCP" New topic
Author

I got java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement when trying to use UCP

Abdul Fareed
Greenhorn

Joined: Nov 13, 2011
Posts: 2
I am using Universal Connection Pool API for database connectivity. I have listed my program and error below . Kindly consider this and assist me on what's wrong:

Actually it is a web service and im using XPATH. Both the below java classes in same package

PDSConnection.java
-------------------------

import java.sql.Connection;
import java.sql.SQLException;
import oracle.ucp.jdbc.PoolDataSourceFactory;
import oracle.ucp.jdbc.PoolDataSource;

public class PDSConnection
{
Connection conn=null;
public Connection getConnection()
{

try
{
//Create pool-enabled data source instance.

PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
//set the connection properties on the data source.
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setURL("jdbcracle:thin:@10.10.39.224:1521:OFDMP");
pds.setUser("ofdm");
pds.setPassword("ofdmpass");

//Override any pool properties.
pds.setInitialPoolSize(5);
//Get a database connection from the datasource.
conn = pds.getConnection();
System.out.println("\nConnection obtained from " +
"UniversalConnectionPool\n");
}
catch(SQLException e)
{
System.out.println("DBConnection - " +
"main()-SQLException occurred : "
+ e.getMessage());
}
return conn;
}

public void closeConnection()
{
try {
//Close the Connection.
conn.close();
conn = null;
System.out.println("Connection returned to the " + "UniversalConnectionPool\n");
} catch (SQLException ex) {
//Logger.getLogger(PDSConnection.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex);
}
}
}

ServiceImpl.java :
---------------------

import com.reuters.okapi.*;
import postresult_xml.schemas.post.aclm.itd.bsf.*;
import sa.com.alfransi.ACLMServiceSoap;
import javax.jws.WebService;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.xpath.XPathConstants;


@WebService(serviceName = "ACLMService", portName = "ACLMServiceSoap", endpointInterface = "sa.com.alfransi.ACLMServiceSoap", targetNamespace = "http://www.alfransi.com.sa/", wsdlLocation = "WEB-INF/wsdl/ServiceImpl/aclm.wsdl")
public class ServiceImpl implements ACLMServiceSoap{

public postresult_xml.schemas.post.aclm.itd.bsf.Message addon(KPLUSFEED kplusfeed) {
//Variable Declaration
String addonAmt = null;
String error=null;
String DealId=null;
String DealTable=null;
String AddonCurrency=null;
String NPVAmount=null;
String NPVCurrency=null;
BigDecimal TMV_PERC=null;
Boolean isValid=false;
//Create String writer object to send XML as input Stream
StringWriter sw = new StringWriter();

//Create XPATH Expressions

//Expressions for Addon Logic
String DealIdExp = "/KPLUSFEED/HEADER/FIELD[@name='DealId']";
String DealTableExp = "/KPLUSFEED/HEADER/FIELD[@name='ExportTable']";
String NPVAmountExp = "/KPLUSFEED/PRIMARY/TABLE[@name='DealPricing']/ROW/FIELD[@name='NPV']";
String NPVCurrencyExp = "/KPLUSFEED/PRIMARY/TABLE[@name='DealPricing']/ROW/FIELD[@name='Currency']";

try{

//This converts KPLUSFEED Object into XML
JAXBContext jc = JAXBContext.newInstance(com.reuters.okapi.ObjectFactory.class);
//Create marshaller
Marshaller m = jc.createMarshaller();
//Marshal object into file.
m.marshal(kplusfeed, sw);
}catch(JAXBException jxbe){System.out.println(jxbe);}


//Convert marshalled XML output to DOM and parsing the results using XpathWS0
XpathWS0 reader = new XpathWS0(sw.toString());
DealId = reader.read(DealIdExp,XPathConstants.STRING).toString();
DealTable = reader.read(DealTableExp,XPathConstants.STRING).toString();
NPVAmount = reader.read(NPVAmountExp,XPathConstants.STRING).toString();
NPVCurrency = reader.read(NPVCurrencyExp,XPathConstants.STRING).toString();


//Posting the SOAP Response using Message object
postresult_xml.schemas.post.aclm.itd.bsf.Message m = new postresult_xml.schemas.post.aclm.itd.bsf.Message();

//Building SOAP response using AddonResponseStatus object
Message.AddonResponseStatus ar = new Message.AddonResponseStatus();
if(DealTable.equals("SpotDeals"))
{
addonAmt = "0";
ar.setDealId(DealId);
ar.setDealTable(DealTable);
ar.setAddonAmount(addonAmt);
ar.setAddonCurrency(NPVCurrency);
ar.setNPVAmount(NPVAmount);
ar.setNPVCurrency(NPVCurrency);
}
else if(DealTable.equals("FraDeals"))
{
//Expressions for FRAAddon Logic
String MaturityDateExp ="/KPLUSFEED/PRIMARY/TABLE[@name='FraDeals']/ROW[@rowId='"+DealId+"']/FIELD[@name='MaturityDate']";
String ValueDateExp = "/KPLUSFEED/PRIMARY/TABLE[@name='FraDeals']/ROW[@rowId='"+DealId+"']/FIELD[@name='ValueDate']";
String Currencies_ShortName_Exp = "/KPLUSFEED/REFERENCE/TABLE[@name='Currencies']/ROW/FIELD[@name='Currencies_ShortName']";
String NominalAmountExp = "/KPLUSFEED/PRIMARY/TABLE[@name='FraDeals']/ROW[@rowId='"+DealId+"']/FIELD[@name='NominalAmount']";

//Convert marshalled XML output to DOM and parsing the results using XpathWS0 reader class
String MaturityDateDay = reader.read(MaturityDateExp,XPathConstants.STRING).toString().substring(0, 2);
String MaturityDateMonth = reader.read(MaturityDateExp,XPathConstants.STRING).toString().substring(3, 5);
String MaturityDateYear = reader.read(MaturityDateExp,XPathConstants.STRING).toString().substring(6, 10);
String MaturityDate = MaturityDateYear+"-"+MaturityDateMonth+"-"+MaturityDateDay;


String ValueDateDay = reader.read(ValueDateExp,XPathConstants.STRING).toString().substring(0, 2);
String ValueDateMonth = reader.read(ValueDateExp,XPathConstants.STRING).toString().substring(3, 5);
String ValueDateYear = reader.read(ValueDateExp,XPathConstants.STRING).toString().substring(6, 10);
String ValueDate = ValueDateYear+"-"+ValueDateMonth+"-"+ValueDateDay;

//String ValueDate = reader.read(ValueDateExp,XPathConstants.STRING).toString();
String Currencies_ShortName = reader.read(Currencies_ShortName_Exp,XPathConstants.STRING).toString();
String NominalAmount = reader.read(NominalAmountExp,XPathConstants.STRING).toString();

System.out.println("currency"+Currencies_ShortName);
System.out.println("currency"+NominalAmount);

//POJO Function's for TRAN_MASTER_VOL column's
TranMasterClass t = new TranMasterClass();
PDSConnection pdsc = new PDSConnection(); <b> //here im creating object for above class </b>

try {
Statement stmt = pdsc.getConnection().createStatement();
ResultSet rs = stmt.executeQuery
("select AS_OF_DATE,TMV_TS_1_TERM,TMV_TS_2_TERM,TMV_TS_3_TERM,TMV_1_PERC"
+ " from OFDM_ODS.TRAN_MASTER_VOL where TMV_UTIL_ID = 'F58' AND "
+ "TMV_CRNCY_1_CODE = '"+Currencies_ShortName+"' and AS_OF_DATE in (select max(AS_OF_DATE) "
+ "from OFDM_ODS.TRAN_MASTER_VOL)");

while(rs.next())
{
t.setAS_OF_DATE(rs.getString("AS_OF_DATE").substring(0, 10));
t.setTMV_1_PERC(rs.getBigDecimal("TMV_1_PERC"));
t.setTMV_TS_1_TERM(rs.getString("TMV_TS_1_TERM"));
t.setTMV_TS_2_TERM(rs.getString("TMV_TS_2_TERM"));
t.setTMV_TS_3_TERM(rs.getString("TMV_TS_3_TERM"));
}
//Close the Connection.
rs.close();
stmt.close();
pdsc.closeConnection();

Calendar sysDate= Calendar.getInstance();
Calendar iAsOfDate = (GregorianCalendar)sysDate.clone();
Calendar iMaturityDate = (GregorianCalendar)sysDate.clone();
t.formatDate(t.getAS_OF_DATE(),iAsOfDate);
t.formatDate(MaturityDate, iMaturityDate);

if (t.getTMV_TS_1_TERM() <= t.DateDiff(MaturityDate,t.getAS_OF_DATE()) && t.DateDiff(MaturityDate,t.getAS_OF_DATE()) < t.getTMV_TS_2_TERM())
{
TMV_PERC = t.getTMV_1_PERC();
}
else if(t.DateDiff(MaturityDate,t.getAS_OF_DATE()) < 1)
{
TMV_PERC = new BigDecimal(0);
}
else if(t.DateDiff(MaturityDate,t.getAS_OF_DATE()) > t.getTMV_TS_3_TERM())
{
TMV_PERC = new BigDecimal(t.getTMV_TS_3_TERM());
}
else
{
TMV_PERC = new BigDecimal(t.getTMV_TS_1_TERM());
System.out.println("Maturity Date: "+MaturityDate+" Value Date: "+ValueDate+" TMV_PERC => "+TMV_PERC+":"+"Nominal Amount => "+NominalAmount+":"+new BigDecimal(365.25)+"<>"+t.DateDiff(MaturityDate,t.getAS_OF_DATE())+"<>"+t.DateDiff(MaturityDate, ValueDate));
}
} catch (SQLException ex) {
Logger.getLogger(ServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("SQL EXCEPTION: "+ex);
}

System.out.println("Maturity Date: "+MaturityDate+" Value Date: "+ValueDate+" TMV_PERC => "+TMV_PERC+":"+"Nominal Amount => "+NominalAmount+":"+new BigDecimal(365.25)+"<>"+t.DateDiff(MaturityDate,t.getAS_OF_DATE())+"<>"+t.DateDiff(MaturityDate, ValueDate));
BigDecimal a = TMV_PERC.multiply(new BigDecimal(NominalAmount)).multiply(new BigDecimal(t.DateDiff(MaturityDate,ValueDate))).divide(new BigDecimal(365.25),2, RoundingMode.HALF_UP);
ar.setDealId(DealId);
ar.setDealTable(DealTable);
ar.setAddonAmount(a.toString());
ar.setAddonCurrency(NPVCurrency);
ar.setNPVAmount(NPVAmount);
ar.setNPVCurrency(NPVCurrency);
}
else
{
addonAmt = "0";
ar.setDealId(DealId);
ar.setDealTable(DealTable);
ar.setAddonAmount(addonAmt);
ar.setAddonCurrency(NPVCurrency);
ar.setNPVAmount(NPVAmount);
ar.setNPVCurrency(NPVCurrency);
}

m.setAddonResponseStatus(ar);

return m;
}

}

And im getting the following error
-----------------------------------------


Connection obtained from UniversalConnectionPool

Nov 13, 2011 4:31:47 PM com.sun.xml.ws.server.sei.EndpointMethodHandler invoke
SEVERE: oracle.jdbc.driver.ScrollRsetStatement
java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement
at java.lang.reflect.Proxy.defineClass0(Native Method)
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:515)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:592)
at oracle.ucp.jdbc.proxy.StatementProxyFactory.createStatementProxy(StatementProxyFactory.java:98)
at oracle.ucp.jdbc.proxy.ConnectionProxyFactory.proxyInvokeAfterTargetInvoke(ConnectionProxyFactory.java:133)
at oracle.ucp.jdbc.proxy.JDBCConnectionProxyFactory.invoke(JDBCConnectionProxyFactory.java:221)
at $Proxy49.createStatement(Unknown Source)
at sa.com.alfransi.service.ServiceImpl.addon(ServiceImpl.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:155)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:189)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
at java.security.AccessController.doPrivileged(AccessController.java:279)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:727)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:810)

<b>NOTE: It is working in localhost but it shows the above error when i upload to server. If you see this error clearly it confirms that it is successful in database connection , but failed in Resultset navigation.</b>

Versions used in both localhost and server:

Sun JDK 1.5.0
Apache tomcat 6.0.18
Oracle version 10g

And i tried with below list of jar files but still shows same error:

Metro 2.0.jar (for webservice)
ucp.jar (Universal connection pool API - tried with latest version)

following is the list of jdbc driver's tried with the above jars
ojdbc14.jar
ojdbc6.jar
ojdbc5.jar
oracle10gjdbc1_4.jar


please help me....thanks - Fareed
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Hello Abdul Fareed, Welcome to the JavaRanch.

Which jar driver version are you using?

PS.: Could you edit your post and wrap your code with the code tags?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Abdul Fareed
Greenhorn

Joined: Nov 13, 2011
Posts: 2
hi please check the above post.....i updated it....thanks
Vas Golla
Greenhorn

Joined: Aug 09, 2007
Posts: 8
Hi,
I have started to use UCP recently, so I may not be able to answer your question. But I have a question though. Is UCP stable in terms of threading. I see an army of threads created every 30 sec. This 30 sec is the propertyCycle setting.

So the threads gets spun so huge a number that if my connections are in pool even then they create these UP-worker-threads.

Any idea or suggestions?

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: I got java.lang.IllegalAccessError: oracle.jdbc.driver.ScrollRsetStatement when trying to use UCP