简单的说。我想要一个可用于带有连接池的 webapp 的 oracle jndi 数据源。我想 maven 安装该项目,然后手动将其部署到 jetty hightide 7.xx 服务器并运行。我将 jetty-env 文件放在 WEB-INF 文件夹中,如下所示。
码头-env.xml
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure id="thisfile" class="org.eclipse.jetty.webapp.WebAppContext">
<New class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/jndimyds</Arg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="DriverType">thin</Set>
<Set name="URL">jdbc:oracle:thin:@localhost:1521:xe</Set>
<Set name="User">username</Set>
<Set name="Password">password</Set>
<Set name="connectionCachingEnabled">true</Set>
<Set name="connectionCacheProperties">
<New class="java.util.Properties">
<Call name="setProperty">
<Arg>MinLimit</Arg>
<Arg>5</Arg>
</Call>
<!-- put the other properties in here too -->
</New>
</Set>
</New>
</Arg>
</New>
</Configure>
数据源bean
这是我的数据源 bean..
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" >
<value>java:comp/env/jdbc/jndimyds</value>
</property>
<property name="lookupOnStartup" value="false" />
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
Maven 安装很好,但是当我部署到码头服务器并启动它时,我收到以下错误。
2012-04-19 00:42:18.962:WARN::Failed startup of context o.e.j.w.WebAppContext{/myapp,file:/C:/Users/tharinduv/AppData/Local/Temp/jetty-0.0.0.0-2080-myapp.war-_myapp-any-/webapp/},C:\jetty\webapps\myapp.war
java.lang.IllegalArgumentException: Object is not of type class org.eclipse.jetty.webapp.WebAppContext
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:203)
at org.eclipse.jetty.plus.webapp.EnvConfiguration.configure(EnvConfiguration.java:118)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:414)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.jav
a:1153)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:588)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:436)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:180)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:479)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:136)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:137)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:50)
我已经在 jetty-plus.xml 和 start.ini 中进行了必要的更改。有什么我想在 pom 文件中添加的吗?大多数帖子都建议使用 maven-jetty-plugin 但这只有在你使用 jetty-run 命令时才好?请帮我。