javax.naming.NameNotFoundException-jndiName
我想从jetty换成tomcat。我得到了NameNotFoundException,因为tomcat没有在jetty-web.xml中找到jndiName,该jndiName在applicationContext.xml中使用 my applicationContext.xml的一部分:javax.naming.NameNotFoundException-jndiName,java,tomcat,jetty,applicationcontext,Java,Tomcat,Jetty,Applicationcontext,我想从jetty换成tomcat。我得到了NameNotFoundException,因为tomcat没有在jetty-web.xml中找到jndiName,该jndiName在applicationContext.xml中使用 my applicationContext.xml的一部分: <bean id="clarityDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="i
<bean id="clarityDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" depends-on="i18nFactoryProvider">
<property name="jndiName" value="java:comp/env/jdbc/clarityDS"/>
</bean>
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>
java:comp/env/jdbc/clarityDS
真的
克拉提兹
我知道jetty-web.xml会加载所有文件
有人能帮我吗
- 部署在web-INF中的jetty-web.xml
- 部署在WEB-INF/classes/spring中的applicationContext.xmk
context.xml添加了资源,并解决了这个问题
但如果可能的话,我喜欢在自定义路径中使用context.xml
<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"
/>