简单地说。我希望有一个oracle jndi dataSource可用于带有连接池的webapp。我想要maven安装项目,然后手动将它部署到jetty hightide 7.xx服务器并运行。我将一个jetty-env文件放在WEB-INF文件夹中,如下所示。
<!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>
这是我的dataSource 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安装很好,但是当我部署到jetty服务器并向上部署时,我收到以下错误。
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命令时这才有用吗?请帮帮我。
答案 0 :(得分:0)
我的一位朋友说明问题是有一些码头依赖,比如jetty-jsp,jetty-all-server。排除它们并从libs文件夹中删除这些jar时,此错误不再保留。