I want to switch from jetty to tomcat. I get NameNotFoundException because tomcat not found jndiName that is in jetty-web.xml and used in applicationContext.xml.
part of my applicationContext.xml:
<bean id="clarityDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="i18nFactoryProvider">
<property name="jndiName" value="java:comp/env/jdbc/clarityDS"/>
</bean>
part of jetty-web.xml
<New id="clarityds" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>java:comp/env/jdbc/clarityDS</Arg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="connectionCachingEnabled">true</Set>
<Set name="dataSourceName">clarityDS</Set>
<Set name="URL"><SystemProperty name="clarityDS.url"/></Set>
<Set name="user"><SystemProperty name="clarityDS.username"/></Set>
<Set name="password"><SystemProperty name="clarityDS.password"/></Set>
</New>
</Arg>
</New>
I know that jetty-web.xml load after all files.
anyone can help me?
I add resource to tomcat context.xml
and solved problem.
Run java web apps in embedded containers with Maven, Jetty and Tomcat
<Resource
name="jdbc/clarityDS"
auth="Container"
type="javax.sql.DataSource"
driverClassName="clarity.clarityDS.driverClassName"
username="clarity.clarityDS.username"
password="clarity.clarityDS.password"
url="clarity.clarityDS.url"
/>
But i like to use my context.xml in custom path, if it's possible