This doesn't directly answer your question but I have two advices. First, now that I know that you are using Spring, I'd suggest to stop using your own ServiceLocator
to lookup the JNDI datasource as you mentioned in a previous question. Instead, you should use Spring facilities for that and then inject the datasource into yours beans. To get a JDNI datasource, use Spring's JndiObjectFactoryBean
, something like that:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:/comp/env/jdbc/myDS</value>
</property>
</bean>
Then, when running outside the container (typically when running tests), my advice would be to not use a JNDI datasource. Instead, you should use Spring facilities to provide a datasource to your DAOs in another way (e.g. using a DriverManagerDataSource
, you don't need a real connection pool when running tests). This would allow you to run your tests without having to start iPlanet which makes sense for testing (and you don't want to test iPlanet's connection pool, you want to test your DAOs).
So, create an applicationContext-test.xml
to be used during testing with another configuration for the data access. Below, a sample configuration for the DriverManagerDataSource
:
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="..."/>
<property name="url" value="..."/>
<property name="username" value="..."/>
<property name="password" value="..."/>
</bean>
This is really the recommended approach (check the chapter Data access using JDBC for more details on the different options).
PS: I have no idea from where com/iplanet/ias/admin/common/ASException
comes from but it is obviously one of iPlanet itself. If you really want to find out, search in all jars of your iPlanet install, especially the one referenced in its startup script. But I think that' you'll face JNDI issues after that, be warned.