Lucee 5 on Jetty 9.3.x - Multiple Contexts

217 views
Skip to first unread message

Andrew Penhorwood

unread,
Apr 20, 2016, 10:40:52 PM4/20/16
to Lucee
New issue with Jetty and Lucee 5.

I have it working fine with one WebAppContext but as soon as I add the second things stop working.  The first context initializes but the second gets this error:

2016-04-20 22:23:59.483:WARN:oejw.WebAppContext:Scanner-0: Failed startup of context o.e.j.w.WebAppContext@6e22b6c3{/,file:///D:/$rootBoaz/chooseyou/,null,chooseyouthisday.local}
java.lang.IllegalArgumentException: name
        at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:658)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:188)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
        at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
        at org.eclipse.jetty.util.resource.Resource.newSystemResource(Resource.java:240)
        at org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:50)
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:480)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:516)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileChanged(ScanningAppProvider.java:198)
        at org.eclipse.jetty.deploy.providers.WebAppProvider.fileChanged(WebAppProvider.java:415)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:70)
        at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:664)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:532)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
        at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:329)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

Now the strange thing is all most of these config files come directly from Lucee 4.5 and Jetty 9.3.x where they have worked for years.

Andrew Penhorwood

Andrew Penhorwood

unread,
Apr 27, 2016, 6:57:32 AM4/27/16
to Lucee
Is anyone running Jetty 9.3.x, Lucee 5.x and multiple contexts?  When I add the 2nd context that points to / as the context path Jetty stops deploying contexts.  The first context runs fine but nothing else.

With the same version of Jetty but Lucee 4.5.x all of my contexts run fine.

Andrew Penhorwood

Andrew Penhorwood

unread,
Apr 29, 2016, 8:01:30 AM4/29/16
to Lucee
This is a stack from a Jetty 9.3.8 - Java 1.8.0_77 - Lucee 5.0.0.235 with a second context defined.  If I remove the Lucee servlet then both context run fine and serve up HTML pages.  

java.lang.IllegalArgumentException: name
        at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:658)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:188)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
        at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
        at org.eclipse.jetty.util.resource.Resource.newSystemResource(Resource.java:240)
        at org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:50)
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:480)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:516)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
        at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:458)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
        at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
        at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:405)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:372)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1510)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1435)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:214)
        at org.eclipse.jetty.start.Main.start(Main.java:457)
        at org.eclipse.jetty.start.Main.main(Main.java:75)



Context Config.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="bench" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="resourceBase">C:/webRoot/bench</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="virtualHosts">
<Array type="String">
<Item>bench.local</Item>
</Array>
</Set>
</Configure>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="clayton" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="resourceBase">C:/webRoot/clayton</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="virtualHosts">
<Array type="String">
<Item>localhost</Item>
</Array>
</Set>
</Configure>

Andrew Penhorwood

unread,
May 2, 2016, 7:38:53 AM5/2/16
to Lucee
Can I consider this a bug in Lucee 5?  Is anyone else having this same problem with Jetty 9.3.x?  Does anyone have insight into why this is not working?

Any help would be greatly appreciated.

Peter Boughton

unread,
May 22, 2016, 5:40:58 PM5/22/16
to Andrew Penhorwood, Lucee
So I've spent the weekend looking into multiple contexts on Jetty and whilst I still don't know what the root cause is, I've at least got things running.

From what I can tell, something with Lucee 5 (probably OSGI/Felix) manages to break something in Jetty's classloader and results in it (presumably) trying to treat the drive letter in a Windows path as a protocol. (The issue doesn't appear on Linux - multiple contexts work there.)

The failure is when trying to get webdefault.xml - the first context's call to it works because it's before Lucee is loaded - but when Jetty tries to setup the second context, Lucee/Felix have apparently done something so that if the context's defaultsDescriptor property starts with a drive letter it fails.

Workaround is to set defaultsDescriptor in the context config to be either relative or to use file URI:

<Set name="defaultsDescriptor">./etc/webdefault.xml</Set>
<Set name="defaultsDescriptor">file:///S:/path/to/lucee-base/etc/webdefault.xml</Set>


I wanted to test running Lucee with Felix 5.0 or 5.4 to see if they solve anything (there's at least one known bug in Felix 4.6 which affects Jetty; doesn't seem related but still worth trying latest version anyway), however the build files in the Lucee repo appear to be broken.

Andrew Penhorwood

unread,
May 22, 2016, 8:51:33 PM5/22/16
to Lucee, penho...@gmail.com, lu...@sorcerersisle.com
Thanks!!!

Andrew Penhorwood

Andrew Penhorwood

unread,
May 23, 2016, 7:24:25 AM5/23/16
to Lucee, penho...@gmail.com, lu...@sorcerersisle.com
Workaround is to set defaultsDescriptor in the context config to be either relative or to use file URI:

    <Set name="defaultsDescriptor">./etc/webdefault.xml</Set>
    <Set name="defaultsDescriptor">file:///S:/path/to/lucee-base/etc/webdefault.xml</Set>

On my test setup the defaultsDescriptor is already using a relative path but I have a resourceBase that is using a windows path.

<Set name="resourceBase">C:/webRoot/clayton</Set>

I assume that the same issue is being triggered here.  Can you tell if the issue is with Jetty or Lucee?

Andrew Penhorwood
 

Peter Boughton

unread,
May 23, 2016, 5:57:46 PM5/23/16
to Andrew Penhorwood, Lucee
> I assume that the same issue is being triggered here

Perhaps, although there's nothing in my logs to suggest resourceBase is
sent through getResource.

Still, if it works with "file:///C:/webRoot/clayton" then it's at least
similar if not the same thing.


> Can you tell if the issue is with Jetty or Lucee?

Not conclusively - my suspicion is Lucee/Felix, but without being able
to build Lucee I can't try the latest Felix release nor add debug calls
to relevant bits of code, so I'm stuck unless someone can say how the
build process is supposed to work.

Andrew Penhorwood

unread,
May 26, 2016, 7:21:16 AM5/26/16
to Lucee, penho...@gmail.com, lu...@sorcerersisle.com
The file:/// workaround did not work on my Jetty windows installation.  Below is the error produced.

I will grab the latest version of Lucee 5 and see if that make a difference.



2016-05-26 07:18:16.938:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@5d5eef3d{/,file:///C:/webRoot/clayton/,AVAILABLE,localhost}
2016-05-26 07:18:16.953:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@288ca5f0{/,file:///C:/webRoot/bench/,null,bench.local}
2016-05-26 07:18:17.109:INFO:oejs.ServerConnector:main: Started ServerConnector@bbed90d{HTTP/1.1,[http/1.1]}{0.0.0.0:80}
2016-05-26 07:18:17.125:INFO:oejus.SslContextFactory:main: x509=X509@5d43409a(jetty,h=[jetty.eclipse.org],w=[]) for SslContextFactory@38d17d80(file:///C:/servers/jettyBase/etc/keystore,file:///C:/serv
ers/jettyBase/etc/keystore)
2016-05-26 07:18:17.125:INFO:oejus.SslContextFactory:main: x509=X509@6ede46f6(mykey,h=[],w=[]) for SslContextFactory@38d17d80(file:///C:/servers/jettyBase/etc/keystore,file:///C:/servers/jettyBase/etc
/keystore)
2016-05-26 07:18:17.265:INFO:oejs.ServerConnector:main: Started ServerConnector@6ae62c7e{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
2016-05-26 07:18:17.265:INFO:oejs.Server:main: Started @13884ms

Andrew Penhorwood

unread,
May 26, 2016, 8:06:01 AM5/26/16
to Lucee, penho...@gmail.com, lu...@sorcerersisle.com
Downloaded latest Lucee-5.0.0.252.jar which produced the same error.

2016-05-26 08:01:19.227:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@2b98c310{/,file:///C:/webRoot/bench/,null,bench.local}
java.lang.IllegalArgumentException: name
        at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:658)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:188)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
        at java.security.AccessController.doPrivileged(Native Method)

The stacktrace continues but it is basically the same as the other one I posted. 

Ryan Crutchfield

unread,
Oct 25, 2016, 2:13:07 PM10/25/16
to Lucee, penho...@gmail.com, lu...@sorcerersisle.com
I know it has been awhile, but has anybody figured this out?  Below are my two context xmls and error with second context. I tried adding file:/// all over the place but that didn't help. 

Jetty version jetty-9.3.13.v20161014
Lucee version 5.1.0.34

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">

<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>./etc/lucee-servlets.xml</Set>
<Set name="resourceBase"><SystemProperty name="jetty.base" default="."/>./webapps/ROOT/</Set>
        <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>./etc/webdefault.xml</Set>
    
<Set name="virtualHosts">
<Array type="String">
<Item>localhost</Item>
</Array>
</Set>

</Configure>

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">

<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>./etc/lucee-servlets.xml</Set>
<Set name="resourceBase"><SystemProperty name="jetty.base" default="."/>./webapps/ROOT2/</Set>
        <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>./etc/webdefault.xml</Set>
    
<Set name="virtualHosts">
<Array type="String">
<Item>127.0.0.1</Item>
</Array>
</Set>

</Configure>



2016-10-25 13:38:33.612:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@464bee09{/,file:///C:/Users/rcrutchfield/Desktop/lucee-iss/lucee-base/webapps/ROOT/,AVAILABLE,localhost}
2016-10-25 13:38:33.652:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@705f83a7{/,file:///C:/Users/rcrutchfield/Desktop/lucee-iss/lucee-base/webapps/ROOT2/,null,127.0.0.1}
java.lang.IllegalArgumentException: name
at sun.misc.URLClassPath$Loader.findResource(Unknown Source)
at sun.misc.URLClassPath.findResource(Unknown Source)
at java.net.URLClassLoader$2.run(Unknown Source)
at java.net.URLClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(Unknown Source)
at java.lang.ClassLoader.getResource(Unknown Source)
at org.eclipse.jetty.util.resource.Resource.newSystemResource(Resource.java:241)
at org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:50)
at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:483)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:519)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:458)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.server.Server.start(Server.java:411)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:378)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1516)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1441)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:214)
at org.eclipse.jetty.start.Main.start(Main.java:457)
at org.eclipse.jetty.start.Main.main(Main.java:75)

thanks
Reply all
Reply to author
Forward
0 new messages