Jan,

That works great!

Thank you,

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 7/14/2017 12:50 AM, Jan Bartel wrote:
Igal,

You can try simply putting: webapp.setDefaultsDescriptor("resource/web.xml"). At runtime jetty will ask the classloader to load the resource with that name, and as this resource is presumably on the container classpath it should be found. For example, jetty's default value for the default descriptor is "org/eclipse/jetty/webapp/webdefault.xml", which exists in the jetty-webapp.jar on the container classpath.

Jan

On 14 July 2017 at 07:24, Igal @ Lucee.org <i...@lucee.org <mailto:i...@lucee.org>> wrote:

    Hi Edmond,

    What happens when you run it on a Linux system?  I see the
    windows path in the exception, any chance it has something to do
    with that?

    I haven't tried to run it on Linux.  This is my development
    machine and I'm running the embedded Jetty inside IntelliJ IDEA
    IDE.  It will take me some time to set up the whole thing on a
    Linux machine, but if I can help troubleshoot the elusive Windows
    bug in any way then I'd love to help.

    Please note that the first context loads fine, but the second one
    fails.  I will try to add a 3rd context tomorrow and see if it
    also fails.

    Best,

    Igal Sapir
    Lucee Core Developer
    Lucee.org <http://lucee.org/>

    On 7/13/2017 8:40 PM, Edmond Kemokai wrote:

        Igal,

        What happens when you run it on a Linux system?  I see the
        windows path in the exception, any chance it has something to
        do with that?


        There is a bug with dynamic context loading on windows that
        has been around forever, despite multiple claims of fixes it
        has never been fixed. This is not a jetty specific issue,
        seems to do with the common implementation of dynamic context
        loading on windows.

        On Jul 13, 2017 9:11 PM, "Igal @ Lucee.org" <i...@lucee.org
        <mailto:i...@lucee.org>> wrote:

            Joakim,

            Thank you for replying.

            I tried that and it works for the first context, but for
            some reason for the second one I get the following error:

            2017-07-13 18:05:34.217:WARN:oejw.WebAppContext:main:
            Failed startup of context
            
o.e.j.w.WebAppContext@62d363ab{/,file:///E:/Workspace/git/LuceeDebug/webapps/LDEV-1369/context2/,UNAVAILABLE,localhost2.com}{E:\Workspace\git\LuceeDebug\webapps\LDEV-1369\context2}
            java.lang.IllegalArgumentException: name
                at
            sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:693)
                at
            sun.misc.URLClassPath.findResource(URLClassPath.java:215)
                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:242)
                at
            
org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:50)
                at
            
org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:506)
                at
            
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:544)
                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.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
                at
            
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
                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:452)
                at
            
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
                at
            
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
                at
            org.eclipse.jetty.server.Server.doStart(Server.java:419)
                at
            
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

            Any thoughts?

            Thanks again,

            Igal Sapir
            Lucee Core Developer
            Lucee.org <http://lucee.org/>

            On 7/13/2017 3:50 PM, Joakim Erdfelt wrote:
            Drop the following ...

            webapp.setResourceBase(resourceBase);
            webapp.setDescriptor(resourceBase + "/WEB-INF/web.xml");

            And replace it with ...

            webapp.setWar(resourceBase);

            That will address all 3 issues.


            Joakim Erdfelt / joa...@webtide.com
            <mailto:joa...@webtide.com>

            On Thu, Jul 13, 2017 at 12:01 PM, Igal @ Lucee.org
            <i...@lucee.org <mailto:i...@lucee.org>> wrote:

                I'm trying to set up a default descriptor in a
                shared place, and a specific descriptor in
                WEB-INF/web.xml

                I have two contexts, and I use the method below to
                define them.  I get the following error for the 2nd
                context (seems like the first one doesn't error):

                2017-07-13
                11:59:02.116:WARN:oejw.WebAppContext:main: Failed
                startup of context
                
o.e.j.w.WebAppContext@37cd92d6{/,file:///E:/Workspace/git/Debug/webapps/context2/,UNAVAILABLE,localhost2.com}
                java.lang.IllegalArgumentException: name
                    at
                sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:693)
                    at
                sun.misc.URLClassPath.findResource(URLClassPath.java:215)
                    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:242)
                    at
                
org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:50)
                    at
                
org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:506)
                    at
                
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:544)
                    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.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
                    at
                
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
                    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:452)
                    at
                
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
                    at
                
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
                    at
                org.eclipse.jetty.server.Server.doStart(Server.java:419)
                    at
                
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

                    /** * * @param resourceBase the path to the web root
                * @param contextPath the virtual path for the
                context, e.g. "/" * @return * @throws Exception */
                public static WebAppContext createWebAppContext(String 
resourceBase, String contextPath)throws Exception {

                       File file =new File(resourceBase);

                       resourceBase = file.getCanonicalPath();

                       if (contextPath ==null || contextPath.isEmpty())
                          contextPath ="/";

                       WebAppContext webapp =new WebAppContext();
                       webapp.setContextPath(contextPath);
                       webapp.setResourceBase(resourceBase);

                       
webapp.setConfigurationClasses(webappDefaultConfigurationClasses);

                       // Set default descriptor for all contexts
                
*webapp.setDefaultsDescriptor(DebugLucee.class.getResource("/resource/web.xml").getPath());*
                // Set app-specific descriptor at
                {webroot}/WEB-INF/web.xml        webapp.setDescriptor(resourceBase 
+"/WEB-INF/web.xml");

                       return webapp;
                    }

                    public static final 
String[]webappDefaultConfigurationClasses =new String[]{
                       "org.eclipse.jetty.webapp.WebInfConfiguration" ,"org.eclipse.jetty.webapp.WebXmlConfiguration" 
,"org.eclipse.jetty.webapp.MetaInfConfiguration" ,"org.eclipse.jetty.webapp.FragmentConfiguration" 
,"org.eclipse.jetty.annotations.AnnotationConfiguration" ,"org.eclipse.jetty.webapp.JettyWebXmlConfiguration" };

                Is it possible to achieve that?  If so, how?  Thanks!

                Igal Sapir
                Lucee Core Developer
                Lucee.org <http://lucee.org/>


                _______________________________________________
                jetty-users mailing list
                jetty-users@eclipse.org <mailto:jetty-users@eclipse.org>
                To change your delivery options, retrieve your
                password, or unsubscribe from this list, visit
                https://dev.eclipse.org/mailman/listinfo/jetty-users
                <https://dev.eclipse.org/mailman/listinfo/jetty-users>




            _______________________________________________
            jetty-users mailing list
            jetty-users@eclipse.org <mailto:jetty-users@eclipse.org>
            To change your delivery options, retrieve your password, or 
unsubscribe from this list, visit
            https://dev.eclipse.org/mailman/listinfo/jetty-users
            <https://dev.eclipse.org/mailman/listinfo/jetty-users>


            _______________________________________________
            jetty-users mailing list
            jetty-users@eclipse.org <mailto:jetty-users@eclipse.org>
            To change your delivery options, retrieve your password,
            or unsubscribe from this list, visit
            https://dev.eclipse.org/mailman/listinfo/jetty-users
            <https://dev.eclipse.org/mailman/listinfo/jetty-users>




    _______________________________________________
    jetty-users mailing list
    jetty-users@eclipse.org <mailto:jetty-users@eclipse.org>
    To change your delivery options, retrieve your password, or unsubscribe 
from this list, visit
    https://dev.eclipse.org/mailman/listinfo/jetty-users
    <https://dev.eclipse.org/mailman/listinfo/jetty-users>


    _______________________________________________
    jetty-users mailing list
    jetty-users@eclipse.org <mailto:jetty-users@eclipse.org>
    To change your delivery options, retrieve your password, or
    unsubscribe from this list, visit
    https://dev.eclipse.org/mailman/listinfo/jetty-users
    <https://dev.eclipse.org/mailman/listinfo/jetty-users>




--
Jan Bartel <j...@webtide.com <mailto:j...@webtide.com>>
www.webtide.com <http://www.webtide.com>
/Expert assistance from the creators of Jetty and CometD/



_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to