Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] ClassCast on parsing virtualHosts

While I am not an expert on this topic, I guess the problem arises from

<Array type="java.lang.String">
...
</Array>

To fix the issue, first thing I would try is to omit the 'type' attribute, so it reads:

<Array>
  <Item>example.com</Item>
</Array>

From my understanding (which is close to nothing) Jetty XML then would
not try to parse the Array Items to a string but use the bare generic org.eclipse.jetty.xml.XmlParser$Node class.

From my quick look at the sources, it could also be a 'special border
case'. To verify, could you just try inserting another item? Like so

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war">/opt/nexus-2.6.3.war</Set>
  <Set name="virtualHosts">
     <Array type="java.lang.String">
       <Item>example.com</Item>
       <Item>example.org</Item>
     </Array>
  </Set>
</Configure>

Hope this helps.

- Andreas

------ Originalnachricht ------
Von: "Jan Bartel" <janb@xxxxxxxxxxx>
An: "JETTY user mailing list" <jetty-users@xxxxxxxxxxx>
Gesendet: 01.12.2013 23:47:06
Betreff: Re: [jetty-users] ClassCast on parsing virtualHosts
Rafal,

Check your 2nd line of the xml config file is the right version for
jetty-9.x. It should be:

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd";>

Jan

On 2 December 2013 05:50, Rafał Krupiński <r.krupinski+jetty@xxxxxxxxx> wrote:
 Hi

 I'm trying to setup a virtual hosts on my jetty 9 based on these
 instructions:
http://www.eclipse.org/jetty/documentation/current/configuring-virtual-hosts.html

 this is my webapp.xml:

 <Configure class="org.eclipse.jetty.webapp.WebAppContext">
     <Set name="contextPath">/</Set>
     <Set name="war">/opt/nexus-2.6.3.war</Set>
     <Set name="virtualHosts">
         <Array type="java.lang.String">
             <Item>example.com</Item>
         </Array>
     </Set>
 </Configure>

 and it causes this error to appear in logs:

2013-12-01 18:29:13.097:WARN:oejx.XmlConfiguration:main: Config error at
 <Set name="virtualHosts">|??<Array
type="java.lang.String">|???<Item>example.com</Item>|??</Array>|?</Set>
 java.lang.ClassCastException: java.lang.String cannot be cast to
 org.eclipse.jetty.xml.XmlParser$Node in
 file:/usr/local/share/jetty9/webapps/nexus.xml
2013-12-01 18:29:13.097:WARN:oejd.DeploymentManager:main: Unable to reach
 node goal: started
 java.lang.ClassCastException: java.lang.String cannot be cast to
 org.eclipse.jetty.xml.XmlParser$Node
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newArray(XmlConfiguration.java:872)
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1129)
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:457)
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
         at
org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354)
         at
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
         at
org.eclipse.jetty.deploy.providers.WebAppProvider.createContextHandler(WebAppProvider.java:290) at org.eclipse.jetty.deploy.App.getContextHandler(App.java:100)
         at
org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:36)
         at
org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)
         at
org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:495)
         at
org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146)
         at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:175)
         at
org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64) at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:605)
 ...


 Please help.

 --
 Pozdrawiam
 Rafał Krupiński

 _______________________________________________
 jetty-users mailing list
 jetty-users@xxxxxxxxxxx
 https://dev.eclipse.org/mailman/listinfo/jetty-users




--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top