我想从码头换到小猫。我之所以获得NameNotFoundException,是因为tomcat没有找到jettyweb.xml中的jndiName并在applicationContext.xml中使用。
我的applicationContext.xml的一部分:
<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>
我知道jettyweb.xml在所有文件之后加载。
有人能帮我吗?
发布于 2016-10-31 07:40:59
我在tomcat context.xml
中添加了资源并解决了问题。
使用Maven、Jetty和Tomcat在嵌入式容器中运行java web应用程序
<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"
/>
但如果可能的话,我喜欢在自定义路径中使用我的context.xml
https://stackoverflow.com/questions/40326186
复制相似问题