Sujay,

thanks for the extra information.

I can't tell a lot from your dump, because the classloaders just have
WEB-INF/classes on their classpath.

I'm guessing the problem is that your LoginService is being loaded by the
Webapp classloader, and thus it does not have visibility of the server
classes like Credential.
So I would make sure that all of the classes you use for your login
services are on the container class path (ie not in WEB-INF of any
webapp).  They are server classes and not application classes, so they
should not be constrained by the webappclassloader.

regards





On Thu, 12 Mar 2020 at 21:08, Sujay Pujari <sujay_puj...@persistent.com>
wrote:

> Hi Greg & other users,
>
>
>
> Please accept apologies from me.
>
>
>
> Last dump shared “Build_parentLoaderTrue_dumpStderr.txt” was for scenario
> 1. i.e  output from eclipse environment where set Parent Clasloade helped
> to resolve No class def issue.
>
>
>
> Somehow I am not able to get DumpStdErr on my production build environment
> ( i.e sccenario 2 where NCDFE is still persist). I will share with you dump
> as soon as I get there.
>
>
>
> Regards,
>
> Sujay
>
>
>
> *From:* Sujay Pujari
> *Sent:* Friday, March 13, 2020 12:58 AM
> *To:* JETTY user mailing list <jetty-users@eclipse.org>
> *Subject:* RE: [jetty-users] NoClassDefFoundError : Embedded Jetty
>
>
>
> Hi Greg,
>
>
>
> I just want to give more detail about our issue
>
>
>
> We have multiple web apps, and one of them is configured in ediscovery.xml.
>
> Also different login services are used for different applications.
>
> Hence we used  per web app scoped : security handler approach instead of
> addbean at server level.
>
> Ref:
> https://www.eclipse.org/jetty/documentation/current/configuring-security.html
>
>
>
> Also,
>
>    1. On eclipse IDE workspace , when we use parentLoaderPriority   true
>    then we don’t face any such issue
>    2. Now when we have created a installer which copies this jars in
>    installation directory and a Java comman launches our server, then
>    parentLoaderPriority  true is not helping us.
>
>
>
> PFA : Build_parentLoaderTrue_dumpStderr.txt
> As output of Stderr when I ran dumpStdErr in Build environment.
>
>
>
>
>
> Thanks & Regards,
> Sujay
>
>
>
> *From:* jetty-users-boun...@eclipse.org <jetty-users-boun...@eclipse.org> *On
> Behalf Of *Greg Wilkins
> *Sent:* Thursday, March 12, 2020 2:16 AM
> *To:* JETTY user mailing list <jetty-users@eclipse.org>
> *Subject:* Re: [jetty-users] NoClassDefFoundError : Embedded Jetty
>
>
>
> Sujey,
>
>
>
> Jetty 6 to Jetty 9!!! Happy new decade! !)
>
>
>
> After you start the server, can you do a Server.dumpStdErr() and post the
> output?
>
>
>
> Your configuration of the login service by setting a new security handler
> on the context is a bit strange.  You should be able to just add the login
> service as a bean on the server and it will be found.
>
>
>
> Do any of the frameworks you are using set the Thread context classloader?
>
>
>
> regards
>
>
>
>
>
> On Wed, 11 Mar 2020 at 20:18, Sujay Pujari <sujay_puj...@persistent.com>
> wrote:
>
> Hello Jetty users,
>
>
>
> We are migrating Jetty from v6 to ver 9.4.27 & using embedded Jetty.
>
> Where in authentication is performed using form based , Jaas
> authentication.
>
> In Jaas.conf file we have configured to use following  custom module
>
> class com.acme.es.nuvo.ediscovery.jaas.DiscoveryLoginModule which  extends
> from AbstractLoginModule.
>
> Now inside Login method of this class, We have following line of code
>
> Credential cr =  Credential.getCredential(pwdStr);
>
>
>
> *Where we are getting NoClassDefFoundError for
> org.eclipse.jetty.util.security.Credential.*
>
> Note : This issue is observed on Jetty 9.x & 8.x  ( but was working fine
> with 6.x )
>
>
>
> Inspite of the  fact that jetty-util jar corresponding to this is present
> in the buildpath.
>
> Also,
>
> Verbose:class shows that this class is getting loaded.
>
> class load: org.eclipse.jetty.util.security.Credential from:
> file:/../lib/Jetty9.4.15/jetty-util-9.4.15.v20190215.jar
>
>
>
> Can anybody suggest what I might be missing ? Any appropriate way to
> troubleshoot this?
>
> Any help would be really appreciated.
>
>
>
> *Here is detailed stack:*
>
>
>
> javax.security.auth.login.LoginException: java.lang.NoClassDefFoundError:
> org.eclipse.jetty.util.security.Credential
>
>                 at
> com.acme.es.nuvo.ediscovery.jaas.DiscoveryLoginModule.login(DiscoveryLoginModule.java:148)
>
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
>
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>
>                 at java.lang.reflect.Method.invoke(Method.java:508)
>
>                 at
> javax.security.auth.login.LoginContext.invoke(LoginContext.java:788)
>
>                 at
> javax.security.auth.login.LoginContext.access$000(LoginContext.java:196)
>
>                 at
> javax.security.auth.login.LoginContext$4.run(LoginContext.java:698)
>
>                 at
> javax.security.auth.login.LoginContext$4.run(LoginContext.java:696)
>
>                 at
> java.security.AccessController.doPrivileged(AccessController.java:650)
>
>                 at
> javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:696)
>
>                 at
> javax.security.auth.login.LoginContext.login(LoginContext.java:597)
>
>                 at
> org.eclipse.jetty.jaas.JAASLoginService.login(JAASLoginService.java:251)
>
>                 at
> org.eclipse.jetty.security.authentication.LoginAuthenticator.login(LoginAuthenticator.java:67)
>
>                 at
> org.eclipse.jetty.security.authentication.FormAuthenticator.login(FormAuthenticator.java:182)
>
>                 at
> org.eclipse.jetty.security.authentication.DeferredAuthentication.login(DeferredAuthentication.java:118)
>
>                 at
> org.eclipse.jetty.server.Request.login(Request.java:2411)
>
>                 at
> com.acme.es.nuvo.ediscovery.ui.actions.LoginAction.login(LoginAction.java:70)
>
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
>
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
>
>                 at java.lang.reflect.Method.invoke(Method.java:508)
>
>                 at
> com.acme.es.nuvo.ediscovery.ui.DiscoveryAction.dispatchMethod(DiscoveryAction.java:149)
>
>                 at
> org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
>
>                 at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
>
>                 at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
>
>                 at
> com.acme.es.nuvo.ediscovery.ui.DiscoveryRequestProcessor.process(DiscoveryRequestProcessor.java:84)
>
>                 at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>
>                 at
> com.acme.es.nuvo.ediscovery.ui.SecureServlet.process(SecureServlet.java:67)
>
>                 at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
>
>                 at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>
>                 at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>
>                 at
> org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1395)
>
>                 at
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
>
>                 at
> com.acme.es.nuvo.common.CompressionFilter.doFilter(CompressionFilter.java:80)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>
>                 at
> com.acme.es.nuvo.common.CacheFilter.doFilter(CacheFilter.java:92)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>
>                 at
> com.acme.es.nuvo.common.Utf8Filter.doFilter(Utf8Filter.java:34)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>
>                 at
> com.acme.es.nuvo.common.LocaleFilter.doFilter(LocaleFilter.java:57)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>
>                 at
> com.acme.es.nuvo.common.SecurityTokenFilter.doFilter(SecurityTokenFilter.java:78)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
>
>                 at
> com.acme.es.nuvo.common.SSLFilter.doFilter(SSLFilter.java:58)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>
>                 at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:566)
>
>                 at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
>
>                 at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
>
>                 at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
>
>                 at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
>
>                 at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
>
>                 at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
>
>                 at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>
>                 at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
>
>                 at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
>
>                 at
> org.eclipse.jetty.server.handler.DebugHandler.handle(DebugHandler.java:81)
>
>                 at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
>
>                 at org.eclipse.jetty.server.Server.handle(Server.java:500)
>
>                 at
> org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
>
>                 at
> org.eclipse.jetty.server.HttpChannel$$Lambda$59.0000000000D9AA80.dispatch(Unknown
> Source)
>
>                 at
> org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
>
>                 at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
>
>                 at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
>
>                 at
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
>
>                 at
> org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
>
>                 at
> org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:543)
>
>                 at
> org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:398)
>
>                 at
> org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:161)
>
>                 at
> org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
>
>                 at
> org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
>
>                 at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
>
>                 at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
>
>                 at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
>
>                 at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
>
>                 at
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
>
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
>
>                 at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
>
>                 at java.lang.Thread.run(Thread.java:785)
>
> Caused by: java.lang.ClassNotFoundException:
> org.eclipse.jetty.util.security.Credential
>
>                 at
> org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:565)
>
>                 at java.lang.ClassLoader.loadClass(ClassLoader.java:809)
>
>                 ... 86 more
>
>
>
>
>
> Other details :
>
>
>
> A.
>
> We are instantiating jetty instance through Java code and where we refer
> jetty.xml for server configuration.
>
>
>
> B.
>
> In jetty.xml we uses following
>
>
>
> <Configure id="Server" class="org.eclipse.jetty.server.Server">
>
> …
>
> …
>
>
>
>       <Call name=*"addBean"*>
>
>           <Arg>
>
>             <New id=*"DeploymentManager"* class=
> *"org.eclipse.jetty.deploy.DeploymentManager"*>
>
>               <Set name=*"contexts"*>
>
>                 <Ref refid=*"Contexts"* />
>
>               </Set>
>
>               <Call id=*"webappprovider"* name=*"addAppProvider"*>
>
>                 <Arg>
>
>                   <New class=
> *"org.eclipse.jetty.deploy.providers.WebAppProvider"*>
>
>                     <Set name=*"monitoredDirName"*><Property name=
> *"Project.home"* default=*"."* />/*config*/jetty_contexts</Set>
>
>
>                     <Set name=*"scanInterval"*>0</Set>
>
>                     <Set name=*"extractWars"*>true</Set>
>
>                    <!--  <Set name="Recursive">true</Set>     -->
>
>
>                   </New>
>
>                 </Arg>
>
>               </Call>
>
>             </New>
>
>           </Arg>
>
>        </Call>
>
>
>
> …
>
>
>
>
>
> </Configure>
>
>
>
>
>
>
>
> C.  one of the file present at <project.home>/*config*/jetty_contexts is
> ediscovery.xml
>
>
>
> <Configure class=*"org.eclipse.jetty.webapp.WebAppContext"*>
>
>
>
>
>
>   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
>
>   <!-- Required minimal context configuration :                        -->
>
>   <!--  + contextPath                                                  -->
>
>   <!--  + war OR resourceBase                                          -->
>
>   <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
>
>
>
>
>
>   <Set name=*"contextPath"*>/*ediscovery*</Set>
>
>    <!-- <Set name="parentLoaderPriority">true</Set>-->
>
>    <Set name=*"war"*><SystemProperty name=*"Project.home"* default=*"."*/>
> /*lib*/Application_ui.war</Set>
>
>
>
>   …..
>
>
>
>
>
>   <Set name=*"securityHandler"*>
>
>     <New class=*"org.eclipse.jetty.security.ConstraintSecurityHandler"*>
>
>      <Set name=*"loginService"*>
>
>        <New class=*"org.eclipse.jetty.jaas.JAASLoginService"*>
>
>          <Set name=*"name"*>*ediscovery*</Set>
>
>          <Set name=*"loginModuleName"*>DiscoveryLoginModule</Set>
>
>          <Set name=*"CallbackHandlerClass"*>
>
>                   org.eclipse.jetty.jaas.callback.DefaultCallbackHandler
>
>             </Set>
>
>             <Set name=*"roleClassNames"*>
>
>                 <Array type=*"java.lang.String"*>
>
>                   <Item>org.eclipse.jetty.jaas.JAASRole</Item>
>
>                 </Array>
>
>               </Set>
>
>        </New>
>
>      </Set>
>
>      <Set name=*"checkWelcomeFiles"*>true</Set>
>
>     </New>
>
>   </Set>
>
>
>
> …
>
>
>
>
>
> </Configure>
>
>
>
>
>
> Now I have few observations.
>
>
>
> When in File C i.e. ediscovery.xml I make following line uncommented
>
> <Set name="parentLoaderPriority">true</Set>
>
> Then,
>
> In my eclipse I don’t see any No Class Def Found Error.
>
>
>
> But,
>
>    1. In my build environment ( installed version, I see same error ,
>    classpath has required jars present )
>    2. Jetty 6 we were nor setting parentLoaderPriority  to True.
>
>
>
>
>
>
>
>
>
> Any help to troubleshoot this problem will be appreciated.
>
>
>
> Thanks & Regards,
>
> Sujay
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
>
>
>
> --
>
> Greg Wilkins <gr...@webtide.com> CTO http://webtide.com
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>


-- 
Greg Wilkins <gr...@webtide.com> CTO http://webtide.com
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to