javax.naming.NameNotFoundException - jndiName
javax.naming.NameNotFoundException - jndiName
我想从码头切换到 tomcat。我得到 NameNotFoundException 因为 tomcat 没有找到 jndiName 是在 jetty-web.xml 和在 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>
部分码头-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>
我知道 jetty-web.xml 在所有文件之后加载。
谁能帮帮我?
- jetty-web.xml部署在WEB-INF
- applicationContext.xmk 部署在 WEB-INF/classes/spring
我将资源添加到 tomcat context.xml
并解决了问题。
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"
/>
但我喜欢在自定义路径中使用我的 context.xml,如果可能的话
我想从码头切换到 tomcat。我得到 NameNotFoundException 因为 tomcat 没有找到 jndiName 是在 jetty-web.xml 和在 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>
部分码头-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>
我知道 jetty-web.xml 在所有文件之后加载。
谁能帮帮我?
- jetty-web.xml部署在WEB-INF
- applicationContext.xmk 部署在 WEB-INF/classes/spring
我将资源添加到 tomcat context.xml
并解决了问题。
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"
/>
但我喜欢在自定义路径中使用我的 context.xml,如果可能的话