Question

I have following in my applicaionContext.xml

<bean id="IbatisDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@123.210.85.56:1522:ORCL"/>
    <property name="username" value="mydb"/>
    <property name="password" value="mydbpwd"/>
</bean>


<bean id="myMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="configLocation" value="classpath:sql-map-config-oracle.xml"/>
  <property name="dataSource" ref="IbatisDataSource"/>
 </bean>

then in my code I have:

ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
SqlMapClient sqlclient = (SqlMapClient) ctx.getBean("myMapClient");

doing this gives me the following error:

Error creating bean with name 'myMapClient' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/iplanet/ias/admin/common/ASException

I don't understand why is it looking for that class? I am trying to do everything outside the container. So it should not even be looking for that class...but nonetheless just to make it work I tried looking for class called ASException so I could put it on the classpath but no where can I find ASException class.

Any pointers?

Images of stack trace and my compile test / run test libs alt text alt text alt text

Edit Solution: Even though I thought everything was outside the container...there was ONE thing that was not outside the container.
Notice the property configLocation:

<property name="configLocation" value="classpath:sql-map-config-oracle.xml"/>

actual content of sql-map-config-oracle.xml is

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
    <transactionManager type="JDBC">
        <dataSource type="JNDI">
            <property name="DataSource" value="my/jndi/mydb" />
        </dataSource>
    </transactionManager>
<sqlMap resource="somemapping.xml"/>
</sqlMapConfig>

JNDI stuff does not need to be there!

sql-map-config-oracle.xml should simply be:

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
        <sqlMap resource="somemapping.xml"/>
</sqlMapConfig>
Was it helpful?

Solution

You definitely have a runtime dependency issue as @Cletus said org.springframework.orm.ibatis.SqlMapClientFactoryBean was compiled with com.iplanet.ias.admin.common.ASException but now you don't have it in your classpath -- Spring can't find it. You should Look at the source for SqlMapClientFactoryBean to see where ASException is called -- Spring should have a dist with all it's dependencies in it, you can also look in there when doing your investigation.

OTHER TIPS

This class was found during compilation but not during running:

com/iplanet/ias/admin/common/ASException

So when you're running the program, it can't seem to find this class, which belongs to the Sun app or portal server that you're using. In short: it's a classpath error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top