Hello everyone,
I tried to pass my web application (eclipse project) from maven 7 to
maven 9 version(9.3.7.v20160115).
I changed the necessary settings in the various files, but when
starting jetty with the eclipse jetty-maven-plugin launching the
command jetty:run
I got the error when loading the WebAppContext file specified in
jetty-env.xml:
the error message is
-------------------------------
java.lang.IllegalArgumentException: Object of class 'org.eclipse.jetty.maven.plugin.JettyWebAppContext' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders. in file:/xx/WebApp/src/main/webapp/WEB-INF/jetty-env.xml
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:295)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:245)
at org.eclipse.jetty.plus.webapp.EnvConfiguration.configure(EnvConfiguration.java:116)
-------------------------------
Following the instructions for configuring JNDI connections with
jetty i specified jetty-env.xml as follow:
<Configure id='wac' class="org.eclipse.jetty.webapp.WebAppContext">
<New id="resInspector" class="org.eclipse.jetty.plus.jndi.Resour
ce">
<Arg><Ref refid="wac"/></Arg>
<Arg>jdbc/xxx</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="url">jdbc:postgresql://xx:5432/xx</Set>
<Set name="username">xx</Set>
<Set name="password">xx</Set>
<Set name="maxActive">100</Set>
<Set name="maxIdle">30</Set>
<Set name="maxWait">-1</Set>
<Set name="defaultAutoCommit">false</Set>
</New>
</Arg>
</New>
</Configure>
any idea what is set wrong?
In the source code I see in line 292 of the class
org.eclipse.jetty.xml.XmlConfiguration in subclass
JettyXmlConfiguration the condition that an IllegalArgumentException
is thrown, when the condition oClass != null &&
!oClass.isInstance(obj) is fulfilled.
There are compared the two classesÂ
org.eclipse.jetty.maven.plugin.JettyWebAppContext and
org.eclipse.jetty.webapp.WebAppContext. The former being a subclass
of the second one.
thanks for your suggestions
Markus