[GLASSFISH-20212] classloader error in glassfish3.1.2.2 Created: 07/Apr/13  Updated: 17/Apr/13  Resolved: 08/Apr/13

Status: Resolved
Project: glassfish
Component/s: rest-interface
Affects Version/s: 3.1.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: wizard.liyd Assignee: Jason Lee
Resolution: Cannot Reproduce Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by GLASSFISH-20326 classloader error in glassfish4.0b23 Resolved
Sub-Tasks:
Key
Summary
Type
Status
Assignee
GLASSFISH-20326 classloader error in glassfish4.0b23 Sub-task Resolved Sanjeeb Sahoo  
GLASSFISH-20328 classloader error in glassfish4.0b23 Sub-task Open Jason Lee  

 Description   

First,deploy a web application in glassfish3.1.2.2. In the web application, the sun-web.xml configuration information is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<sun-web-app>
<class-loader delegate="false"/>
</sun-web-app>

Second, access http://localhost:4848/management/domain/resources/jdbc-resource and view page source,as follows:

<html><head><title>GlassFish Server Open Source Edition 3.1.2.2 REST Interface</title> <link rel="stylesheet" type="text/css" href="http://localhost:4848/management/static/std.css" /> <script type="text/javascript" src="http://localhost:4848/management/static/ajax.javascript"></script></head><body><h1 class="mainheader">GlassFish Server Open Source Edition 3.1.2.2 REST Interface</h1><hr/><h3></h3><h2>Create jdbc-resource</h2><div><form action="http://localhost:4848/management/domain/resources/jdbc-resource#" method="post"><dl><dt><label for="description">description: </label></dt><dd><input name="description" type="text"></dd><dt><label for="enabled">enabled: </label></dt><dd><select name=enabled><option selected>true<br><option>false<br></select></dd><dt><label for="id">id<sup></sup>: </label></dt><dd><input name="id" type="text"></dd><dt><label for="poolName">poolName<sup></sup>: </label></dt><dd><input name="poolName" type="text"></dd><dt><label for="property">property: </label></dt><dd><input name="property" type="text"></dd><dt><label for="target">target: </label></dt><dd><input name="target" type="text"></dd><dd><input name="_remove_empty_entries" value="true" type="hidden"></dd><dt class="button"></dt><dd class="button"><input value="Create" type="button" onclick="ajaxSubmit(this); return false;"></dd></dl></form></div><hr class="separator"/><h2>Child Resources</h2><div><a href="http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/TimerPool">jdbc/TimerPool</a><br><a href="http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/default">jdbc/_default</a><br></div><br/><hr class="separator"/></div></body></html>

in page source, jdbc/_TimerPool's href is wrong. the correct href should be "http://localhost:4848/management/domain/resources/jdbc-resource/jdbc%2F_TimerPool".

Debug glassfish source code, tracking to getElementLink(UriInfo uriInfo, String elementName) in ProviderUtil.java when access http://localhost:4848/management/domain/resources/jdbc-resource, uriInfo.getRequestUriBuilder()'s Implementation class is org.apache.cxf.jaxrs.impl.UriBuilderImpl(there is a cxf-rt-frontend-jaxrs-2.2.5.jar in application/WEB-INFO/lib). But the implementation class should be com.sun.jersey.api.uri.UriBuilderImpl.

In Glassfish server, class loaders hierarchy is
1.bootstrap
2.extension
3.pulic api
4.common
5.conector
6.lifecyclemodule
7.applib
8.archive

but in this case, server class loader seem to be first load class of applib.

So, any idea why this happened?



 Comments   
Comment by wizard.liyd [ 07/Apr/13 ]

And, if you change sun-web.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<sun-web-app>
<class-loader delegate="true"/>
</sun-web-app>

access the http://localhost:4848/management/domain/resources/jdbc-resource and jdbc/_TimerPool's href is right(http://localhost:4848/management/domain/resources/jdbc-resource/jdbc%2F_TimerPool).

Comment by Jason Lee [ 08/Apr/13 ]

I can not reproduce this issue on the GlassFish 4.0 trunk. If you have a support contract, your rep should be able to help you file a bug for 3.1.2. Otherwise, for open source GlassFish, you can pick up the fix when GlassFish ships in the coming weeks.

Comment by wizard.liyd [ 16/Apr/13 ]

I deploy the web application On the GlassFish 4.0, then, restart glassfish server and access http://localhost:4848/, error as follows:

[2013-04-16T09:43:17.996+0800] [glassfish 4.0] [WARNING] [] [javax.enterprise.web.core] [tid: _ThreadID=40 _ThreadName=admin-listener(1)] [timeMillis: 1366076597996] [levelValue: 900] [[
Servlet.service() for servlet FacesServlet threw exception
java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at org.glassfish.jersey.client.JerseyWebTarget.<init>(JerseyWebTarget.java:72)
at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:180)
at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:69)
at org.glassfish.admingui.common.util.RestUtil.get(RestUtil.java:852)
at org.glassfish.admingui.common.util.RestUtil.restRequest(RestUtil.java:209)
at org.glassfish.admingui.common.handlers.RestApiHandlers.restRequest(RestApiHandlers.java:219)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.jsftemplating.layout.descriptors.handler.Handler.invoke(Handler.java:442)
at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:420)
at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:394)
at com.sun.jsftemplating.layout.descriptors.LayoutComponent.beforeCreate(LayoutComponent.java:348)
at com.sun.jsftemplating.layout.descriptors.LayoutComponent.getChild(LayoutComponent.java:288)
at com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:556)
at com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHandler.java:255)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:254)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
at org.glassfish.admingui.common.security.AdminConsoleAuthModule.validateRequest(AdminConsoleAuthModule.java:238)
at com.sun.enterprise.security.jmac.config.GFServerConfigProvider$GFServerAuthContext.validateRequest(GFServerConfigProvider.java:1175)
at com.sun.web.security.RealmAdapter.validate(RealmAdapter.java:1627)
at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1494)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:585)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:702)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
]]

and access http://localhost:4848/management/domain, error as follows:
[2013-04-16T09:50:59.010+0800] [glassfish 4.0] [INFO] [NCLS-REST-00003] [javax.enterprise.admin.rest] [tid: _ThreadID=43 _ThreadName=admin-listener(4)] [timeMillis: 1366077059010] [levelValue: 800] [[
An error occurred while processing the request. Please see the server logs for details.
org.glassfish.jersey.server.ContainerException: java.lang.AbstractMethodError: javax.ws.rs.core.Response.getStatusInfo()Ljavax/ws/rs/core/Response$StatusType;
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer$ResponseWriter.rethrow(GrizzlyHttpContainer.java:274)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer$ResponseWriter.failure(GrizzlyHttpContainer.java:256)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:343)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:223)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:318)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.AbstractMethodError: javax.ws.rs.core.Response.getStatusInfo()Ljavax/ws/rs/core/Response$StatusType;
at org.glassfish.jersey.message.internal.OutboundJaxrsResponse.from(OutboundJaxrsResponse.java:97)
at org.glassfish.jersey.server.ContainerResponse.<init>(ContainerResponse.java:88)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
... 29 more
]]

Comment by wizard.liyd [ 16/Apr/13 ]

hi, thanks for your help!
I deploy the web application On the Glassfish 3.1.2.2, then restart glassfish server(must restart) and debug glassfish source code, tracking to getElementLink(UriInfo uriInfo, String elementName) in ProviderUtil.java when access http://localhost:4848/management/domain/resources/jdbc-resource, uriInfo.getRequestUriBuilder()'s Implementation class isn't com.sun.jersey.api.uri.UriBuilderImpl but is org.apache.cxf.jaxrs.impl.UriBuilderImpl(there is a cxf-rt-frontend-jaxrs-2.2.5.jar in application/WEB-INFO/lib).

The org.apache.cxf.jaxrs.impl.UriBuilderImpl is in the cxf-rt-frontend-jaxrs-2.2.5.jar, cxf-rt-frontend-jaxrs-2.2.5.jar belong to applicatioin layer. The application class loader is lower in the hierarchy. But in this case, the class loader first load cxf-rt-frontend-jaxrs-2.2.5.jar than jersey-core.jar(the jersey-core.jar is in glassfish3.1.2.2\glassfish\modules).

And, When I access the http://localhost:4848/management/domain/resources/jdbc-resource, the class loader loaded the UriBuildImpl class of application layer, it's unresonable. As a matter of fact, the class loader should be load the UriBuildImpl class of jersey-cor.jar.

Generated at Fri Sep 30 22:41:46 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.