[jetty-users] Tried to run Jetty Maven plugin in external mode, failed.
I have tried to run my weld 4/mojarra 3/ jersey using jetty maven plugin, it failed in the default deployMode(embed). I changed to use `External` today, still failed, due to the classloader issues from different classes. My Jetty Maven plugin configuration. jetty org.eclipse.jetty jetty-maven-plugin EXTERNAL 10 /${project.artifactId} ${env.JETTY_HOME} jdni,jsp,servlet,glasssfis-jstl,websocket-jakarta,cdi-decorate org.glassfish.web jakarta.servlet.jsp.jstl ${jakarta.servlet.jsp.jstl.version} provided org.glassfish jakarta.json ${jakarta.json.version} provided org.glassfish jakarta.el ${jakarta.el.version} provided And when I ran the application: mvn clean package jetty:run-war -Pjetty And the got the following error. 2021-04-04 12:35:44.000:WARN :oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.MavenWebAppContext@a82c5f1 {/jakartaee9-servlet-starter-boilerplate,[file:///D:/hantsylabs/jak artaee9-servlet-starter-boilerplate/target/jakartaee9-servlet-starter-boilerplate/, jar:file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jakartaee9-servlet-starter-b oilerplate/WEB-INF/lib/jakarta.faces-3.0.0.jar!/META-INF/resources],UNAVAILABLE}{D:\hantsylabs\jakartaee9-servlet-starter-boilerplate\target\jakartaee9-servlet-starter-boilerplate.war} java.lang.LinkageError: loader constraint violation: when resolving interface method 'void jakarta.servlet.jsp.JspApplicationContext.addELResolver(jakarta.el.ELResolver)' the class loa der org.eclipse.jetty.webapp.WebAppClassLoader @68dc098b of the current class, org/jboss/weld/environment/servlet/WeldServletLifecycle, and the class loader org.eclipse.jetty.start.Cla sspath$Loader @3043fe0e for the method's defining class, jakarta/servlet/jsp/JspApplicationContext, have different Class objects for the type jakarta/el/ELResolver used in the signatur e (org.jboss.weld.environment.servlet.WeldServletLifecycle is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @68dc098b, parent loader org.eclipse.jetty.start.Cl asspath$Loader @3043fe0e; jakarta.servlet.jsp.JspApplicationContext is in unnamed module of loader org.eclipse.jetty.start.Classpath$Loader @3043fe0e, parent loader 'app') at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:221) at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:62) at org.eclipse.jetty.servlet.ServletContainerInitializerHolder.doStart(ServletContainerInitializerHolder.java:148) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:171) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) at org.eclipse.jetty.servlet.ServletContextHandler$ServletContainerInitializerStarter.doStart(ServletContextHandler.java:1660) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:369) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1304) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:880) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:306) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:532) at org.eclipse.jetty.maven.plugin.MavenWebAppContext.doStart(MavenWebAppContext.java:294) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93) at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:40) at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183) at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:516) at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:151) at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:169) at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:439) at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:57) at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:756) at
Re: [jetty-users] Weld 4+ Jersey3+ Mojarra3 + Jetty Maven plugin start failed.
It seems too old, I rarely used Jetty in projects. I tried the way in the article in the above and weld doc, some config are out of data due to property not found or class not found etc. I think jetty is changed too frequently. *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy On Sat, Apr 3, 2021 at 11:14 PM Som Lima wrote: > Have you seen this article, it may have resolution for you. > > https://github.com/jetty-project/weld-example-base/issues/1 > > > > On Sat, 3 Apr 2021, 15:20 hantsy bai, wrote: > >> Hi everybody, >> >> Currently, I am working on a template project for servlet 5.0, >> >> https://github.com/hantsy/jakartaee9-servlet-starter-boilerplate >> >> Firstly I want to run the application via cargo maven plugin(tomat) and >> jetty maven plugin .but encountered an issue with configuring Jetty maven >> plugin. >> >> When running the following command and failed. >> >> > >mvn clean package jetty:run-war -Pjetty >> >> Apr 03, 2021 10:04:58 PM >> org.jboss.weld.environment.servlet.WeldServletLifecycle initialize >> INFO: WELD-ENV-001001: No supported servlet container detected, CDI >> injection will NOT be available in Servlets, Filters or Listeners >> [WARNING] Failed startup of context o.e.j.m.p.MavenWebAppContext@c79780 >> {/jakartaee9-servlet-starter-boilerplate,[file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jak >> artaee9-servlet-starter-boilerplate/, >> jar:file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jakartaee9-servlet-starter-boilerplate/WEB-INF/lib/jakarta.faces-3.0.0.jar >> >> !/META-INF/resources],UNAVAILABLE}{D:\hantsylabs\jakartaee9-servlet-starter-boilerplate\target\jakartaee9-servlet-starter-boilerplate.war} >> java.lang.LinkageError: loader constraint violation: when resolving >> interface method 'void >> jakarta.servlet.jsp.JspApplicationContext.addELResolver(jakarta.el.ELResolver)' >> the class loa >> der org.eclipse.jetty.webapp.WebAppClassLoader @51c6e775 of the current >> class, org/jboss/weld/environment/servlet/WeldServletLifecycle, and the >> class loader org.codehaus.plexus.classwo >> rlds.realm.ClassRealm @cef885d for the method's defining class, >> jakarta/servlet/jsp/JspApplicationContext, have different Class objects for >> the type jakarta/el/ELResolver used in the s >> ignature (org.jboss.weld.environment.servlet.WeldServletLifecycle is in >> unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader >> @51c6e775, parent loader org.codehaus.plexus >> .classworlds.realm.ClassRealm @cef885d; >> jakarta.servlet.jsp.JspApplicationContext is in unnamed module of loader >> org.codehaus.plexus.classworlds.realm.ClassRealm @cef885d, parent loade >> r 'bootstrap') >> >> I have read the weld doc, and jetty doc, I can not find some way to fix >> it. >> >> *Hantsy Bai* >> >> Self-employed consultant, fullstack developer, agile coach >> >> GitHub: https://github.com/hantsy >> >> Twitter: https://twitter.com/@hantsy >> Medium: https://medium.com/@hantsy >> ___ >> jetty-users mailing list >> jetty-users@eclipse.org >> To unsubscribe from this list, visit >> https://www.eclipse.org/mailman/listinfo/jetty-users >> > ___ > jetty-users mailing list > jetty-users@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/jetty-users > ___ jetty-users mailing list jetty-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
Re: [jetty-users] Weld 4+ Jersey3+ Mojarra3 + Jetty Maven plugin start failed.
Have you seen this article, it may have resolution for you. https://github.com/jetty-project/weld-example-base/issues/1 On Sat, 3 Apr 2021, 15:20 hantsy bai, wrote: > Hi everybody, > > Currently, I am working on a template project for servlet 5.0, > > https://github.com/hantsy/jakartaee9-servlet-starter-boilerplate > > Firstly I want to run the application via cargo maven plugin(tomat) and > jetty maven plugin .but encountered an issue with configuring Jetty maven > plugin. > > When running the following command and failed. > > > >mvn clean package jetty:run-war -Pjetty > > Apr 03, 2021 10:04:58 PM > org.jboss.weld.environment.servlet.WeldServletLifecycle initialize > INFO: WELD-ENV-001001: No supported servlet container detected, CDI > injection will NOT be available in Servlets, Filters or Listeners > [WARNING] Failed startup of context o.e.j.m.p.MavenWebAppContext@c79780 > {/jakartaee9-servlet-starter-boilerplate,[file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jak > artaee9-servlet-starter-boilerplate/, > jar:file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jakartaee9-servlet-starter-boilerplate/WEB-INF/lib/jakarta.faces-3.0.0.jar > > !/META-INF/resources],UNAVAILABLE}{D:\hantsylabs\jakartaee9-servlet-starter-boilerplate\target\jakartaee9-servlet-starter-boilerplate.war} > java.lang.LinkageError: loader constraint violation: when resolving > interface method 'void > jakarta.servlet.jsp.JspApplicationContext.addELResolver(jakarta.el.ELResolver)' > the class loa > der org.eclipse.jetty.webapp.WebAppClassLoader @51c6e775 of the current > class, org/jboss/weld/environment/servlet/WeldServletLifecycle, and the > class loader org.codehaus.plexus.classwo > rlds.realm.ClassRealm @cef885d for the method's defining class, > jakarta/servlet/jsp/JspApplicationContext, have different Class objects for > the type jakarta/el/ELResolver used in the s > ignature (org.jboss.weld.environment.servlet.WeldServletLifecycle is in > unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader > @51c6e775, parent loader org.codehaus.plexus > .classworlds.realm.ClassRealm @cef885d; > jakarta.servlet.jsp.JspApplicationContext is in unnamed module of loader > org.codehaus.plexus.classworlds.realm.ClassRealm @cef885d, parent loade > r 'bootstrap') > > I have read the weld doc, and jetty doc, I can not find some way to fix it. > > *Hantsy Bai* > > Self-employed consultant, fullstack developer, agile coach > > GitHub: https://github.com/hantsy > > Twitter: https://twitter.com/@hantsy > Medium: https://medium.com/@hantsy > ___ > jetty-users mailing list > jetty-users@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/jetty-users > ___ jetty-users mailing list jetty-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
[jetty-users] Weld 4+ Jersey3+ Mojarra3 + Jetty Maven plugin start failed.
Hi everybody, Currently, I am working on a template project for servlet 5.0, https://github.com/hantsy/jakartaee9-servlet-starter-boilerplate Firstly I want to run the application via cargo maven plugin(tomat) and jetty maven plugin .but encountered an issue with configuring Jetty maven plugin. When running the following command and failed. > >mvn clean package jetty:run-war -Pjetty Apr 03, 2021 10:04:58 PM org.jboss.weld.environment.servlet.WeldServletLifecycle initialize INFO: WELD-ENV-001001: No supported servlet container detected, CDI injection will NOT be available in Servlets, Filters or Listeners [WARNING] Failed startup of context o.e.j.m.p.MavenWebAppContext@c79780 {/jakartaee9-servlet-starter-boilerplate,[file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jak artaee9-servlet-starter-boilerplate/, jar:file:///D:/hantsylabs/jakartaee9-servlet-starter-boilerplate/target/jakartaee9-servlet-starter-boilerplate/WEB-INF/lib/jakarta.faces-3.0.0.jar !/META-INF/resources],UNAVAILABLE}{D:\hantsylabs\jakartaee9-servlet-starter-boilerplate\target\jakartaee9-servlet-starter-boilerplate.war} java.lang.LinkageError: loader constraint violation: when resolving interface method 'void jakarta.servlet.jsp.JspApplicationContext.addELResolver(jakarta.el.ELResolver)' the class loa der org.eclipse.jetty.webapp.WebAppClassLoader @51c6e775 of the current class, org/jboss/weld/environment/servlet/WeldServletLifecycle, and the class loader org.codehaus.plexus.classwo rlds.realm.ClassRealm @cef885d for the method's defining class, jakarta/servlet/jsp/JspApplicationContext, have different Class objects for the type jakarta/el/ELResolver used in the s ignature (org.jboss.weld.environment.servlet.WeldServletLifecycle is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @51c6e775, parent loader org.codehaus.plexus .classworlds.realm.ClassRealm @cef885d; jakarta.servlet.jsp.JspApplicationContext is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @cef885d, parent loade r 'bootstrap') I have read the weld doc, and jetty doc, I can not find some way to fix it. *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy ___ jetty-users mailing list jetty-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
Re: [jetty-users] Jsp configuration class
I was just trying to identify the issues so I can report it for you to have a look at. I was switching only for that purpose. On Sat, 3 Apr 2021, 08:13 Greg Wilkins, wrote: > Som, > > in 11 there is indeed no ClassList, so that part is "broken". Just delete > those lines... and tell us what your code was doing with classlist. > > Note switching back and forth from 9 to 11 is difficult. > > > > On Sat, 3 Apr 2021 at 17:59, Som Lima wrote: > >> Then there is an issue with >>Configuration.ClassList classlist = Configuration.ClassList >> .setServerDefault(server); >> >> I kept changing jetty version in pom.xml from 11 to 9. >> That is the only change I made. >> I did it a number of times to satisfy myself. >> When 9 no issue but when 11 then an error reported by eclipse IDE. >> >> >> On Sat, 3 Apr 2021, 06:51 Greg Wilkins, wrote: >> >>> Som, >>> >>> Neither WebAppContext nor ServletHandlerContext are obsolete. >>> >>> However, you only need to call setConfigurations in exceptional >>> circumstances as typically it is sufficient just to put a jar on the class >>> path for any Configuration instance that it contains to be discovered and >>> added to your WebAppContext automatically. >>> >>> >>> On Sat, 3 Apr 2021 at 14:59, Som Lima wrote: >>> The use of both the WebAppContext class and ServletHandlerContext class have become obsolete in jetty 11 so the recommendation to use classlist instead of WebAppContext.setConfigurations wasn't relevant. On Fri, 26 Mar 2021, 23:40 Joakim Erdfelt, wrote: > What version of Jetty are you using? > > Joakim Erdfelt / joa...@webtide.com > > > On Fri, Mar 26, 2021 at 6:34 PM Som Lima > wrote: > >> Hi Thanks, >> >> I did try this Configuration.ClassList approach earlier but I was >> getting an error " >> Multiple markers at this line >> - ClassList cannot be resolved or is not a field >> - Configuration.ClassList cannot be resolved to a >> type >> >> I think was due to an incompatible server object. >> >> I am working in another project now >> this time I inserted the code , no eclipse IDE errors reported I >> guess the server object is compatible. >> My code looks like this but still I am missing JSP feature. Not sure >> the syntax for that. >> console error message" No JSP support. Check that JSP jars are in >> lib/jsp and that the JSP option has been specified to start." >> >> >> *I have these two dependencies in pom.xml* >> >> >> org.eclipse.jetty >> apache-jsp >> ${jetty.version} >> >> >> jstl >> jstl >> 1.2 >> >> >> >> *This is what my code looks like but I don't think I have the jsp >> configuration in either variations* >> >>context.setBaseResource(Resource.newResource(webResourceBase)); >> context.setConfigurations(new Configuration[] >> { >> new AnnotationConfiguration(), >> new WebInfConfiguration(), >> new WebXmlConfiguration(), >> new MetaInfConfiguration(), >> new FragmentConfiguration(), >> new EnvConfiguration(), >> new PlusConfiguration(), >> new JettyWebXmlConfiguration() >> }); >> >> // === setup jetty plus == >> Configuration.ClassList classlist = Configuration.ClassList >> .setServerDefault(server); >> classlist.addAfter( >> "org.eclipse.jetty.webapp.FragmentConfiguration", >> "org.eclipse.jetty.plus.webapp.EnvConfiguration", >> "org.eclipse.jetty.plus.webapp.PlusConfiguration"); >> >> classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", >> "org.eclipse.jetty.annotations.AnnotationConfiguration"); >> >> context.setContextPath("/"); >> >> On Fri, 26 Mar 2021, 22:19 Joakim Erdfelt, >> wrote: >> >>> The order of that Configuration list is very important. >>> >>> It would be better to utilize the Server level component and just >>> add the missing pieces you need. >>> >>> See: >>> >>>- >>> >>> https://github.com/eclipse/jetty.project/blob/jetty-9.4.38.v20210224/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java#L168-L177 >>>- >>> >>> https://github.com/jetty-project/embedded-jetty-jsp/blob/4918be37b938fff9fada5910ca04c59d8969cc90/src/main/java/org/eclipse/jetty/demo/Main.java#L131-L136 >>> >>> >>> // === setup jetty plus == >>> Configuration.ClassList classlist = >>> Configuration.ClassList.setServerDefault(server); >>> >>> // Add JNDI support >>> classlist.addAfter( >>>
Re: [jetty-users] Jsp configuration class
Som, in 11 there is indeed no ClassList, so that part is "broken". Just delete those lines... and tell us what your code was doing with classlist. Note switching back and forth from 9 to 11 is difficult. On Sat, 3 Apr 2021 at 17:59, Som Lima wrote: > Then there is an issue with >Configuration.ClassList classlist = Configuration.ClassList > .setServerDefault(server); > > I kept changing jetty version in pom.xml from 11 to 9. > That is the only change I made. > I did it a number of times to satisfy myself. > When 9 no issue but when 11 then an error reported by eclipse IDE. > > > On Sat, 3 Apr 2021, 06:51 Greg Wilkins, wrote: > >> Som, >> >> Neither WebAppContext nor ServletHandlerContext are obsolete. >> >> However, you only need to call setConfigurations in exceptional >> circumstances as typically it is sufficient just to put a jar on the class >> path for any Configuration instance that it contains to be discovered and >> added to your WebAppContext automatically. >> >> >> On Sat, 3 Apr 2021 at 14:59, Som Lima wrote: >> >>> >>> The use of both the WebAppContext class and ServletHandlerContext >>> class have become obsolete in jetty 11 so the recommendation to use >>> classlist instead of WebAppContext.setConfigurations wasn't relevant. >>> >>> >>> >>> On Fri, 26 Mar 2021, 23:40 Joakim Erdfelt, wrote: >>> What version of Jetty are you using? Joakim Erdfelt / joa...@webtide.com On Fri, Mar 26, 2021 at 6:34 PM Som Lima wrote: > Hi Thanks, > > I did try this Configuration.ClassList approach earlier but I was > getting an error " > Multiple markers at this line > - ClassList cannot be resolved or is not a field > - Configuration.ClassList cannot be resolved to a > type > > I think was due to an incompatible server object. > > I am working in another project now > this time I inserted the code , no eclipse IDE errors reported I > guess the server object is compatible. > My code looks like this but still I am missing JSP feature. Not sure > the syntax for that. > console error message" No JSP support. Check that JSP jars are in > lib/jsp and that the JSP option has been specified to start." > > > *I have these two dependencies in pom.xml* > > > org.eclipse.jetty > apache-jsp > ${jetty.version} > > > jstl > jstl > 1.2 > > > > *This is what my code looks like but I don't think I have the jsp > configuration in either variations* > >context.setBaseResource(Resource.newResource(webResourceBase)); > context.setConfigurations(new Configuration[] > { > new AnnotationConfiguration(), > new WebInfConfiguration(), > new WebXmlConfiguration(), > new MetaInfConfiguration(), > new FragmentConfiguration(), > new EnvConfiguration(), > new PlusConfiguration(), > new JettyWebXmlConfiguration() > }); > > // === setup jetty plus == > Configuration.ClassList classlist = Configuration.ClassList > .setServerDefault(server); > classlist.addAfter( > "org.eclipse.jetty.webapp.FragmentConfiguration", > "org.eclipse.jetty.plus.webapp.EnvConfiguration", > "org.eclipse.jetty.plus.webapp.PlusConfiguration"); > > classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", > "org.eclipse.jetty.annotations.AnnotationConfiguration"); > > context.setContextPath("/"); > > On Fri, 26 Mar 2021, 22:19 Joakim Erdfelt, wrote: > >> The order of that Configuration list is very important. >> >> It would be better to utilize the Server level component and just add >> the missing pieces you need. >> >> See: >> >>- >> >> https://github.com/eclipse/jetty.project/blob/jetty-9.4.38.v20210224/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java#L168-L177 >>- >> >> https://github.com/jetty-project/embedded-jetty-jsp/blob/4918be37b938fff9fada5910ca04c59d8969cc90/src/main/java/org/eclipse/jetty/demo/Main.java#L131-L136 >> >> >> // === setup jetty plus == >> Configuration.ClassList classlist = >> Configuration.ClassList.setServerDefault(server); >> >> // Add JNDI support >> classlist.addAfter( >> "org.eclipse.jetty.webapp.FragmentConfiguration", >> "org.eclipse.jetty.plus.webapp.EnvConfiguration", >> "org.eclipse.jetty.plus.webapp.PlusConfiguration"); >> >> // Add Annotation Scanning Support >> >> classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
Re: [jetty-users] Jsp configuration class
Then there is an issue with Configuration.ClassList classlist = Configuration.ClassList .setServerDefault(server); I kept changing jetty version in pom.xml from 11 to 9. That is the only change I made. I did it a number of times to satisfy myself. When 9 no issue but when 11 then an error reported by eclipse IDE. On Sat, 3 Apr 2021, 06:51 Greg Wilkins, wrote: > Som, > > Neither WebAppContext nor ServletHandlerContext are obsolete. > > However, you only need to call setConfigurations in exceptional > circumstances as typically it is sufficient just to put a jar on the class > path for any Configuration instance that it contains to be discovered and > added to your WebAppContext automatically. > > > On Sat, 3 Apr 2021 at 14:59, Som Lima wrote: > >> >> The use of both the WebAppContext class and ServletHandlerContext >> class have become obsolete in jetty 11 so the recommendation to use >> classlist instead of WebAppContext.setConfigurations wasn't relevant. >> >> >> >> On Fri, 26 Mar 2021, 23:40 Joakim Erdfelt, wrote: >> >>> What version of Jetty are you using? >>> >>> Joakim Erdfelt / joa...@webtide.com >>> >>> >>> On Fri, Mar 26, 2021 at 6:34 PM Som Lima >>> wrote: >>> Hi Thanks, I did try this Configuration.ClassList approach earlier but I was getting an error " Multiple markers at this line - ClassList cannot be resolved or is not a field - Configuration.ClassList cannot be resolved to a type I think was due to an incompatible server object. I am working in another project now this time I inserted the code , no eclipse IDE errors reported I guess the server object is compatible. My code looks like this but still I am missing JSP feature. Not sure the syntax for that. console error message" No JSP support. Check that JSP jars are in lib/jsp and that the JSP option has been specified to start." *I have these two dependencies in pom.xml* org.eclipse.jetty apache-jsp ${jetty.version} jstl jstl 1.2 *This is what my code looks like but I don't think I have the jsp configuration in either variations* context.setBaseResource(Resource.newResource(webResourceBase)); context.setConfigurations(new Configuration[] { new AnnotationConfiguration(), new WebInfConfiguration(), new WebXmlConfiguration(), new MetaInfConfiguration(), new FragmentConfiguration(), new EnvConfiguration(), new PlusConfiguration(), new JettyWebXmlConfiguration() }); // === setup jetty plus == Configuration.ClassList classlist = Configuration.ClassList .setServerDefault(server); classlist.addAfter( "org.eclipse.jetty.webapp.FragmentConfiguration", "org.eclipse.jetty.plus.webapp.EnvConfiguration", "org.eclipse.jetty.plus.webapp.PlusConfiguration"); classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration"); context.setContextPath("/"); On Fri, 26 Mar 2021, 22:19 Joakim Erdfelt, wrote: > The order of that Configuration list is very important. > > It would be better to utilize the Server level component and just add > the missing pieces you need. > > See: > >- > > https://github.com/eclipse/jetty.project/blob/jetty-9.4.38.v20210224/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java#L168-L177 >- > > https://github.com/jetty-project/embedded-jetty-jsp/blob/4918be37b938fff9fada5910ca04c59d8969cc90/src/main/java/org/eclipse/jetty/demo/Main.java#L131-L136 > > > // === setup jetty plus == > Configuration.ClassList classlist = > Configuration.ClassList.setServerDefault(server); > > // Add JNDI support > classlist.addAfter( > "org.eclipse.jetty.webapp.FragmentConfiguration", > "org.eclipse.jetty.plus.webapp.EnvConfiguration", > "org.eclipse.jetty.plus.webapp.PlusConfiguration"); > > // Add Annotation Scanning Support > > classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", > "org.eclipse.jetty.annotations.AnnotationConfiguration"); > > Leave the existing Configurations in place, don't overwrite/replace > the entire list like you are doing. > There is no need to configure the WebAppContext directly. > > Joakim Erdfelt / joa...@webtide.com > > > On Fri, Mar 26, 2021 at 4:42 PM Som Lima > wrote: > >> Hi,
[jetty-users] Either OR but not Both.
IF I have the web.xml then localhost:8080/myresource works fine BUT the index.jsp is not picked with localhost:8080 or http://localhost/index.jsp I got an 404. URI: / STATUS: 404 IF I remove the web.xml then the index.jsp is picked up which is what is meant to happen with jetty because it's built in functionality assumes an index.jsp file is there and will pick it and publish it. But the I get a 404 with localhost:8080/myresource now. I want both index.jsp to be picked up and have the jersey functionality localhost:8080/myresource with the web.xml but I can only have one or the other. https://jakarta.ee/xml/ns/jakartaee; xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd; version="5.0"> Jersey Web Application org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.example 1 Jersey Web Application /* index.jsp import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; /** * Root resource (exposed at "myresource" path) */ @Path("myresource") public class MyResource { /** * Method handling HTTP GET requests. The returned object will be sent * to the client as "text/plain" media type. * * @return String that will be returned as a text/plain response. */ @GET @Produces(MediaType.TEXT_PLAIN) public String getIt() { return "got, it!"; } } Preferably I also want the Rest API Config to work as well as the index.jsp so that I can call the resource localhost:8080/v1/myresource import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; @ApplicationPath("v1") public class RestAppConfig extends Application{ } ___ jetty-users mailing list jetty-users@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users