Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] NoClassDefFoundError : Embedded Jetty
  • From: Sujay Pujari <sujay_pujari@xxxxxxxxxxxxxx>
  • Date: Mon, 16 Mar 2020 13:53:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=persistent.com; dmarc=pass action=none header.from=persistent.com; dkim=pass header.d=persistent.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fRs/JUiddTtqE0oN/msRZHRFSj7Ez9MOE/tj6rtT75E=; b=kz0i22l4REAxeUKwiY8wC1kOEORW17AoxR0dPy54U9uA0M0yb8naafPFN4Hi3uA88SQ06pMtCf1IGcckYG0c1T0tJnPrE2P5AI4oHmpAsIyEj1TYdcBVD0NoeeQPGiMjSLC5qrOHXywc43EM9oqPKXj6/6+yHEDQgymwcMo4lv3QrQ9an2KaskKmCSRM2ArEE4dZpuOjh2iqnpLdPLEivY3Q7uVGQnHlvfVydC591l+0C6RkRbCR+jqdpdaVtZuWdBeegtYMds4n/IlPInR1+QX0gomPdfgiLT/+kkibiNsu8u/Uoxc2TNOSud8MpKyYhDVFgCxdYFtmWWPhML6Ovg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hvPk2eflUzuteBAcFGBUVbMOZO5LV7RbVNas4qMAHu7rmikWOAe+QKHlNKrkEbCDuHOFLR9/7RChJWHlxPWDgOnjL5VJ/PjV04uwfzwAWHITb5wSr+d9IOmnKFjiZGjgnxcEw5w2EOOiUgphjQ1Q7OClQofjovUdvjSodnZHqejOuYwOx/cyd/1y9yFBBpz1yZRQ1wWzdGUrFG7gEsuKphsY//JHnxf3RjGlcM7yiOgZXCGrJHUXO6N5iwAhsoDmuZRJ7oRZB5/dpW8Wl5YmUoM8MCVoHbXg2b/VwseBpkl+hh/x9BxrKXVRkSFtsnZK2v4PG0MDl1u7AwRrSuiI/A==
  • Delivered-to: jetty-users@xxxxxxxxxxx
  • Ironport-sdr: S8O7TBVMv4fWQOGr5Bal96fAbNxbCBowUmNaP5+vIFM7aH0MRelk1EBfeIq2/s3j+tFenwKH9u KE8DpQCGRUWyZJo+xAV0fbPM5uImc/kUgy6x/13mm/5aUy4A3pcX16/nhwADYmrp2fJJJc9PuB DmOrI14OAMwsoHqNuEV4UAF1fTtfbkRzvPFvvMXTWi14RPlwenAIEEjlwqNi++iR2T2Ot6a8Ix U584duTr46wiS/5pZXp2eWDzZTAil0y3gYi9lP9SMnkcuXyDj1ID6HN1j7+ddJpHV6BORo+8E+ hdo=
  • List-archive: <https://www.eclipse.org/mailman/private/jetty-users>
  • List-help: <mailto:jetty-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AdX32XC+c0q6s3w9RQ+xaZW2CtddKgADKvCAAC88sXAAAYVDsAAoY1MAAFRgVrAANNepAAAKD2gA
  • Thread-topic: [jetty-users] NoClassDefFoundError : Embedded Jetty

Hi Greg

Issue was resolved by my previous code changes

i.e. discoveryLoginModule which was part of webapp’s web-inf. I moved it to a jar referred by /available at server level.

 

I was just missing changes in jaas.config . Now correctly pointed to new class ( not part of Web-inf ).

 

I wonder,

Why Jetty 6 & 9 has difference where now I had to make sure Login Module not part of Web-inf.

 

Thanks a lot for your help so far,

Regards,

Sujay

 

 

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Greg Wilkins
Sent: Monday, March 16, 2020 2:18 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] NoClassDefFoundError : Embedded Jetty

 

 

Sujay,

 

I just that you start by building up from simple to complex:

  1. Deploy just the jetty server with no login services and no webapps. Check you can start and stop it.
  2. Enable the ext module and add the jars for your login service to $JETTY_BASE/lib/ext.   Write a text.xml fine that instantiates the login service and set's it as a bean on the server.   check you can start OK.
  3. Repeat but with multiple instances of the login service.
  4. Deploy a webapplication, but don't change configuration.  Check again you can start.
  5. Add XML that does getSecurityHandler().setLoginService(a new LoginService);   - Note this is not replacing the security handler, it is only setting the login service.

regards

 

 

On Sun, 15 Mar 2020 at 08:48, Sujay Pujari <sujay_pujari@xxxxxxxxxxxxxx> wrote:

Hi Greg,

 

Previously my loginModule  :  discoveryLoginModule was part of webapp’s web-inf.

I moved it to a jar referred by ( available at server level).

 

&

Inside DiscoveryLoginModule’s login method.

 

I have added following lines

ClassLoader myCL = DiscoveryLoginModule.class.getClassLoader();          

System.out.println(myCL.toString());

Credential cr =  Credential.getCredential(pwdStr);

 

 

With parentLoaderPriority = true

 

On DevIDE Environment ,

I get class loader as AppClassloader & I don’t see NCDFE error.

 

But on Build Environemnt

I get class loader as WebAppclassloadder We get NCDFE error

 

 

Without “parentLoaderPriority  = true”

 

On both DevIDE & build  environment

I get class loader as WebAppclassloadder and We get NCDFE error.

 

 

So my conclusion  from above is :

In case of build environment “parentLoaderPriority” is not helping us to change classloader to Appclassloader.

And As classloader is WebAppClassloader we are seeing NCDFE error.

 

Can you please help me further to address this issue.

 

Thanks & Regards,

Sujay

 

 

From: jetty-users-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Greg Wilkins
Sent: Friday, March 13, 2020 8:49 PM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] NoClassDefFoundError : Embedded Jetty

 

 

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_pujari@xxxxxxxxxxxxxx> 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@xxxxxxxxxxx>
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-bounces@xxxxxxxxxxx <jetty-users-bounces@xxxxxxxxxxx> On Behalf Of Greg Wilkins
Sent: Thursday, March 12, 2020 2:16 AM
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
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_pujari@xxxxxxxxxxxxxx> 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@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


 

--

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


 

--

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


 

--


Back to the top