Simply put. I want to have a oracle jndi dataSource available for webapp with connection pooling.I want to maven install the project, then manually deploy it to jetty hightide 7.xx server and run. I put a jetty-env file in WEB-INF folder as following.
<!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>
And this is my 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 install is fine but when I deploy to jetty server and up it, I get the following error.
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)
I have done the necessary changes in jetty-plus.xml and start.ini. Is there anything I want to add in pom file.most posts suggest maven-jetty-plugin but that is good only if u use jetty-run command right? Please help me.
One of my friends sorted out that the problem was there were some jetty dependencies such as jetty-jsp, jetty-all-server. When exclude them and remove those jars from libs folder, this error no longer persisted.