Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:51:21+00:00 2026-06-17T08:51:21+00:00

I am getting an Illegal Argument Exception when I try to use javax.sql.DataSource to

  • 0

I am getting an “Illegal Argument Exception” when I try to use javax.sql.DataSource to execute a stored procedure from spring based application

The stack trace is as follows.

Caused by: org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract java.sql.Connection javax.sql.DataSource.getConnection() throws java.sql.SQLException] on target [com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource@4582a8fc]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy115.getConnection(Unknown Source)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
    at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
    at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
    ... 45 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
    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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    ... 56 more

The source code is as follows.

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

import javax.sql.DataSource;

import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;

import org.apache.log4j.Logger;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.object.StoredProcedure;


public class CERBulkUploadSP extends StoredProcedure{

    private final Logger log = Logger.getLogger(this.getClass().getName());

    public CERBulkUploadSP(DataSource dataSource, String storedProcName) {

        // Run the Parent
        super(dataSource, storedProcName);

        if (log.isInfoEnabled()) {
            log.info("CERA Processes Stored Procedure Name : "+ storedProcName);
        }

        // Declare the Parameter Details
        declareParameter(new SqlParameter("THE_ARRAY", Types.ARRAY, "CER.GL_ENTRY_TYPE_ARRAY"));
        declareParameter(new SqlParameter("INCIDENT_DIM_ID", Types.NUMERIC));
        declareParameter(new SqlParameter("INS_USER", Types.VARCHAR));
        declareParameter(new SqlOutParameter("P_STATUS", Types.VARCHAR));

        // Compile the SP
        compile();
    }

    public boolean execute(final BaseViewBean baseViewBean$Session, final long incidentDimId, final String loginUser, final String identifier) throws Exception {

        boolean returnVal = false;
        Map<String, Object> inParams = new HashMap<String, Object>();
        log.info("Setting up the Stored Procedure Params");

        inParams.put("THE_ARRAY", new SqlTypeValue() {
            public void setTypeValue(PreparedStatement cs, int index, int sqlType, String typeName) throws SQLException {
                Connection con = cs.getConnection();
                ArrayDescriptor des = ArrayDescriptor.createDescriptor("CER.GL_ENTRY_TYPE_ARRAY", con);
                ARRAY a = new ARRAY(des, con, baseViewBean$Session.getExcelRecLst().toArray());
                cs.setObject(1, (Object)a);
            }
        });
        inParams.put("INCIDENT_DIM_ID", incidentDimId);
        inParams.put("INS_USER", loginUser);
        inParams.put("P_STATUS", identifier);

        if (log.isDebugEnabled()) {
            log.debug("Executing the CERA Stored Procedure ");
        }

        Map out = execute(inParams);

        log.info("output size is --------------------->>>>>>>>>> "+out.size());
        for(Object o : out.keySet()){
            log.info((String)out.get(o));
            returnVal = Boolean.parseBoolean((String)out.get(o));
        }

        if (log.isDebugEnabled()) {
            log.info("Output from CERA Stored Procedure :" + out);
        }
        return returnVal;
    }
}

bean definition is as follows.

<bean id="cerBulkUploadSp" class="com.****.CERBulkUploadSP">
    <constructor-arg index="0">
        <ref bean="ceraDataSource" />
    </constructor-arg>
    <constructor-arg index="1">
        <value>CER.GL_PROCESS_BULK_ENTRIES</value>
    </constructor-arg>      
</bean>

<bean id="processDao" class="com.****.ProcessDaoImpl">
        <property name="storedProcedure">
            <ref bean="cerBulkUploadSp"/>
        </property>
        <property name="hibernateTemplate" > <ref bean="ceraHibernateTemplate"/></property>
    </bean>

classpath:com/*****/hibernate

    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.use_sql_comments">true</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.jdbc.batch_size">20</prop>
            <prop key="hibernate.cache.use_second_level_cache">true</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> 
        </props>
    </property>

    <property name="dataSource"> <ref bean="ceraDataSource" />
    </property>
</bean> 

My JNDI configuration is as follows.

<bean id="ceraDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>jdbc/CERDS</value>
    </property>
    <property name="lookupOnStartup">
        <value>false</value>
    </property>
    <property name="cache">
        <value>true</value>
    </property>
    <property name="proxyInterface">
        <value>javax.sql.DataSource</value>
    </property>
</bean>

The jars in my classpath are as follows.

JaxrpcComponent300V5.jar                        
ajaxtags-1.2-beta3.jar                          
ajaxtags-1.3-beta-rc7.jar                       
antlr.jar                                       
aopalliance.jar                                 
asm-commons.jar                                 
asm-util.jar                                    
asm.jar                                         
aspectjrt.jar                                   
aspectjweaver.jar                               
bsf.jar                                         
castor-anttasks.jar                             
castor-codegen.jar                              
castor-xml.jar                                  
cglib-nodep-2.1_3.jar                           
classes12.jar                                   
commons-beanutils.jar                           
commons-chain.jar                               
commons-codec.jar                               
commons-collections.jar                         
commons-dbcp.jar                                
commons-digester.jar                            
commons-fileupload.jar                          
commons-httpclient.jar                          
commons-io.jar                                  
commons-jxpath.jar                              
commons-lang.jar                                
commons-logging.jar                             
commons-pool.jar                                
commons-validator.jar                           
displaytag-1.2.jar                              
displaytag-export-poi-1.2.jar                   
displaytag-portlet-1.2.jar                      
dom4j-1.5.2.jar                                 
dom4j-1.6.1.jar                                 
ehcache.jar                                     
ejb3-persistence.jar                            
hibernate-annotations.jar                       
hibernate-entitymanager.jar                     
hibernate-validator.jar                         
hibernate3.jar                                  
ibatis.jar                                      
jakarta-oro.jar                                 
jamon.jar                                       
javassist.jar                                   
jaxb-api.jar                                    
jboss-archive-browsing.jar                      
jericho-html-2.4.jar                            
jsr173_1.0_api.jar                              
jta.jar                                         
juh-3.2.1.jar                                   
juh.jar                                         
jurt-3.2.1.jar                                  
jurt.jar                                        
list.txt                                        
log4j.jar                                       
mvel.jar                                        
poi-3.8-20120326.jar                            
poi-excelant-3.8-20120326.jar                   
poi-ooxml-3.8-20120326.jar                      
poi-ooxml-schemas-3.8-20120326.jar              
poi-scratchpad-3.8-20120326.jar                 
psecWsClient500.jar                             
quartz-all.jar                                  
ridl.jar                                        
spring-agent.jar                                
spring-aop.jar                                  
spring-aspects.jar                              
spring-beans.jar                                
spring-context-support.jar                      
spring-context.jar                              
spring-core.jar                                 
spring-jdbc.jar                                 
spring-jms.jar                                  
spring-mock.jar                                 
spring-modules-validation.jar                   
spring-orm.jar                                  
spring-security-acl.jar                         
spring-security-catalina.jar                    
spring-security-core-tiger.jar                  
spring-security-core.jar                        
spring-security-ntlm.jar                        
spring-security-openid.jar                      
spring-security-portlet.jar                     
spring-security-taglibs.jar                     
spring-tomcat-weaver.jar                        
spring-tx.jar                                   
spring-web.jar                                  
spring-webmvc-portlet.jar                       
spring-webmvc-struts.jar                        
spring-webmvc.jar                               
struts-core.jar                                 
struts-el.jar                                   
struts-extras.jar                               
struts-faces.jar                                
struts-scripting.jar                            
struts-taglib.jar                               
struts-tiles.jar                                
unoil.jar                                       
unoloader.jar                                   
urlprocessingfilter300V5.jar                    
velocity.jar                                    
xbean.jar                                       
xerces-2.2.1.jar

When is run the app locally hosting it on tomcat and representing the datasource as oracle connection it works well, but when i deploy the code onto Websphere server where all our apps are hosted, i run into this problem. Can anyone please let me know how to resolve the same?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:51:22+00:00Added an answer on June 17, 2026 at 8:51 am

    You have old Oracle JDBC drivers in your classpath: classes12.jar. This is for Oracle 10.2 and JDK 1.2/1.3 – I doubt this is your environment. Possibly also other JARs might contain javax.sql.* classes (don’t know them all).

    Did you by any chance also switch the WebSphere Classloader mode from PARENT_FIRST (default) to PARENT_LAST?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doesn't meter what string I pass to parse I'm always getting Illegal Argument exception
I'm a noob to android. and I am getting an illegal argument exception when
I'm getting illegal use of floating point error on compiling the following program. Please
Why do I keep on getting an exception-illegal operation on ResultSet? Here is the
This is the error i'm getting when i try to run my application Illegal
I'm getting the following exception when I try to run my HQL query: java.util.concurrent.ExecutionException:
I'm getting an Illegal characters in path error while using XMLTextReader method. Basically, I'm
I am getting an illegal start of type error at the first nested if
I'm getting the error Illegal access to loading collection when I'm trying to get
I am writing a task's trigger and getting an error in salesforce Illegal polymorphic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.