[GLASSFISH-21717] Implement HTTP trailer SERVLET_SPEC-166 Created: 14/Apr/17  Updated: 19/Apr/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: servlet_4_0
Sprint: MS 5 Sprint 2

 Description   

Implement HTTP trailer in GlassFish.
Depends on GRIZZLY-1897






[GLASSFISH-20720] EAR deployment with multiple embedded WARs broken in 3.1.2.2 and 4.0 Created: 22/Jul/13  Updated: 19/Apr/17

Status: In Progress
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1, 4.0_dev
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: nabizamani Assignee: diksha.nagpal
Resolution: Unresolved Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RedHat Linux, Windows, Ubuntu Linux


Attachments: File TestApp.ear     File TestApp.ear    
Tags: 3_1-next, 3_1_1-scrubbed, 3_1_2-exclude, metro2_2-waived

 Description   

We are trying to upgrade to 3.1. Our application is packaged and deployed as an EAR file with multiple EJB and WARs embedded. Some of the WAR files have web services for deployment, and some do not. The 3.1 deployment mechanism is fundamentally broken in this case. It appears that the web service deployment piece ends up scanning all the wars in the EAR for metadata (annotations), and then trying to deploy the collected web services in every WAR in the EAR, not just the one that had the annotated web service classes.

This appears to be the same symptoms as the following bug, but for web services instead.

http://java.net/jira/browse/JAVASERVERFACES-1995

I have attached a very simple test EAR file. Trying to deploy this will demonstrate the error. You will see error messages about duplicate web service deployments and class not found exceptions.



 Comments   
Comment by nabizamani [ 22/Jul/13 ]

I created this clone of https://java.net/jira/browse/GLASSFISH-16249 because the issue reported still exists in GF 3.1.2.2.
A similar issue also exists in GF 4.0.

Below you can see the different outputs (I used an own ear which contains an ejb module and 2 war modules of which one contains restful classes):

  • Glassfish 3.1.2.2 (build 5)
    WARNING: WEB9052: Unable to load class com.demo.service.exception.RestExceptionCatcher, reason: java.lang.ClassNotFoundException: com.demo.service.exception.RestExceptionCatcher
    WARNING: WEB9052: Unable to load class com.demo.service.rss.NewsFeed, reason: java.lang.ClassNotFoundException: com.demo.service.rss.NewsFeed
  • Glassfish 4.0 (build 89).
    WARNING: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
    WARNING: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
    INFO: Registering the Jersey servlet application, named com.demo.jaxrs.application.ApplicationConfig, at the servlet mapping /*, with the Application class of the same name.
    WARNING: Unable to load class com.demo.jaxrs.application.ApplicationConfig, reason: java.lang.ClassNotFoundException: com.demo.jaxrs.application.ApplicationConfig
    WARNING: Unable to load class com.demo.tutorials.mavenstruts.service.MessageService, reason: java.lang.ClassNotFoundException: com.demo.tutorials.mavenstruts.service.MessageService
    WARNING: Unable to load class com.demo.tutorials.mavenstruts.service.MessageService, reason: java.lang.ClassNotFoundException: com.demo.tutorials.mavenstruts.service.MessageService
    WARNING: Unable to load class com.demo.jaxrs.provider.MyJacksonJsonProvider, reason: java.lang.ClassNotFoundException: com.demo.jaxrs.provider.MyJacksonJsonProvider
    WARNING: Unable to load class com.demo.jaxrs.application.ApplicationConfig, reason: java.lang.ClassNotFoundException: com.demo.jaxrs.application.ApplicationConfig

Furthermore In GF 4.0 I get a lot of messages of this kind (which I really hate):
INFO: visiting unvisited references

Comment by Lukas Jungmann [ 01/Aug/13 ]

passing to jax-rs for evaluation since jar-rs seems to be involved here

Comment by Lukas Jungmann [ 01/Aug/13 ]

assign as needed, please. thx.

Comment by replicant77 [ 09/Sep/13 ]

We also get the ClassNotFoundException messages in multi-war deployments. But not only for rest service classes, but also for jsf related classes, like jsf converters and validators:

WARNING: WEB9052: Unable to load class gf4test.rest.TestService, reason: java.lang.ClassNotFoundException: gf4test.rest.TestService
WARNING: WEB9052: Unable to load class gf4test.converters.TestConverter1, reason: java.lang.ClassNotFoundException: gf4test.converters.TestConverter1

If you have a lot of such classes in your application this can get really annoying. We noticed these warning messages on GF 3.1.2 as well as GF4.

Comment by TangYong [ 10/Sep/13 ]

replicant77

Your attachment has problem and while deploying your attachment into 4.0.1-b02, the following error happened,

[2013-09-10T11:18:40.508+0900] [glassfish 4.0] [WARNING] [] [org.apache.jasper.runtime.TldScanner] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520508] [levelValue: 900] [[
PWC6351: In TLD scanning, the supplied resource file:/E:/NanjingJUG/glassfish-4.0.1-b02/glassfish4/glassfish/domains/domain1/applications/TestApp/TestApp-ejbClient.jar does not exist
java.io.FileNotFoundException: E:\NanjingJUG\glassfish-4.0.1-b02\glassfish4\glassfish\domains\domain1\applications\TestApp\TestApp-ejbClient.jar (指定されたファイルが見つかりません。)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.jar.JarFile.<init>(JarFile.java:152)
at java.util.jar.JarFile.<init>(JarFile.java:89)
at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:98)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
at org.apache.jasper.runtime.TldScanner.scanJar(TldScanner.java:442)
at org.apache.jasper.runtime.TldScanner.scanJars(TldScanner.java:694)
at org.apache.jasper.runtime.TldScanner.scanTlds(TldScanner.java:350)
at org.apache.jasper.runtime.TldScanner.onStartup(TldScanner.java:239)
at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:6031)
at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:774)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5929)
at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:404)
at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
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 org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:140)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:158)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:101)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:353)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:343)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:237)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:211)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:982)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:330)
at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:496)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:175)
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:187)
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:837)
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:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:722)
]]

[2013-09-10T11:18:40.867+0900] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520867] [levelValue: 800] [[
Loading application TestApp#TestApp-war.war at [TestApp-war]]]

[2013-09-10T11:18:40.883+0900] [glassfish 4.0] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520883] [levelValue: 900] [[
Unable to load class com.test.web.TestWebService, reason: java.lang.ClassNotFoundException: com.test.web.TestWebService]]

[2013-09-10T11:18:40.898+0900] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520898] [levelValue: 800] [[
Loading application TestApp#TestApp2-war.war at [TestApp2-war]]]

[2013-09-10T11:18:40.977+0900] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520977] [levelValue: 800] [[
TestApp was successfully deployed in 10,876 milliseconds.]]

So, I have uploaded a new attachment.

OK, current issue should be the following:

[2013-09-10T11:18:40.883+0900] [glassfish 4.0] [WARNING] [AS-WEB-UTIL-00035] [javax.enterprise.web.util] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1378779520883] [levelValue: 900] [[
Unable to load class com.test.web.TestWebService, reason: java.lang.ClassNotFoundException: com.test.web.TestWebService]]

1. the issue is not related to jax-rs comp
2. instead, firstly forwarding to web_services comp to evaluate, and I also add web_container comp to ask shing wai to evaluate it.

Comment by TangYong [ 10/Sep/13 ]

I made an initial investigation for the issue,

1) removing web_webservices comp because I have confirmed the warning info is related to web_container comp. so, pl. Shing Wai confirms

2) the warning happened in checkAgainstInterestList method from org.glassfish.web.loader.ServletContainerInitializerUtil class

In this attachment, there are two wars and TestApp2-war does not contain any class, TestApp-war contains a class with @WebService, while checkAgainstInterestList is executed, the method also scans TestApp2-war for @WebService, so, ClassNotFoundException happened.

I think this has some wrong logic because "interestList" variable in checkAgainstInterestList always saves previous result(eg. TestApp-war), for TestApp2-war, these annotations do not exist.

However, I think this issue itself should be not important and I think this should be an improvement rather than a bug.

Thanks
Tang

Comment by Shing Wai Chan [ 10/Sep/13 ]

The ClassNotFoundException warning is related to GLASSFISH-16937 .
Assign to Kinman to investigate TLDScanning FileNotFoundException.

Comment by pbelbin [ 09/Jan/14 ]

is there a fix for this issue? or, perhaps I'm having a different issue.

I have a .ear which has multiple .war contained within it that refuses to deploy.

I do see the WEB9052 warnings.

but, after that, I also see this:

[#|2014-01-09T16:29:49.206-0600|WARNING|glassfish3.1.2|javax.enterprise.webservices.org.glassfish.webservices|_ThreadID=130;_ThreadName=Thread-2;|Deployment failed
java.lang.AbstractMethodError
at org.glassfish.webservices.WsUtil.parseRelativeImports(WsUtil.java:414)
at org.glassfish.webservices.WsUtil.getWsdlsAndSchemas(WsUtil.java:1884)
at org.glassfish.webservices.WsUtil.getWsdlsAndSchemas(WsUtil.java:1858)
at org.glassfish.webservices.WSServletContextListener.registerEndpoint(WSServletContextListener.java:143)
at org.glassfish.webservices.WSServletContextListener.contextInitialized(WSServletContextListener.java:102)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)

#]
Comment by lprimak [ 12/May/16 ]

Payara team is tracking this bug here:
https://github.com/payara/Payara/issues/374





[GLASSFISH-21664] Implement Servlet 4.0 Server Push Created: 24/Jan/17  Updated: 17/Apr/17  Resolved: 17/Apr/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Task Priority: Major
Reporter: Ed Burns Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVLET_SPEC-134 Provide API supporting HTTP/2 Server ... In Progress
Tags: servlet_4_0
Sprint: MS 4 Sprint 1, MS 5 Sprint 1

 Description   

Implementation issue for SERVLET_SPEC-134.



 Comments   
Comment by Shing Wai Chan [ 17/Mar/17 ]

Revisions:
----------
64819

Modified Paths:
---------------
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/LogFacade.java
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java
trunk/main/nucleus/pom.xml

Added Paths:
------------
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/core/ApplicationPushBuilder.java

Comment by Shing Wai Chan [ 17/Mar/17 ]

add test case for push

Adding pushAuthorization
Adding pushAuthorization/WebTest.java
Adding pushAuthorization/build.properties
Adding pushAuthorization/build.xml
Adding pushAuthorization/descriptor
Adding pushAuthorization/descriptor/glassfish-web.xml
Adding pushAuthorization/descriptor/web.xml
Adding pushAuthorization/docroot
Adding pushAuthorization/docroot/index.html
Adding pushAuthorization/docroot/my.css
Adding pushAuthorization/servlet
Adding pushAuthorization/servlet/test
Adding pushAuthorization/servlet/test/TestServlet.java
Adding pushCacheable
Adding pushCacheable/WebTest.java
Adding pushCacheable/build.properties
Adding pushCacheable/build.xml
Adding pushCacheable/docroot
Adding pushCacheable/docroot/index.html
Adding pushCacheable/servlet
Adding pushCacheable/servlet/test
Adding pushCacheable/servlet/test/TestServlet.java
Adding pushCacheable/servlet/test/TestServlet2.java
Adding pushStatic
Adding pushStatic/WebTest.java
Adding pushStatic/build.properties
Adding pushStatic/build.xml
Adding pushStatic/docroot
Adding pushStatic/docroot/index.html
Adding pushStatic/docroot/my.css
Adding pushStatic/servlet
Adding pushStatic/servlet/test
Adding pushStatic/servlet/test/TestServlet.java
Transmitting file data ....................done
Committing transaction...
Committed revision 64823.

Comment by Shing Wai Chan [ 30/Mar/17 ]

r64888 | swchan2 | 2017-03-29 22:46:24 -0700 (Wed, 29 Mar 2017) | 2 lines

rename HttpServletRequest#getPushBuilder to #newPushBuilder





[GLASSFISH-21690] when the session is timed out and is not detected by the ContainerBackgroundProcessor thread, the request that sends the session will occur the error of 'java.lang.ClassNotFoundException' Created: 01/Mar/17  Updated: 02/Apr/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: liuj-fnst Assignee: Vinay Vishal
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

when the session is timed out and is not detected by the ContainerBackgroundProcessor thread, the request that sends the session will occur the following error:
[#|2017-01-26T16:36:03.428+0900|SEVERE|||_ThreadID=161;_ThreadName=http-thread-pool-28292(15);|java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at mypack.MyData.valueUnbound(MyData.java:36)
at org.apache.catalina.session.StandardSession.removeAttribute(StandardSession.java:1593)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:865)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:769)
at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:686)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2942)
at org.apache.catalina.connector.Request.getSessionInternal(Request.java:2847)
at org.apache.catalina.connector.Request.lockSession(Request.java:4254)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:403)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:253)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:319)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:197)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:907)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:792)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1106)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:231)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:542)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:520)
at java.lang.Thread.run(Thread.java:722)

the processing of 'mypack.MyData.valueUnbound':
public void valueUnbound(HttpSessionBindingEvent event){
try

{ ClassLoader cl = Thread.currentThread().getContextClassLoader(); Class.forName("my.test",false,cl); }

catch (ClassNotFoundException e)

{ e.printStackTrace(); }

}

Discover the cause by Debug:

The request is processed by the HttpWorkerThread,HttpWorkerThread's ContextClassLoader has the following changes

1 Before calling the processing of application is 'org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5' (include 'org.apache.catalina.connector.Request.lockSession')
2 During calling the processing of application is 'org.glassfish.web.loader.WebappClassLoader'.(by 'StandardHostValve.preInvoke')
3 After calling the processing of application is 'org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5'.
when the lockSession is excuting, HttpWorkerThread's ContextClassLoader is BundleClassLoaderJava5,
however, 'my.test' was loaded by WebappClassLoader,so the error of ClassNotFoundException will occur.



 Comments   
Comment by liuj-fnst [ 13/Mar/17 ]

After verifying, before the process of ‘expire’, change the thread ContextClassLoader to WebappClassLoader, it seems to avoid the problem.
The sample code is as follows:

org.apache.catalina.session.StandardSession.expire
public void expire(boolean notify, boolean persistentRemove) {

ClassLoader oldCls = null;
boolean isCurClsChg = false;

// Mark this session as "being expired" if needed
if (expiring)
return;

synchronized (this) {

if (manager == null)
return;

expiring = true;

try {

if( notify && context != null && context.getLoader() != null )

{ oldCls = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader (context.getLoader().getClassLoader()); isCurClsChg = true; }

// Notify interested application event listeners
// FIXME - Assumes we call listeners in reverse order
List<HttpSessionListener> listeners = context.getSessionListeners();

...ignore...

// Notify interested session event listeners
if (notify)

{ context.sessionExpiredEvent(this); fireSessionEvent(Session.SESSION_DESTROYED_EVENT, null); }

}
finally

{ if( isCurClsChg ) Thread.currentThread().setContextClassLoader(oldCls); }

}





[GLASSFISH-21388] NullPointerException at org.apache.jasper.compiler.TagLibraryInfoImpl.toString Created: 08/Jul/15  Updated: 31/Mar/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Cai_Ming Assignee: rutujay
Resolution: Unresolved Votes: 0
Labels: waiting_on_filer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issuezilla Id: 21,388
Tags: <validator>, TLD

 Description   

When I accessed my applicaton,I've got such error message:
<pre>
--------------------------------
[#|2015-07-07T11:22:40.765+0800|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web._vs.server|_ThreadID=131;_ThreadName=Thread-27;|ApplicationDispatcher[/sample]
PWC1231: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jasper.compiler.TagLibraryInfoImpl.toString(TagLibraryInfoImpl.java:129)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuilder.append(StringBuilder.java:115)
at java.util.AbstractMap.toString(AbstractMap.java:490)
at java.lang.String.valueOf(String.java:2826)
at java.lang.StringBuffer.append(StringBuffer.java:219)
at org.apache.jsp.request_jsp._jspService(request_jsp.java from :68)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
--------------------------------
</pre>
The following is the coding of the org.apache.jasper.compiler.TagLibraryInfoImpl.toString.
<pre>
--------------------------------
public String toString()

{ StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); print("tlibversion", tlibversion, out); print("jspversion", jspversion, out); print("shortname", shortname, out); print("urn", urn, out); print("info", info, out); print("uri", uri, out); LINRE129 print("tagLibraryValidator", tagLibraryValidator.toString(), out); for(int i = 0; i < tags.length; i++) out.println(tags[i].toString()); for(int i = 0; i < tagFiles.length; i++) out.println(tagFiles[i].toString()); for(int i = 0; i < functions.length; i++) out.println(functions[i].toString()); return sw.toString(); }

--------------------------------
</pre>
LINRE129 is the place where the NullPointerException happened.
In my application,the element of <validator> is not defined in the TLD file.

as we know,if we don't want to test the TagLibrary,
there is no necessary to define the element of <validator>.

So,the phenomenon is a glassfish internal bug?

For this problem,Tomcat modified.
The following is modified details.
https://svn.apache.org/viewvc?view=revision&revision=306188

So, the LINRE129 should also be modified to
[print("tagLibraryValidator", "" + tagLibraryValidator, out);] in the glassfish?
</pre>



 Comments   
Comment by rutujay [ 31/Mar/17 ]

Please provide an application and steps to reproduce the problem.





[GLASSFISH-21711] ServletContext#setAttribute with null parameter name Created: 27/Mar/17  Updated: 29/Mar/17  Resolved: 29/Mar/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: servlet_4_0
Sprint: MS 5 Sprint 1

 Description   

SERVLET_SPEC-83 specifies ServletContext#getInitParameter with null name parameter.
Also, it specifies the behavior for ServletContext#setAttribute, too.

GlassFish has the first behavior and needs to implement the second behavior.



 Comments   
Comment by Shing Wai Chan [ 27/Mar/17 ]

Sending src/main/java/org/apache/catalina/LogFacade.java
Sending src/main/java/org/apache/catalina/core/ApplicationContext.java
Transmitting file data ..
Committed revision 64878.





[GLASSFISH-21688] Implement SERVLET_SPEC-161 Created: 28/Feb/17  Updated: 24/Mar/17  Resolved: 15/Mar/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVLET_SPEC-161 Allow request/response encoding to be... Resolved
Tags: servlet_4_0
Sprint: MS 4 Sprint 1, MS 4 Sprint 2

 Description   

Implementation issue for SERVLET_SPEC-161



 Comments   
Comment by Shing Wai Chan [ 01/Mar/17 ]

Sending deployment/schemas/src/main/resources/glassfish/lib/schemas/web-app_4_0.xsd
Transmitting file data .
Committed revision 64667.

Comment by Shing Wai Chan [ 02/Mar/17 ]

Revisions:
----------
64697

Modified Paths:
---------------
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/core/ApplicationContext.java
trunk/main/nucleus/pom.xml
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/core/ApplicationContextFacade.java
trunk/main/appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java

Comment by Shing Wai Chan [ 02/Mar/17 ]

add tests:
Adding contextCharEncoding
Adding contextCharEncoding/WebTest.java
Adding contextCharEncoding/build.properties
Adding contextCharEncoding/build.xml
Adding contextCharEncoding/descriptor
Adding contextCharEncoding/descriptor/web.xml
Adding contextCharEncoding/servlet
Adding contextCharEncoding/servlet/MyServletContextListener.java
Adding contextCharEncoding/servlet/TestServlet.java
Adding reqResEncoding
Adding reqResEncoding/WebTest.java
Adding reqResEncoding/build.properties
Adding reqResEncoding/build.xml
Adding reqResEncoding/descriptor
Adding reqResEncoding/descriptor/web.xml
Adding reqResEncoding/servlet
Adding reqResEncoding/servlet/TestServlet.java
Transmitting file data ...........done
Committing transaction...
Committed revision 64706.

Comment by Ed Burns [ 14/Mar/17 ]

Also make sure to update Figure 14-1 to add the new elements.

Comment by Shing Wai Chan [ 14/Mar/17 ]

Rename request/response-encoding to request/response-character-encoding:

Sending appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/WebBundleDescriptor.java
Sending appserver/deployment/schemas/src/main/resources/glassfish/lib/schemas/web-app_4_0.xsd
Sending appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModule.java
Sending appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/descriptor/WebBundleDescriptorImpl.java
Sending appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/node/WebBundleNode.java
Sending appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/xml/WebTagNames.java
Transmitting file data ......
Committed revision 64792.

Comment by Shing Wai Chan [ 14/Mar/17 ]

update test for new xml element names

Sending contextCharEncoding/descriptor/web.xml
Sending reqResEncoding/WebTest.java
Sending reqResEncoding/descriptor/web.xml
Transmitting file data ...
Committed revision 64793.

Comment by Shing Wai Chan [ 15/Mar/17 ]

Revisions:
----------
64792

Modified Paths:
---------------
trunk/main/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/WebModule.java
trunk/main/appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/xml/WebTagNames.java
trunk/main/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/WebBundleDescriptor.java
trunk/main/appserver/deployment/schemas/src/main/resources/glassfish/lib/schemas/web-app_4_0.xsd
trunk/main/appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/node/WebBundleNode.java
trunk/main/appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/descriptor/WebBundleDescriptorImpl.java





[GLASSFISH-21708] Implement SERVLET_SPEC-171 Created: 24/Mar/17  Updated: 24/Mar/17  Resolved: 24/Mar/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: servlet_4_0
Sprint: MS 4 Sprint 2

 Description   

Implementation issue for SERVLET_SPEC-171.



 Comments   
Comment by Shing Wai Chan [ 24/Mar/17 ]

Sending appserver/web/web-core/src/main/java/org/apache/catalina/core/ApplicationPushBuilder.java
Sending appserver/web/web-core/src/main/java/org/apache/catalina/core/StandardContext.java
Transmitting file data ..
Committed revision 64876.





[GLASSFISH-21707] Dead lock occurs when both HttpSession#invalidate() and HttpServletRequest#getAttribute(String) are called at the same time. Created: 23/Mar/17  Updated: 23/Mar/17

Status: Open
Project: glassfish
Component/s: cdi, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: yama0428 Assignee: ankur.kathuria
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Dead lock occurs when both HttpSession#invalidate() and HttpServletRequest#getAttribute(String) are called at the same time.

This is a reproducible application.

TestServlet.java
package test.session.deadlock;

import java.io.IOException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet(urlPatterns={"/test"})
public class TestServlet extends HttpServlet {
    static int counter = 0;
    
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
        HttpSession session = req.getSession();

        boolean invalidate = Boolean.valueOf((String) req.getParameter("invalidate"));
        if(invalidate) {
            session.invalidate();
        }
        
        Integer id = null;
        synchronized(TestListener.lock) {
            id = (Integer)session.getAttribute("id");
        }
        
        if(id == null) {
            id = ++counter;
            session.setAttribute("id", counter);
            session.setMaxInactiveInterval(60);
        }
        
        res.getWriter().println("id="+id);
    }
}
TestListener.java
package test.session.deadlock;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

@WebListener
public class TestListener implements HttpSessionListener {
    static final Object lock = new Object(); 
    
    @Override
    public void sessionCreated(HttpSessionEvent event) {
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent event) {
        synchronized(lock) {
            System.out.println("sessionDestroyed called");
        }
    }

}

Servlet calls HttpSession#getAttribute() in synchronized block.
In getAttribute method, session object is locked in order to check foreground session lock.

StandardSession.java
    public boolean isForegroundLocked() {
        //in this case we are not using locks
        //so just return false
        if(_sessionLock == null)
            return false;        
        synchronized(this) {
            return _sessionLock.isForegroundLocked();
        } 
    }  

Moreover, HttpSessionListener#sessionDestroyed() uses synchronized block.
HttpSessionListener#sessionDestroyed() is called after locking session object.

StandardSession.java
    public void expire(boolean notify, boolean persistentRemove) {

        // Mark this session as "being expired" if needed
        if (expiring)
            return;

        synchronized (this) {

            if (manager == null)
                return;

            expiring = true;
        
            // Notify interested application event listeners
            // FIXME - Assumes we call listeners in reverse order

            // The call to expire() may not have been triggered by the webapp.
            // Make sure the webapp's class loader is set when calling the
            // listeners
            ClassLoader oldTccl = null;
            if (context.getLoader() != null &&
                    context.getLoader().getClassLoader() != null) {
                oldTccl = Thread.currentThread().getContextClassLoader();
                if (Globals.IS_SECURITY_ENABLED) {
                    PrivilegedAction<Void> pa = new PrivilegedSetTccl(
                            context.getLoader().getClassLoader());
                    AccessController.doPrivileged(pa);
                } else {
                    Thread.currentThread().setContextClassLoader(
                            context.getLoader().getClassLoader());
                }
            }
            try {
                List<HttpSessionListener> listeners = context.getSessionListeners();
                if (notify && !listeners.isEmpty()) {
                    HttpSessionEvent event = new HttpSessionEvent(getSession());
                    int len = listeners.size();
                    for (int i = 0; i < len; i++) {
                        // Invoke in reverse order of declaration
                        HttpSessionListener listener = listeners.get((len - 1) - i);
                        try {
                            fireContainerEvent(context,
                                               "beforeSessionDestroyed",
                                               listener);
                            listener.sessionDestroyed(event);
                            fireContainerEvent(context,
                                               "afterSessionDestroyed",
                                               listener);
                        } catch (Throwable t) {
                            try {
                                fireContainerEvent(context,
                                                   "afterSessionDestroyed",
                                                   listener);
                            } catch (Exception e) {
                                // Ignore
                            }
                            // FIXME - should we do anything besides log these?
                            log(rb.getString(SESSION_EVENT_LISTENER_EXCEPTION), t);
                        }
                    }
                }
            } finally {
                if (oldTccl != null) {
                    if (Globals.IS_SECURITY_ENABLED) {
                        PrivilegedAction<Void> pa =
                            new PrivilegedSetTccl(oldTccl);
                        AccessController.doPrivileged(pa);
                    } else {
                        Thread.currentThread().setContextClassLoader(oldTccl);
                    }
                }
            }

This is the thread dump for dead lock.

Found one Java-level deadlock:
=============================
"ContainerBackgroundProcessor[StandardEngine[glassfish-web].StandardHost[server].StandardContext[/sessiondeadlock]]":
  waiting to lock monitor 0x000000005add7ee8 (object 0x00000000f6484960, a org.apache.catalina.session.StandardSession),
  which is held by "http-listener-1(8)"
"http-listener-1(8)":
  waiting to lock monitor 0x00000000527deb48 (object 0x00000000f60af8c8, a java.lang.Object),
  which is held by "http-listener-1(2)"
"http-listener-1(2)":
  waiting to lock monitor 0x000000005add7ee8 (object 0x00000000f6484960, a org.apache.catalina.session.StandardSession),
  which is held by "http-listener-1(8)"

Java stack information for the threads listed above:
===================================================
"http-listener-1(8)":
	at test.session.deadlock.TestListener.sessionDestroyed(TestListener.java:18)
	- waiting to lock <0x00000000f60af8c8> (a java.lang.Object)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:910)
	- locked <0x00000000f6484960> (a org.apache.catalina.session.StandardSession)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:854)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:842)
	at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1603)
	at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:204)
	at test.session.deadlock.TestServlet.doGet(TestServlet.java:20)
"http-listener-1(2)":
	at org.apache.catalina.session.StandardSession.isForegroundLocked(StandardSession.java:1480)
	- waiting to lock <0x00000000f6484960> (a org.apache.catalina.session.StandardSession)
	at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:756)
	at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1354)
	at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:152)
	at test.session.deadlock.TestServlet.doGet(TestServlet.java:25)
	- locked <0x00000000f60af8c8> (a java.lang.Object)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)

Because the order of acquiring lock object is different between two threads,
dead lock occurs.

Moreover, the latest weld implementation (2.4.2 or 3.0.0) has the same structure.
So the same dead lock will occur if GF5.0 is released with the latest weld implementation.

When I replace weld of GF4.1.1(2.2.13) by newer version,
following dead lock occurs.

Daemon Thread [http-listener-1(40)] (Suspended)	
	owns: Collections$SynchronizedMap<K,V>  (id=180)	
		waited by: Daemon Thread [http-listener-1(7)] (Suspended)	
	waiting for: StandardSession  (id=179)	
		owned by: Daemon Thread [http-listener-1(7)] (Suspended)	
	StandardSession.isForegroundLocked() line: 1479	         *****lock of StandardSession
	StandardSession.isValid() line: 756	
	StandardSession.getAttribute(String) line: 1354	
	StandardSessionFacade.getAttribute(String) line: 152	
	EagerSessionBeanStore(AbstractSessionBeanStore).getAttribute(String) line: 88	
	EagerSessionBeanStore(AttributeBeanStore).attach() line: 98	
	LazyHttpConversationContextImpl(AbstractConversationContext<R,S>).destroyConversation(S, String) line: 403	
	LazyHttpConversationContextImpl(AbstractConversationContext<R,S>).cleanUpConversationMap() line: 322	             *****lock of Conversations Map of weld)
	LazyHttpConversationContextImpl(AbstractConversationContext<R,S>).deactivate() line: 306	
	LazyHttpConversationContextImpl.deactivate() line: 98	
	ConversationContextActivator.deactivateConversationContext(HttpServletRequest) line: 166	
	HttpContextLifecycle.requestDestroyed(HttpServletRequest) line: 276	
	WeldListener(WeldInitialListener).requestDestroyed(ServletRequestEvent) line: 150	
	WebModule(StandardContext).fireRequestDestroyedEvent(ServletRequest) line: 5294	
	StandardHostValve.postInvoke(Request, Response) line: 255	
Daemon Thread [http-listener-1(7)] (Suspended)	
	owns: StandardSession  (id=179)	
		waited by: Daemon Thread [http-listener-1(40)] (Suspended)	
		waited by: Daemon Thread [http-listener-1(33)] (Running)	
		waited by: Daemon Thread [http-listener-1(31)] (Running)	
		waited by: Daemon Thread [http-listener-1(18)] (Running)	
		waited by: Daemon Thread [ContainerBackgroundProcessor[StandardEngine[glassfish-web].StandardHost[server].StandardContext[/apl]]] (Suspended)	
		waited by: Daemon Thread [http-listener-1(10)] (Running)	
		waited by: Daemon Thread [http-listener-1(9)] (Running)	
		waited by: Daemon Thread [http-listener-1(1)] (Running)	
	waiting for: Collections$SynchronizedMap<K,V>  (id=180)	
		owned by: Daemon Thread [http-listener-1(40)] (Suspended)	
	LazyHttpConversationContextImpl(AbstractConversationContext<R,S>).destroy(S) line: 366	          *****lock of Conversations Map of weld
	LazyHttpConversationContextImpl.destroy(HttpSession) line: 116	
	HttpSessionContextImpl.destroy(HttpSession) line: 63	
	HttpContextLifecycle.sessionDestroyed(HttpSession) line: 154	
	WeldListener(WeldInitialListener).sessionDestroyed(HttpSessionEvent) line: 144	
	StandardSession.expire(boolean, boolean) line: 910	*****lock of StandardSession
	StandardSession.expire(boolean) line: 854	
	StandardSession.expire() line: 842	
	StandardSession.invalidate() line: 1603	
	StandardSessionFacade.invalidate() line: 204	
	CDIServlet.doGet(HttpServletRequest, HttpServletResponse) line: 59	


 Comments   
Comment by yama0428 [ 23/Mar/17 ]

Sorry, the title is incorrect.
The correct title is following.

Dead lock occurs when both HttpSession#invalidate() and HttpSession#getAttribute(String) are called at the same time.





[GLASSFISH-21409] Encoding mapping key search error Created: 07/Aug/15  Updated: 20/Mar/17  Resolved: 20/Mar/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: mahairod Assignee: Kokil_Jain
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux Fedora 22, jdk8, glassfish-4.1, LC_NAME="ru_RU.UTF-8"


Tags: config, encoding, wait

 Description   

Method getCharset of class org.apache.catalina.util.CharsetMapper does mot recognise locale string if it consists of parts separated by "-". As a result <locale-encoding-mapping-list> setting of web.xml is not working properly.



 Comments   
Comment by Kokil_Jain [ 17/Feb/17 ]

I am unable to reproduce the bug.
Can you please provide with the exact steps to reproduce the bug and also the sample application ?

Comment by mahairod [ 17/Feb/17 ]

it;s enough to place encoding mappings tio web.xml of any webapp and deploy it

Comment by Kokil_Jain [ 20/Mar/17 ]

Fixed by r64830





[GLASSFISH-21652] ConnectionQueueStatsProvider.java#onTaskQueuedEvent is not counted correctly when there exists plural acceptor threads Created: 26/Dec/16  Updated: 20/Mar/17  Resolved: 20/Mar/17

Status: Resolved
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: Vinay Vishal
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

ConnectionQueueStatsProvider#onTaskQueuedEvent is not counted correctly when there exists plural acceptor threads.
This is because peakQueuedAtomic.compareAndSet and peakQueued.setCount are not atomic.

This is the patch for this problem.

ConnectionQueueStatsProvider.java
    @ProbeListener("glassfish:kernel:connection-queue:onTaskQueuedEvent")
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();
            countQueued.setCount(queued);

            do {
                final int peakQueue = peakQueuedAtomic.get();
                if (queued <= peakQueue) break;

                synchronized(peakQueuedAtomic) {
                    if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {
                        peakQueued.setCount(peakQueuedAtomic.get());
                        break;
                    }
                }
            } while (true);

            countTotalQueued.increment();

            incAverageMinute();
        }
    }


 Comments   
Comment by Vinay Vishal [ 16/Jan/17 ]

AtomicInteger is inherently thread safe. Hence, I believe there is no need of synchronization here. In case of multiple acceptor threads, it may be possible that a request has been put in the connection queue by another thread and onTaskQueuedEvent gets called, which probably could have changed the value of peakQueueAtomic and hence out of three fields being set when onTaskQueuedEvent gets called, there is a possibility that peakQueued may have the stale value, since the value stored in "queued " local variable gets set for this field which might would have got changed in interim. Other two fields namely "countQueued" and "countTotalQueued" will have the correct values. We probably can just make this change:

peakQueued.setCount(peakQueuedAtomic.get());

Do you have a test case? If so, can you please provide the same?

Comment by yama0428 [ 17/Jan/17 ]

Assume that two requests are sent simultaneously.

ConnectionQueueStatsProvider.java
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();       //code 1
            countQueued.setCount(queued);                                 //code 2

            do {
                final int peakQueue = peakQueuedAtomic.get();             //code 3
                if (queued <= peakQueue) break;                           //code 4

                if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {  //code 5
                    peakQueued.setCount(queued);                          //code 6
                    break;
                }
            } while (true);                                               //code 7

            countTotalQueued.increment();

            incAverageMinute();
        }
    }
step thread1 thread2 peakQueuedAtomic peakQueued
1 code1. queued : 1 - 0 0
2 code2. countQueued : 1 - 0 0
3 code3. peakQueue : 0 - 0 0
4 code4. queued <= peakQueue : false - 0 0
5 - code1. queued : 2 0 0
6 - code2. countQueued : 2 0 0
7 - code3. peakQueue : 0 0 0
8 - code4. queued <= peakQueue : false 0 0
9 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true - 0->1 0
10 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false 1 0
11 - code7. 1 0
12 - code3. peakQueue : 1 1 0
13 - code4. queued <= peakQueue : false 1 0
14 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 1->2 0
15 - code6. peakQueued : 2(value of "queued" in thread2 is set) 2 0->2
16 code6. peakQueued :1(value of "queued" in thread1 is set) - 2 2->1

In this case, at step 16, old value is set to peakQueued.

Even if code 6 is the following code,

peakQueued.setCount(peakQueuedAtomic.get());

peakQueued may be old value by the following case.

ConnectionQueueStatsProvider.java (code 6 is changed)
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();       //code 1
            countQueued.setCount(queued);                                 //code 2

            do {
                final int peakQueue = peakQueuedAtomic.get();             //code 3
                if (queued <= peakQueue) break;                           //code 4

                if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {  //code 5
                    peakQueued.setCount(peakQueuedAtomic.get());          //code 6'
                    break;
                }
            } while (true);                                               //code 7

            countTotalQueued.increment();

            incAverageMinute();
        }
    }
step thread1 thread2 peakQueuedAtomic peakQueued
1 code1. queued : 1 - 0 0
2 code2. countQueued : 1 - 0 0
3 code3. peakQueue : 0 - 0 0
4 code4. queued <= peakQueue : false - 0 0
5 - code1. queued : 2 0 0
6 - code2. countQueued : 2 0 0
7 - code3. peakQueue : 0 0 0
8 - code4. queued <= peakQueue : false 0 0
9 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true - 0->1 0
10 code6'-1. peakQueuedAtomic.get() : 1 - 1 0
11 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false 1 0
12 - code7. 1 0
13 - code3. peakQueue : 1 1 0
14 - code4. queued <= peakQueue : false 1 0
15 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 1->2 0
16 - code6'-1. peakQueuedAtomic.get() : 2 2 0
17 - code6'-2. peakQueued.setCount : 2(value of step 16 is set) 2 0->2
18 code6'-2. peakQueued.setCount : 1(value of step 10 is set) - 2 2->1

I think "peakQueuedAtomic.get()" and "peakQueued.setCount" are not atomic(step 10 - step 18).
So synchronized block is needed.

Comment by Vinay Vishal [ 27/Jan/17 ]

Hi, The scenario got simulated and indeed there is an issue. The proposed solution works fine, but I guess we just need to synchronize peakQueued.setCount(peakQueuedAtomic.get());, so that it gets executed as one atomic operation:

Below is the comparison between the two approaches. As we can see just synchronizing peakQueued.setCount(peakQueuedAtomic.get());, will solve the problem.

Approach 1:

ConnectionQueueStatsProvider.java
        @ProbeListener("glassfish:kernel:connection-queue:onTaskQueuedEvent")
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();         // code 1
            countQueued.setCount(queued);                                   // code 2

            do {
                final int peakQueue = peakQueuedAtomic.get();               // code 3
                if (queued <= peakQueue) break;                             // code 4

                synchronized (peakQueuedAtomic) {                           // code 5
                    if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {// code 6
                        peakQueued.setCount(peakQueuedAtomic.get());        // code 7
                        break;
                    }
                }
            } while (true);                                                 // code 8

            countTotalQueued.increment();

            incAverageMinute();
        }
    }
step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 code2. - 1 1 0 0
3 code3. peakQueue : 0 - 1 1 0 0
4 code4. queued <= peakQueue : false - 1 1 0 0
5 - code1. queued : 2 2 1 0 0
6 - code2. 2 2 0 0
7 - code3. peakQueue : 0 2 2 0 0
8 - code4. queued <= peakQueue : false 2 2 0 0
9 - code5. Acquires lock 2 2 0 0
10 - code6. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 0->2 0
11 - code7. 2 2 2 2
12 code 5. Acquires lock - 2 2 2 2
13 code6. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false - 2 2 2 2

Approach 2:

ConnectionQueueStatsProvider.java
        @ProbeListener("glassfish:kernel:connection-queue:onTaskQueuedEvent")
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();         // code 1
            countQueued.setCount(queued);                                   // code 2

            do {
                final int peakQueue = peakQueuedAtomic.get();               // code 3
                if (queued <= peakQueue) break;                             // code 4


                    if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {// code 5
                synchronized (peakQueuedAtomic) {                           // code 6
                        peakQueued.setCount(peakQueuedAtomic.get());        // code 7
                        break;
                    }
                }
            } while (true);                                                 // code 8

            countTotalQueued.increment();

            incAverageMinute();
        }
    }

Execution 1

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 code2. - 1 1 0 0
3 code3. peakQueue : 0 - 1 1 0 0
4 code4. queued <= peakQueue : false - 1 1 0 0
5 - code1. queued : 2 2 1 0 0
6 - code2. 2 2 0 0
7 - code3. peakQueue : 0 2 2 0 0
8 - code4. queued <= peakQueue : false 2 2 0 0
9 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 0->2 0
10 - code6. Acquires lock 2 2 2 0
11 - code7. 2 2 2 2
12 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false - 2 2 2 2

Execution 2

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 code2. - 1 1 0 0
3 code3. peakQueue : 0 - 1 1 0 0
4 code4. queued <= peakQueue : false - 1 1 0 0
5 - code1. queued : 2 2 1 0 0
6 - code2. 2 2 0 0
7 - code3. peakQueue : 0 2 2 0 0
8 - code4. queued <= peakQueue : false 2 2 0 0
9 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 0->2 0
10 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false - 2 2 2 0
11 - code6. Acquires lock 2 2 2 0
12 - code7. 2 2 2 2

Execution 3

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 code2. - 1 1 0 0
3 code3. peakQueue : 0 - 1 1 0 0
4 code4. queued <= peakQueue : false - 1 1 0 0
5 - code1. queued : 2 2 1 0 0
6 - code2. 2 2 0 0
7 - code3. peakQueue : 0 2 2 0 0
8 - code4. queued <= peakQueue : false 2 2 0 0
9 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true - 2 2 0->1 0
10 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false 2 2 1 0
11 code6. Acquires lock - 2 2 1 0
12 code7. - 2 2 1 1
13 - code8. true 2 2 1 1
14 - code3. peakQueue: 1 2 2 1 1
15 - code4. queued <=peakQueue: false 2 2 1 1
16 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 1 -> 2 0
17 - code 6. Acquires lock 2 2 2 0
18 - code 7. 2 2 2 0->2

Execution 4

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 code2. - 1 1 0 0
3 code3. peakQueue : 0 - 1 1 0 0
4 code4. queued <= peakQueue : false - 1 1 0 0
5 - code1. queued : 2 2 1 0 0
6 - code2. 2 2 0 0
7 - code3. peakQueue : 0 2 2 0 0
8 - code4. queued <= peakQueue : false 2 2 0 0
9 code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true - 2 2 0->1 0
10 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : false 2 2 1 0
11 - code8. true 2 2 1 1
12 - code3. peakQueue: 1 2 2 1 1
13 - code4. queued <=peakQueue: false 2 2 1 1
14 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 1 -> 2 0
15 - code 6. Acquires lock 2 2 2 0
16 - code 7 2 2 2 0->2
17 code 6. Acquires lock - 2 2 2 2
18 code7. - 2 2 2 2-> 2

Apart from the issue related to peakQueued, there is an issue with countQueued too.

Following scenario highlights the problem:

Execution 5

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 - code1. queued : 2 2 0 0 0
3 - code2. 2 2 0 0
4 - code3. peakQueue : 0 2 2 0 0
5 - code4. queued <= peakQueue : false 2 2 0 0
6 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 0->2 0
7 - code 6. Acquires lock 2 2 2 0
8 - code 7. 2 2 2 0->2
9 code2. - 2 2-> 1 2 2
10 code3. peakQueue : 2 - 2 1 2 2
11 code4. queued <= peakQueue : true - 2 1 2 2

As it can be seen in this last scenario, where there are two events actually queued, countQueued gets set to 1 incorrectly.

I will be fixing both these issues. I would also like to highlight that AtomicInteger.get() is an atomic operation and would always fetch the latest value.

Comment by Vinay Vishal [ 20/Mar/17 ]

Sending nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionQueueStatsProvider.java
Transmitting file data .
Committed revision 64827.





[GLASSFISH-21670] Implement SERVLET_SPEC-73 Created: 02/Feb/17  Updated: 15/Mar/17  Resolved: 11/Mar/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Ed Burns Assignee: Ed Burns
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 1 day, 22 hours, 18 minutes
Original Estimate: Not Specified

Attachments: Text File 20170308-2139Z-GLASSFISH-21670-tests.patch     Text File 20170308-2143Z-GLASSFISH-21670.patch    
Issue Links:
Related
is related to SERVLET_SPEC-73 Provide a way to find out mapping typ... Resolved
Tags: servlet_4_0
Sprint: MS 4 Sprint 1

 Description   

Track implementation work of SERVLET_SPEC-73



 Comments   
Comment by Ed Burns [ 02/Feb/17 ]

It looks like the mapping logic in question happens in Grizzly, in org.glassfish.http.server.util.Mapper.internalMapWrapper().

Comment by Ed Burns [ 02/Feb/17 ]

Grizzly has a MappingData data structure that is populated by that method. It looks like the necessary information for the Servlet API Mapping interface is understood within internalMapWrapper(), but not all of it that is necessary for Mapping is saved. I think we can fix that.

Comment by Ed Burns [ 03/Feb/17 ]

Patch to grizzly 2.3.x.

Comment by Ed Burns [ 03/Feb/17 ]

Patch to GlassFish trunk. Assumes Servlet API from branch is in local maven repo.

Comment by Ed Burns [ 06/Feb/17 ]

Patch to Grizzli 2.3.x.

Comment by Ed Burns [ 06/Feb/17 ]

Tests.

Comment by Ed Burns [ 15/Feb/17 ]

Implement and test attributes and getServletMapping().

Comment by Ed Burns [ 16/Feb/17 ]

Assert correctness of existing implementation.

Comment by Ed Burns [ 06/Mar/17 ]

Comply with Shing-wai's review comments.

Comment by Ed Burns [ 10/Mar/17 ]

Watching <http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/371/> for correctness.

Comment by Ed Burns [ 14/Mar/17 ]

svn commit -m "Add mappingDiscovery" devtests/web/build.xml
Sending devtests/web/build.xml
Transmitting file data .
Committed revision 64782.

Comment by Ed Burns [ 15/Mar/17 ]

For the record, this passed gf-trunk-web-devtests-continuous Build #386 (Mar 14, 2017 2:03:16 PM).

deploy-war-commonpe:
[exec] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-trunk-web-devtests-continuous/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true deploy --contextroot / --force=false --precompilejsp=true --verify=false --generatermistubs=false --availabilityenabled=false --asyncreplication=true --target server --keepreposdir=false --keepfailedstubs=false --isredeploy=false --logreportederrors=true --_classicstyle=false --upload=true /scratch/BUILD_AREA/workspace/gf-trunk-web-devtests-continuous/appserv-tests/build/module/archive/web-servlet-4.0-mapping-discovery-web.war
[exec] Application deployed with name web-servlet-4.0-mapping-discovery-web.

deploy-war-commonee:

run:
[java] host: localhost.localdomain port: 45712 path: /
[java] <p> In ServletC MappingImpl

{matchValue=, pattern=/, servletName=, mappingMatch=CONTEXT_ROOT}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: //foo
[java] <p> In ServletC MappingImpl

{matchValue=foo, pattern=/, servletName=ServletC, mappingMatch=DEFAULT}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /ServletC
[java] <p> In ServletC MappingImpl

{matchValue=ServletC, pattern=/ServletC, servletName=ServletC, mappingMatch=EXACT}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /foo.Issue73
[java] <p> In ServletC MappingImpl

{matchValue=foo, pattern=*.Issue73, servletName=ServletC, mappingMatch=EXTENSION}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /path/foo
[java] <p> In ServletC MappingImpl

{matchValue=foo, pattern=/path/*, servletName=ServletC, mappingMatch=PATH}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /AAsyncDispatchToC
[java] <p> In ServletC MappingImpl

{matchValue=ServletC, pattern=/ServletC, servletName=, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: MappingImpl{matchValue=AAsyncDispatchToC, pattern=/AAsyncDispatchToC, servletName=AAsyncDispatchToC, mappingMatch=EXACT}</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /AForwardToB
[java] <p> In ServletC MappingImpl{matchValue=ServletC, pattern=/ServletC, servletName=, mappingMatch=EXACT}

</p><p> FORWARD_MAPPING: MappingImpl

{matchValue=AForwardToB, pattern=/AForwardToB, servletName=AForwardToB, mappingMatch=EXACT}

</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /BForwardToC
[java] <p> In ServletC MappingImpl

{matchValue=ServletC, pattern=/ServletC, servletName=, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: MappingImpl{matchValue=BForwardToC, pattern=/BForwardToC, servletName=BForwardToC, mappingMatch=EXACT}</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /AIncludesB
[java] <!DOCTYPE html><html><head><title>Servlet AIncludesB</title></head><body><h1>Servlet AIncludesB at </h1><p> In AIncludesB MappingImpl{matchValue=AIncludesB, pattern=/AIncludesB, servletName=AIncludesB, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><hr /><p> In BIncludesC MappingImpl{matchValue=AIncludesB, pattern=/AIncludesB, servletName=AIncludesB, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: MappingImpl{matchValue=BIncludesC, pattern=/BIncludesC, servletName=, mappingMatch=EXACT}</p><hr /><p> In ServletC MappingImpl{matchValue=AIncludesB, pattern=/AIncludesB, servletName=AIncludesB, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: MappingImpl{matchValue=ServletC, pattern=/ServletC, servletName=, mappingMatch=EXACT}

</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /BIncludesC
[java] <p> In BIncludesC MappingImpl

{matchValue=BIncludesC, pattern=/BIncludesC, servletName=BIncludesC, mappingMatch=EXACT}</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><hr /><p> In ServletC MappingImpl{matchValue=BIncludesC, pattern=/BIncludesC, servletName=BIncludesC, mappingMatch=EXACT}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: MappingImpl

{matchValue=ServletC, pattern=/ServletC, servletName=, mappingMatch=EXACT}

</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /a/foo
[java] <p> In ServletC MappingImpl

{matchValue=foo, pattern=/a/*, servletName=ServletC, mappingMatch=PATH}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] host: localhost.localdomain port: 45712 path: /f
[java] <p> In ServletC MappingImpl

{matchValue=f, pattern=/, servletName=ServletC, mappingMatch=DEFAULT}

</p><p> FORWARD_MAPPING: null</p><p> INCLUDE_MAPPING: null</p><p> ASYNC_MAPPING: null</p><hr />
[java] matches: true
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-trunk-web-devtests-continuous/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - servlet-4.0-mapping-discovery-simple: PASS -
[java] - servlet-4.0-mapping-discovery-async: PASS -
[java] - servlet-4.0-mapping-discovery-forward: PASS -
[java] - servlet-4.0-mapping-discovery-include: PASS -
[java] - servlet-4.0-mapping-discovery-bounds: PASS -
[java] -----------------------------------------
[java] - Total PASS : 5 -
[java] - Total FAIL : 0 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------





[GLASSFISH-16587] request.getUserPrincipal() does not return MyPrincipal Created: 09/May/11  Updated: 10/Mar/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1
Fix Version/s: future release

Type: Bug Priority: Major
Reporter: gernot1 Assignee: sameerpandit
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: 3_1-next, 3_1_1-exclude, 3_1_1-scrubbed, 3_1_2-exclude

 Description   

I've an own javax.security.auth.message.module.ServerAuthModule implementation.
In validateRequest() I put an instance of MyPrincipal to the callbackhandler
MyPrincipal myprincipal = ...;
callbackHandler.handle(new Callback[]

{ new CallerPrincipalCallback(clientSubject, myprincipal), new GroupPrincipalCallback(...) }

);
In the application request.getUserPrincipal() returns an instance of com.sun.enterprise.security.web.integration.WebPrincipal and NOT an instance of MyPrincipal!

In an ejb the call of ejbContext.getCallerPrincipal() does return an instance of MyPrincipal!

==> request.getUserPrincipal() should return the principal which is set in the ServerAuthModule



 Comments   
Comment by kumarjayanti [ 09/May/11 ]

yes this is a known issue and we made some work on it to get the behavior you are looking for. It is still not committed, more work to do.

Comment by kumarjayanti [ 18/May/11 ]

We will make an attempt to get this fixed for 3.1.1 but cannot commit based on resources and time left.

Comment by sultry [ 14/May/15 ]

Depends on this bug made that workaround:

private static Principal glassfishWorkAround(HttpServletRequest request) {
        Principal principal = null;
        try {
            Principal webPrincipal = request.getUserPrincipal();
            if (webPrincipal != null) {
                Class glassfishWrapper = Class.forName("com.sun.enterprise.security.web.integration.WebPrincipal");
                if (glassfishWrapper.isInstance(webPrincipal)) {
                    Field customPrincipal = glassfishWrapper.getDeclaredField("customPrincipal");
                    customPrincipal.setAccessible(true);
                    principal = (Principal) customPrincipal.get(webPrincipal);
                } else {
                    principal = webPrincipal;
                }
            }
        } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException | ClassNotFoundException ex) {
            LOGGER.throwing("SecurityConstraint", "glassfishWorkAround", ex);
        }
        return principal;
}

public static Principal getPrincipal(HttpServletRequest request) {
        return glassfishWorkAround(request);
}

Hope it helps somebody! Anyway hope this bug will be resolved soon.

Comment by arjan tijms [ 17/Oct/15 ]

Any progress here?





[GLASSFISH-21699] countQueued stats for connection queue could be wrong if when multiple acceptor threads are running. Created: 08/Mar/17  Updated: 08/Mar/17

Status: Open
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 4.1, 4.1.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Vinay Vishal Assignee: Vinay Vishal
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When multiple acceptors threads are running, connection queue statistics may get updated by any of the thread. Due to which, there is a possibility that countQueued value is not updated correctly.

Below scenario explains the same:

ConnectionQueueStatsProvider.java
        @ProbeListener("glassfish:kernel:connection-queue:onTaskQueuedEvent")
    public void onTaskQueuedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("task") String taskId) {
        if (name.equals(listenerName)) {
            final int queued = countQueuedAtomic.incrementAndGet();         // code 1
            countQueued.setCount(queued);                                   // code 2

            do {
                final int peakQueue = peakQueuedAtomic.get();               // code 3
                if (queued <= peakQueue) break;                             // code 4


                    if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {// code 5
                synchronized (peakQueuedAtomic) {                           // code 6
                        peakQueued.setCount(peakQueuedAtomic.get());        // code 7
                        break;
                    }
                }
            } while (true);                                                 // code 8

            countTotalQueued.increment();

            incAverageMinute();
        }
    }

Execution

step thread1 thread2 countQueuedAtomic countQueued peakQueuedAtomic peakQueued
1 code1. queued : 1 - 1 0 0 0
2 - code1. queued : 2 2 0 0 0
3 - code2. 2 2 0 0
4 - code3. peakQueue : 0 2 2 0 0
5 - code4. queued <= peakQueue : false 2 2 0 0
6 - code5. peakQueuedAtomic.compareAndSet(peakQueue, queued) : true 2 2 0->2 0
7 - code 6. Acquires lock 2 2 2 0
8 - code 7. 2 2 2 0->2
9 code2. - 2 2-> 1 2 2
10 code3. peakQueue : 2 - 2 1 2 2
11 code4. queued <= peakQueue : true - 2 1 2 2

As it can be seen in this scenario, where there are two events actually queued, countQueued gets set to 1 incorrectly.






[GLASSFISH-21645] maxopenconnections of HttpServiceStatsProvider is always the same. Created: 21/Dec/16  Updated: 03/Mar/17  Resolved: 03/Mar/17

Status: Closed
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: srinik76
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

maxopenconnections of HttpServiceStatsProvider is always the same.

The count value doesn't increase even if requests are sent,
http://localhost:4848/monitoring/domain1/server/http-service/server/request/maxopenconnections

maxopenconnections

    count : 250
    lastsampletime : 1482277918518
    description : The maximum number of open connections
    unit : count
    name : MaxOpenConnections
    starttime : 1482277664689

I think the value of maxopenconnections should increase if requests are sent to web container.

This is the patch for improvement.

HttpServiceStatsProvider.java
    private AtomicLong maxOpenConnectionsAtomic = new AtomicLong();

    // ---------------- Connection related listeners -----------
    @ProbeListener("glassfish:kernel:connection-queue:connectionAcceptedEvent")
    public void connectionAcceptedEvent(
            @ProbeParam("listenerName") String listenerName,
            @ProbeParam("connection") int connectionId,
            @ProbeParam("address") String address) {
        for (String listener : networkListeners) {
            if (listener.equals(listenerName)) {
                countOpenConnections.increment();
                final long openConnections = countOpenConnections.getCount();

                do {
                    final long maxOpenConnectionsCount = maxOpenConnectionsAtomic.get();
                    if (openConnections <= maxOpenConnectionsCount) break;

                    synchronized(maxOpenConnectionsAtomic) {
                        if (maxOpenConnectionsAtomic.compareAndSet(maxOpenConnectionsCount, openConnections)) {
                            maxOpenConnections.setCount(openConnections);
                            break;
                        }
                    }
                } while (true);
            }
        }
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest(
                "[TM]connectionAcceptedEvent received - virtual-server = " + listenerName);
        }
    }


 Comments   
Comment by srinik76 [ 21/Feb/17 ]

Did the required changes and raised a review request. Waiting for review.

Comment by srinik76 [ 03/Mar/17 ]

Sending appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/HttpServiceStatsProvider.java
Transmitting file data .
Committed revision 64714.

Comment by srinik76 [ 03/Mar/17 ]

Sending appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/HttpServiceStatsProvider.java
Transmitting file data .
Committed revision 64714.





[GLASSFISH-21572] AS-WEB-GLUE-00078 is logged to the server.log although both tls11-enabled and tls12-enabled are true. Created: 25/Oct/16  Updated: 01/Mar/17  Resolved: 01/Mar/17

Status: Closed
Project: glassfish
Component/s: security, web_container
Affects Version/s: 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: sameerpandit
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When tls-enabled is set to false,
AS-WEB-GLUE-00078 is logged to the server.log although both tls11-enabled and tls12-enabled are still true.

Reproducible steps are as follows.

C:\glassfish411\glassfish\bin>asadmin set cluster.network-config.protocols.protocol.http-listener-2.ssl.tls-enabled=false
Warning: Instance instance seems to be offline; command set was not replicated to that instance
cluster.network-config.protocols.protocol.http-listener-2.ssl.tls-enabled=false
Command set executed successfully.

C:\glassfish411\glassfish\bin>asadmin start-cluster cluster
Command start-cluster executed successfully.

This is the message.

[2016-10-25T10:25:52.263+0900] [glassfish 4.1] [WARNING] [AS-WEB-GLUE-00078] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1477358749362] [timeMillis: 1477358752263] [levelValue: 900] [[
  All SSL protocol variants disabled for network-listener http-listener-2, using SSL implementation specific defaults]]

This is the patch for this problem.

PECoyoteConnector#configureSSL
        if (Boolean.valueOf(sslConfig.getTlsEnabled())) {
            if (needComma) {
                sslProtocolsBuf.append(", ");
            } else {
                needComma = true;
            }
            sslProtocolsBuf.append("TLSv1");
        }
        if (Boolean.valueOf(sslConfig.getTls11Enabled())) {
            if (needComma) {
                sslProtocolsBuf.append(", ");
            } else {
                needComma = true;
            }
            sslProtocolsBuf.append("TLSv1.1");
        }
        if (Boolean.valueOf(sslConfig.getTls12Enabled())) {
            if (needComma) {
                sslProtocolsBuf.append(", ");
            }
            sslProtocolsBuf.append("TLSv1.2");
        }
        if (Boolean.valueOf(sslConfig.getSsl3Enabled()) ||
                Boolean.valueOf(sslConfig.getTlsEnabled())) {
            sslProtocolsBuf.append(", SSLv2Hello");
        }


 Comments   
Comment by sameerpandit [ 01/Mar/17 ]

Committed revision 64677.





[GLASSFISH-21673] Implement default-context-path Created: 09/Feb/17  Updated: 01/Mar/17  Resolved: 23/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVLET_SPEC-137 Allow context root Resolved
Tags: servlet_4_0
Sprint: MS 3 Sprint 2

 Description   

See SERVLET_SPEC-137



 Comments   
Comment by Shing Wai Chan [ 23/Feb/17 ]

Sending web-glue/src/main/java/org/glassfish/web/deployment/node/WebBundleNode.java
Sending web-glue/src/main/java/org/glassfish/web/deployment/node/WebCommonNode.java
Sending web-glue/src/main/java/org/glassfish/web/deployment/xml/WebTagNames.java
Transmitting file data ...
Committed revision 64576.

Adding defaultContextPath
Adding defaultContextPath/WebTest.java
Adding defaultContextPath/build.properties
Adding defaultContextPath/build.xml
Adding defaultContextPath/descriptor
Adding defaultContextPath/descriptor/web.xml
Adding defaultContextPath/docroot
Adding defaultContextPath/docroot/jsp
Adding defaultContextPath/docroot/jsp/test.jsp
Transmitting file data .....done
Committing transaction...
Committed revision 64577.





[GLASSFISH-21666] Implement programmatic jsp-file Created: 25/Jan/17  Updated: 01/Mar/17  Resolved: 14/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Ed Burns Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 7 hours, 54 minutes
Original Estimate: Not Specified

Attachments: Text File 20170127-1551Z-SERVLET_SPEC-16-mods.patch     Text File 20170127-1601-GLASSFISH-21666.patch     File guessNumber-1.0.war    
Issue Links:
Related
is related to SERVLET_SPEC-16 Add the ability to set <jsp-file> tho... Resolved
Tags: servlet_4_0
Sprint: MS 3 Sprint 2

 Description   

See SERVLET_SPEC-16



 Comments   
Comment by Ed Burns [ 27/Jan/17 ]

Remove "whitespace only" changes at Shing-wai's request.

Comment by Ed Burns [ 27/Jan/17 ]

Diff with "whitespace only" changes removed, at Shing-wai's request.

Comment by Shing Wai Chan [ 14/Feb/17 ]

Per discussion in EG, we will add ServletContext#addJspFile rather than using the patch above.

Comment by Shing Wai Chan [ 14/Feb/17 ]

Sending web-core/src/main/java/org/apache/catalina/core/StandardContext.java
Sending web-glue/src/main/java/com/sun/enterprise/web/WebModule.java
Transmitting file data ..
Committed revision 64545.





[GLASSFISH-21668] Implement get/set SessionTimeout in ServletContext Created: 31/Jan/17  Updated: 01/Mar/17  Resolved: 09/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVLET_SPEC-70 Programmatic configuration API missin... Resolved
Tags: servlet_4_0
Sprint: MS 3 Sprint 1

 Description   

The specification is summarized in issue SERVLET_SPEC-70.



 Comments   
Comment by Shing Wai Chan [ 09/Feb/17 ]

r64510 | swchan2 | 2017-02-06 15:48:49 -0800 (Mon, 06 Feb 2017) | 2 lines

GLASSFISH-21668 Implement get/set SessionTimeout in ServletContext





[GLASSFISH-21635] redirect-port-load-balancer web devtest fails in Hudsons Created: 09/Dec/16  Updated: 21/Feb/17  Resolved: 21/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: xin.li
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The test fail in continuous and nightly Hudsons.

Continuous build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/lastSuccessfulBuild/artifact/appserv-tests/test_results.html

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html

run:
[java] GET /web-redirect-port-loadbalancer/index.html HTTP/1.1
[java]
[java] Location header: Location: https://loadbalancer:45711/web-redirect-port-loadbalancer/index.html
[java] Wrong redirect. Expected: Location: https://loadbalancer:12345/web-redirect-port-loadbalancer/index.html, received: Location: https://loadbalancer:45711/web-redirect-port-loadbalancer/index.html
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - redirect-port-loadbalancer: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by Shing Wai Chan [ 10/Jan/17 ]

This test passes locally if I have just one this test. However, it fails consistently in Hudson.

Comment by Shing Wai Chan [ 21/Feb/17 ]

This is fixed with the version 2.5.0.b33 of hk2-config.jar.





[GLASSFISH-21633] http-compression web devtest fails Created: 09/Dec/16  Updated: 21/Feb/17  Resolved: 21/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: jwells
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

build:
[mkdir] Created dir: /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/devtests/web/httpCompression/build
[javac] /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/devtests/web/httpCompression/build.xml:74: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/devtests/web/httpCompression/build

all:
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=on
[java] configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=on
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=force
[java] configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=force
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=false
[java]
[java] remote failure: javax.validation.ValidationException: HV000149: An exception occurred during message interpolation
[java] HV000149: An exception occurred during message interpolation
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=true
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=1024
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=off
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=on
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=force
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=false
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=true
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=1024
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.compression=off
[java]
[java] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[java]
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - gzip-compressed-output-off: PASS -
[java] - gzip-set-compression-on: PASS -
[java] - gzip-compressed-output-on: PASS -
[java] - gzip-set-compression-force: PASS -
[java] - gzip-compressed-output-force: PASS -
[java] - gzip-set-compression-false: PASS -
[java] - gzip-set-compression-true: PASS -
[java] - gzip-set-compression-1024: FAIL -
[java] - gzip-compressed-output-1024: PASS -
[java] - gzip-set-compression-off: FAIL -
[java] - gzip-compressed-output-off-2: PASS -
[java] - lzma-compressed-output-off: PASS -
[java] - lzma-set-compression-on: FAIL -
[java] - lzma-compressed-output-on: PASS -
[java] - lzma-set-compression-force: FAIL -
[java] - lzma-compressed-output-force: PASS -
[java] - lzma-set-compression-false: PASS -
[java] - lzma-set-compression-true: PASS -
[java] - lzma-set-compression-1024: FAIL -
[java] - lzma-compressed-output-1024: PASS -
[java] - lzma-set-compression-off: FAIL -
[java] - lzma-compressed-output-off-2: PASS -
[java] -----------------------------------------
[java] - Total PASS : 16 -
[java] - Total FAIL : 6 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------

Continuous build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/lastSuccessfulBuild/artifact/appserv-tests/test_results.html

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html



 Comments   
Comment by liangzzhang [ 12/Jan/17 ]

[2017-01-07T10:59:34.325+0800] [glassfish 5.0] [SEVERE] [NCLS-CORE-00003] [javax.enterprise.system.core] [tid: _ThreadID=66 _ThreadName=admin-listener(1)] [timeMillis: 1483757974325] [levelValue: 1000] [[
Exception while running a command
javax.validation.ValidationException: HV000149: An exception occurred during message interpolation
at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:431)
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:300)
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(ValidationContext.java:261)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:456)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:127)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:617)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:580)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:524)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:492)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:457)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:407)
at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:205)
at org.jvnet.hk2.config.WriteableView.canCommit(WriteableView.java:316)
at org.jvnet.hk2.config.Transaction.canCommit(Transaction.java:90)
at org.jvnet.hk2.config.Transaction.commit(Transaction.java:109)
at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:395)
at com.sun.enterprise.v3.admin.SetCommand.set(SetCommand.java:481)
at com.sun.enterprise.v3.admin.SetCommand.execute(SetCommand.java:178)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:407)
at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384)
at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org.hibernate.validator.ValidationMessages, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:1082)
at org.jvnet.hk2.config.MessageInterpolatorImpl.interpolate(MessageInterpolatorImpl.java:151)
at org.jvnet.hk2.config.MessageInterpolatorImpl.interpolate(MessageInterpolatorImpl.java:111)
at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:422)
... 77 more
]]

Comment by liangzzhang [ 12/Jan/17 ]

The issue is caused by "Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http". Then all the following tests could not set config correctly.
The Config bean was locked because "java.util.MissingResourceException: Can't find bundle for base name org.hibernate.validator.ValidationMessages, locale en_US". This is called by org.jvnet.hk2.config.MessageInterpolatorImpl.interpolate.
I noticed that Glassfish already had a JIRA TASK GLASSFISH-15196 for the current issue.

Comment by jwells [ 15/Feb/17 ]

Is this intermittent? I just ran it and it worked for me:

[java] -----------------------------------------
[java] - gzip-compressed-output-off: PASS -
[java] - gzip-set-compression-on: PASS -
[java] - gzip-compressed-output-on: PASS -
[java] - gzip-set-compression-force: PASS -
[java] - gzip-compressed-output-force: PASS -
[java] - gzip-set-compression-false: PASS -
[java] - gzip-set-compression-true: PASS -
[java] - gzip-set-compression-1024: PASS -
[java] - gzip-compressed-output-1024: PASS -
[java] - gzip-set-compression-off: PASS -
[java] - gzip-compressed-output-off-2: PASS -
[java] - lzma-compressed-output-off: PASS -
[java] - lzma-set-compression-on: PASS -
[java] - lzma-compressed-output-on: PASS -
[java] - lzma-set-compression-force: PASS -
[java] - lzma-compressed-output-force: PASS -
[java] - lzma-set-compression-false: PASS -
[java] - lzma-set-compression-true: PASS -
[java] - lzma-set-compression-1024: PASS -
[java] - lzma-compressed-output-1024: PASS -
[java] - lzma-set-compression-off: PASS -
[java] - lzma-compressed-output-off-2: PASS -
[java] -----------------------------------------
[java] - Total PASS : 22 -
[java] - Total FAIL : 0 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------

Comment by Shing Wai Chan [ 21/Feb/17 ]

This is fixed with the version 2.5.0.b33 of hk2-config.jar.





[GLASSFISH-21651] async servlet is not correctly recorded in the HTTP access log and monitoring service Created: 26/Dec/16  Updated: 20/Feb/17

Status: Open
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: yama0428 Assignee: Vinay Vishal
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Responses for async servlet are not correctly recorded in the HTTP access log and the monitoring service.

Async.java
package test.monitor;

import javax.servlet.AsyncContext;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(asyncSupported=true, urlPatterns={"/test"})
public class Async extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res) {
        AsyncContext ac = req.startAsync();
        ac.dispatch("/sleepfail?time=10000");
    }
}

Sleep.java
package test.monitor;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(urlPatterns={"/sleepfail"})
public class Sleep extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res) {
        String str = req.getParameter("time");
        long time = 10000L;
        try {
            time = Long.parseLong(str);
            Thread.sleep(time);
            res.setStatus(500);
            res.getWriter().println("This is error message.");
        } catch (Exception e) {
        }
    }
}

When I send a request to the async servlet, I got following response.

HTTP/1.1 500 Internal Server Error
Server: GlassFish Server Open Source Edition  4.1
X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition  4.1  Java/Oracle Corporation/1.7)
Date: Mon, 26 Dec 2016 06:19:58 GMT
Connection: close
Content-Length: 24

However, http access log was logged as follows.
Status code and response size was not collect.

"0:0:0:0:0:0:0:1" "NULL-AUTH-USER" "26/Dec/2016:15:11:30 +0900" "GET /asyncmonitor/test HTTP/1.1" 200 0 

Monitoring rest service shows 200 too.
https://localhost:24855/monitoring/domain1/monitorins/http-service/server/request/count200

count200

    count : 1
    lastsampletime : 1482732760647
    description : Number of responses with a status code equal to 200
    unit : count
    name : Count200
    starttime : 1482732744592

Therefore, http access log and monitoring service should obtain statistics after sending http response, i.e. at the time when org.glassfish.grizzly.http.server.HttpServerProbe#onRequestCompleteEvent and org.glassfish.grizzly.http.HttpProbe#onErrorEvent are called.



 Comments   
Comment by HeinBloed [ 20/Feb/17 ]

I can confirm this bug. I have also opened a seperate bug report on Github (for Payara) where I describe a related bug that can completely break execution of async servlets under certain circumstances.





[GLASSFISH-21646] countbytesreceived and countbytestransmitted count the value of requests to admin-listener Created: 21/Dec/16  Updated: 13/Feb/17  Resolved: 13/Feb/17

Status: Closed
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: srinik76
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Even if request are not sent to web applications,
countbytesreceived and countbytestransmitted are not zero.

http://localhost:4848/monitoring/domain1/server/http-service/server/request/countbytesreceived

countbytesreceived

    count : 1013
    lastsampletime : 1482281113361
    description : The number of bytes received
    unit : count
    name : CountBytesReceived
    starttime : 1482281097714

This is because HttpServiceStatsProvider does not check the virtual server.
This is the patch for this problem.

HttpServiceStatsProvider.java
    @ProbeListener("glassfish:web:http-service:dataReceivedEvent")
    public void dataReceivedEvent(
        @ProbeParam("size") int size,
        @ProbeParam("hostName") String hostName) {
        if ((hostName != null) && (hostName.equals(virtualServerName))) {
            countBytesReceived.increment(size);
        }
    }

    @ProbeListener("glassfish:web:http-service:dataSentEvent")
    public void dataSentEvent(
        @ProbeParam("size") long size,
        @ProbeParam("hostName") String hostName) {
        if ((hostName != null) && (hostName.equals(virtualServerName))) {
            countBytesTransmitted.increment(size);
        }
    }
RequestProbeProvider.java
    @Probe(name="dataReceivedEvent")
    public void dataReceivedEvent(
        @ProbeParam("size") int size,
        @ProbeParam("hostName") String hostName) {}

    @Probe(name="dataSentEvent")
    public void dataSentEvent(
        @ProbeParam("size") long size,
        @ProbeParam("hostName") String hostName) {}
VirtualServer.java#addProbes(boolean globalAccessLoggingEnabled)
                    grizzlyListener.getTransport().getConnectionMonitoringConfig().addProbes(new ConnectionProbe.Adapter() {

                        RequestProbeProvider requestProbeProvider = webContainer.getRequestProbeProvider();

                        @Override
                        public void onReadEvent(Connection connection, Buffer data, int size) {
                            if (requestProbeProvider != null) {
                                requestProbeProvider.dataReceivedEvent(size, _id);
                            }
                        }

                        @Override
                        public void onWriteEvent(Connection connection, Buffer data, long size) {
                            if (requestProbeProvider != null) {
                                requestProbeProvider.dataSentEvent(size, _id);
                            }
                        }
                    });



 Comments   
Comment by srinik76 [ 16/Jan/17 ]

Fix generated as per the patch provided in the bug. The attributes are not getting counted when requests are not sent to web applications.

Review generated and sent to the group for review request.

Comment by srinik76 [ 13/Feb/17 ]

Sending appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/HttpServiceStatsProvider.java
Sending appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/RequestProbeProvider.java
Sending appserver/web/web-glue/src/main/java/com/sun/enterprise/web/VirtualServer.java
Transmitting file data ...
Committed revision 64533.
Devtest added
Sending devtests/admin/cli/src/admin/monitoring/Jira.java
Transmitting file data .
Committed revision 64534.





[GLASSFISH-21647] maxqueued is always zero Created: 21/Dec/16  Updated: 13/Feb/17  Resolved: 13/Feb/17

Status: Resolved
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: pranjal.sahay
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

maxqueued is always zero.

http://localhost:4848/monitoring/domain1/server/network/http-listener-1/connection-queue

maxqueued

    count : 0
    lastsampletime : -1
    description : Maximum size of the connection queue
    unit : count
    name : MaxQueued
    starttime : 1482281096124

peakqueued

    count : 1
    lastsampletime : 1482282338225
    description : Largest number of connections that were in the queue simultaneously
    unit : count
    name : PeakQueued
    starttime : 1482281096124

maxqueued is the maximum size of the connection queue.
So it is invalid because default queue size is 4096.

This is the patch for this problem.

ThreadPoolMonitor.java
    public ThreadPoolMonitor(GrizzlyMonitoring grizzlyMonitoring,
            String monitoringId, ThreadPoolConfig config) {
        this.grizzlyMonitoring = grizzlyMonitoring;
        this.monitoringId = monitoringId;

        if (grizzlyMonitoring != null) {
            final ThreadPoolStatsProvider threadPoolStatsProvider =
                    grizzlyMonitoring.getThreadPoolStatsProvider(monitoringId);
            if (threadPoolStatsProvider != null) {
                threadPoolStatsProvider.setStatsObject(config);
                threadPoolStatsProvider.reset();
            }

            final ConnectionQueueStatsProvider connectionQueueStatsProvider =
                    grizzlyMonitoring.getConnectionQueueStatsProvider(monitoringId);
            if (connectionQueueStatsProvider != null) {
                connectionQueueStatsProvider.setStatsObject(config);
                connectionQueueStatsProvider.reset();
                connectionQueueStatsProvider.setMaxTaskQueueSizeEvent(monitoringId, config.getQueueLimit());
            }
        }
    }


 Comments   
Comment by pranjal.sahay [ 13/Feb/17 ]

The fix for https://java.net/jira/browse/GLASSFISH-21648 : 64531 also fixes this bug.





[GLASSFISH-21648] corethreads and maxthreads are always zero Created: 21/Dec/16  Updated: 13/Feb/17  Resolved: 13/Feb/17

Status: Resolved
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: srinik76
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

corethreads and maxthreads are always zero.
http://localhost:4848/monitoring/domain1/server/network/thread-pool

corethreads

    count : 0
    lastsampletime : -1
    description : Core number of threads in the thread pool
    unit : count
    name : CoreThreads
    starttime : 1482283022005
maxthreads

    count : 0
    lastsampletime : -1
    description : Maximum number of threads allowed in the thread pool
    unit : count
    name : MaxThreads
    starttime : 1482283022005

This is the patch for this problem.
It isn't needed to register ThreadPoolStatsProvider twice.

GlassFishNetworkListener.java
     @Override
     public void start() throws IOException {
         super.start();
     }


 Comments   
Comment by srinik76 [ 18/Jan/17 ]

Fixed the issue and and fix sent to review.

Comment by srinik76 [ 13/Feb/17 ]

Commited the fix.

Sending GlassfishNetworkListener.java
Transmitting file data .
Committed revision 64531.

Comment by srinik76 [ 13/Feb/17 ]

Checked in the fix





[GLASSFISH-21663] Integrate latest Servlet 4.0 API into GlassFish trunk Created: 24/Jan/17  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Task Priority: Major
Reporter: Ed Burns Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: servlet_4_0
Sprint: MS 2 Sprint 2

 Description   

The first step in re-activating work on Servlet 4.0 RI is to integrate the latest API into GlassFish trunk.



 Comments   
Comment by Shing Wai Chan [ 26/Jan/17 ]

After fixing on all servlet jar dependencies, servlet api jar version 4.0.0-b01 has been integrated to GlassFish.





[GLASSFISH-21473] Http access log is not written after changing network-config properties. Created: 05/Dec/15  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If I send an invalid http request(no Host header),

GET / HTTP/1.1

Http acccess log is logged.

"127.0.0.1" "NULL-AUTH-USER" "05/Dec/2015:16:45:19 +0900" "GET / HTTP/1.1" 400 0 

However, http access log is not written after setting network-config properties.

asadmin set server.network-config.protocols.protocol.http-listener-1.http.timeout-seconds=60

The cause is com.sun.enterprise.web.VirtualServer.
GenericGrizzlyListener is recreated by changing network-config properties.

However,
addProbes method is not called when network-config property is changed.



 Comments   
Comment by Shing Wai Chan [ 10/Jan/17 ]

This issue has been fixed when we fix GLASSFISH-21642 access-logging-bad-requests web devtests fails in Hudson.





[GLASSFISH-21637] network-listener-target web devtest fails in nightly Hudson Created: 09/Dec/16  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html

run:
[java] Running test
[java]
[java] Invoking url: http://localhost.localdomain:45713/web-networkListenerTarget/ServletTest
[java] Response code: 404 Expected code: 200
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - networkListenerTarget: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by Shing Wai Chan [ 05/Jan/17 ]

After fixing the nightly hudson setup for GLASSFISH-21631, this issue has been resolved, too.





[GLASSFISH-21631] sso-failover web devtest failed in nightly Hudson run Created: 08/Dec/16  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

[java] HTTP/1.1 401 Unauthorized
[java] Server: GlassFish Server Open Source Edition 5.0
[java] X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 5.0 Java/Oracle Corporation/1.8)
[java] WWW-Authenticate: Basic realm=""
[java] Content-Language:
[java] Content-Type: text/html
[java] Date: Tue, 06 Dec 2016 12:42:45 GMT
[java] Connection: close
[java] Content-Length: 1090
[java]
[java] <Unable to render embedded object: File (//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>GlassFish Server Open Source Edition 5.0 - Error report</title><style type="text/css"><) not found.--H1

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}

H2

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}

H3

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}

BODY

{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}

B

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}

P

{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}

A

{color : black;}

HR

{color : #525D76;}

--></style> </head><body><h1>HTTP Status 401 - Unauthorized</h1><hr/><p><b>type</b> Status report</p><p><b>message</b>Unauthorized</p><p><b>description</b>This request requires HTTP authentication.</p><hr/><h3>GlassFish Server Open Source Edition 5.0 </h3></body></html>
[java] java.lang.Exception: Missing Set-Cookie response header
[java] at WebTest.run(Unknown Source)
[java] at WebTest.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:809)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - ha-sso-failover: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html



 Comments   
Comment by Shing Wai Chan [ 09/Dec/16 ]

The test passes in my local machine.
When the test passes, it got a 302 rather than 401 above.

Comment by Shing Wai Chan [ 22/Dec/16 ]

An issue is identified in Hudson setup that related to the error message above.

Comment by Shing Wai Chan [ 22/Dec/16 ]

The issue is resolved after the Hudson setup change.

Comment by Shing Wai Chan [ 04/Jan/17 ]

This is a Hudson setup issue. The setup in Hudson has been fixed.





[GLASSFISH-21632] non-blocking-output web devtest fails in continuous Hudson run Created: 08/Dec/16  Updated: 09/Feb/17  Resolved: 09/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Continuous build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/lastSuccessfulBuild/artifact/appserv-tests/test_results.html



 Comments   
Comment by Shing Wai Chan [ 08/Dec/16 ]

run:
[java]
[java] 0: 6467472
[java] aaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaa
[java]
[java] Sleeping 5 sec
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-trunk-web-devtests-continuous/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - non-blocking-output: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------

Comment by Shing Wai Chan [ 15/Dec/16 ]

------------------------------------------------------------------------
r64359 | swchan2 | 2016-12-13 10:30:56 -0800 (Tue, 13 Dec 2016) | 2 lines

set a smaller socket output buffer and use raw socket

------------------------------------------------------------------------
r64354 | swchan2 | 2016-12-12 12:46:28 -0800 (Mon, 12 Dec 2016) | 2 lines

change socket write bufffer

------------------------------------------------------------------------





[GLASSFISH-20917] a wrong implementation for web-fragment.xml with <distributable/> issue Created: 06/Dec/13  Updated: 09/Feb/17  Resolved: 09/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: jumperchen Assignee: Shing Wai Chan
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

fail with both Glassfish 3 and 4 version


Tags: servlet_4_0
Sprint: MS 3 Sprint 1

 Description   

If a web application contains with a jar (for example Spring 3.2.2 version) that enables the attribute <distributable/> in the web-fragment.xml, this setting will cause glassfish server run in cluster environment.

You may refer to this fixed in Spring's tracker - https://jira.springsource.org/browse/SPR-10219

To reproduce this issue is to save a non-serializable object to session attribute, for example

<%
   session.setAttribute( "test", new java.io.ByteArrayOutputStream(20) );
%>

Note that the web.xml doesn't specify the <distributable/>.



 Comments   
Comment by Shing Wai Chan [ 09/Jun/14 ]

The implementation matches the spec.
The spec seems to have an issue here.
I have filed a spec issue as follows:
https://java.net/jira/browse/SERVLET_SPEC-89

Comment by Shing Wai Chan [ 31/Jan/17 ]

Per discussion in EG, an app is distributable if web.xml and web-fragment.xml with <distributable/> element. We will update the implementation in GlassFish.

Comment by Shing Wai Chan [ 06/Feb/17 ]

Revisions:
----------
64467

Modified Paths:
---------------
trunk/main/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/WebBundleDescriptor.java
trunk/main/appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/util/WebBundleValidator.java
trunk/main/appserver/web/web-glue/src/main/java/org/glassfish/web/deployment/descriptor/WebBundleDescriptorImpl.java





[GLASSFISH-21665] Import Servlet 4.0 Schemas into GlassFish trunk Created: 24/Jan/17  Updated: 08/Feb/17  Resolved: 08/Feb/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Ed Burns Assignee: james.shapiro
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: servlet_4_0
Sprint: MS 3 Sprint 1

 Description   

The Java EE 8 schemas are being actively developed at <https://svn.java.net/svn/glassfish~svn/trunk>. This issue requests the schemas relevant to Servlet 4.0 to be included in the GlassFish tree and build.



 Comments   
Comment by james.shapiro [ 08/Feb/17 ]

Copyrights were updated as well.





[GLASSFISH-21410] Invalidating Session using POST via JAX-RS creates IOException Created: 09/Aug/15  Updated: 08/Feb/17

Status: Open
Project: glassfish
Component/s: grizzly-kernel, jax-rs, web_container
Affects Version/s: 4.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: atrajano Assignee: sameerpandit
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Given the following sample code

@Path("session")
@Stateless
public class Resource2 {

@GET
@Path("create")
public Response create(@Context HttpServletRequest req)

{ req.getSession().setAttribute("foo", "bar"); return Response.ok(req.getSession().getAttribute("foo")).build(); }

@POST
@Path("invalidate")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response invalidate(@Context HttpServletRequest req,
@FormParam("foo") String foo)

{ HttpSession session = req.getSession(false); Object foox = session.getAttribute(foo); session.invalidate(); return Response.temporaryRedirect(URI.create("http://slashdot.org/")).build(); }

}

I get the following stack trace

java.io.IOException
at org.glassfish.grizzly.http.io.InputBuffer.skip(InputBuffer.java:721)
at org.glassfish.grizzly.http.server.Request.skipPostBody(Request.java:2078)
at org.glassfish.grizzly.http.server.Request.parseRequestParameters(Request.java:2032)
at org.glassfish.grizzly.http.server.Request.getParameter(Request.java:1066)
at org.apache.catalina.connector.Request.getParameter(Request.java:1552)
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:448)
at org.jboss.weld.servlet.ConversationContextActivator.determineConversationId(ConversationContextActivator.java:182)
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.checkContextInitialized(LazyHttpConversationContextImpl.java:93)
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.destroy(LazyHttpConversationContextImpl.java:85)
at org.jboss.weld.context.http.HttpSessionContextImpl.destroy(HttpSessionContextImpl.java:59)
at org.jboss.weld.servlet.HttpContextLifecycle.sessionDestroyed(HttpContextLifecycle.java:152)
at org.jboss.weld.servlet.WeldInitialListener.sessionDestroyed(WeldInitialListener.java:133)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:910)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:854)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:842)
at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1603)
at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:204)
at net.trajano.test.Resource2.invalidate(Resource2.java:44)

The invalidation seems to be asynchronous since the redirect still works. And it seems that the POST content stream was already closed by the time it reaches InputBuffer.skip.

Perhaps it shouldn't throw an IOException and instead if it is closed just silently not read any more data?






[GLASSFISH-21594] PWC1270: Exception starting filter ADFLibraryFilter: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader Created: 19/Nov/16  Updated: 07/Feb/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: a201155 Assignee: Vinay Vishal
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Oracle ADF Essential on GlassFish 3.1.2; Windows 7 64bit


Tags: adf, glassfish-3-1-2, jdeveloper

 Description   

I have a Web Application developed using JDeveloper 12.1.3 + Oracle ADF Essential and deployed on Glassfish 3.1.2 Server (with the adf libraries installed).

The application use a Train Component.

The webbapp does not work and i've noticed that, if i do not use the "af:pageTemplate", the application works.

Following the log:

[#|2016-11-18T12:08:42.856+0100|SEVERE|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=1;_ThreadName=Thread-2;|WebModule[/SCMP2]PWC1270: Exception starting filter ADFLibraryFilter

java.lang.InstantiationException

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377)

at com.sun.enterprise.web.WebModule.start(WebModule.java:498)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)

at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)

at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)

at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)

at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)

at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)

at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)

at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)

at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)

at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)

at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)

at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)

at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)

at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)

at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)

at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:78)

at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)

at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)

at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)

at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)

at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)

at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)

at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)

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:606)

at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)

at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)

Caused by: javax.servlet.ServletException: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader

at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:147)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)

... 34 more

Caused by: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader

at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:219)

at oracle.adf.share.common.rc.util.LoaderUtil.justGetLoader(LoaderUtil.java:86)

at oracle.adf.share.common.rc.util.LoaderUtil.getLoader(LoaderUtil.java:54)

at oracle.adf.library.webapp.LibraryFilter.initClassLoader(LibraryFilter.java:506)

at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:121)

... 36 more

Caused by: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader

at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:214)

... 40 more

#]





[GLASSFISH-21642] access-logging-bad-requests web devtests fails in Hudson Created: 16/Dec/16  Updated: 07/Feb/17  Resolved: 07/Feb/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0, 4.1.2
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

un:
[java] GET / HTTP/1.1
[java]
[java] HTTP/1.1 400 Bad Request
[java] Server: GlassFish Server Open Source Edition 5.0
[java] X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 5.0 Java/Oracle Corporation/1.8)
[java] Date: Fri, 16 Dec 2016 00:17:43 GMT
[java] Connection: close
[java] Content-Length: 0
[java]
[java] Connecting to: http://localhost.localdomain:45711/web-access-logging-bad-requests/CheckAccessLog?location=%2Fscratch%2FBUILD_AREA%2Fworkspace%2Fgf-trunk-web-devtests-continuous%2Fglassfish4%2Fglassfish
[java] java.lang.Exception: Wrong response body. Could not find expected string: SUCCESS!
[java] at WebTest2.invoke(Unknown Source)
[java] at WebTest2.doTest(Unknown Source)
[java] at WebTest2.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:809)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-trunk-web-devtests-continuous/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - access-logging-bad-requests: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by Shing Wai Chan [ 16/Dec/16 ]

The test passes in my local environment.

Comment by Shing Wai Chan [ 20/Dec/16 ]

The issue is intermittent. And the scenario is identified.

Comment by Shing Wai Chan [ 21/Dec/16 ]

Sending web-glue/src/main/java/com/sun/enterprise/web/VirtualServer.java
Transmitting file data .done
Committing transaction...
Committed revision 64372.

Comment by Shing Wai Chan [ 22/Dec/16 ]

the test still fails in continuous web devtest. The message in the log is different. Need more investigations.

Comment by Shing Wai Chan [ 04/Jan/17 ]

If we run servlet-3.1/nonBlockingOutput and then accessLoggingBadRequests fails locally.
After further debugging, I find that if we run the following:
asadmin set configs.config.server-config.network-config.transports.transport.tcp.socket-write-buffer-size=50000
then accessLoggingBadRequests will fail after that.

Comment by Shing Wai Chan [ 05/Jan/17 ]

Sending src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyService.java
Transmitting file data .done
Committing transaction...
Committed revision 64378.

Comment by Shing Wai Chan [ 06/Jan/17 ]

I have verified that the fix works in continuous Hudson.

Comment by srinik76 [ 03/Feb/17 ]

Backported the fix to 4.1.2 branch

Sending impl/GrizzlyService.java
Transmitting file data .
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:

<https://svn.java.net:443> Subversion Repository

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/srikrkri/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no

Committed revision 64482.

Comment by srinik76 [ 06/Feb/17 ]

Backporting to 4.1.2
Sending appserver/web/web-glue/src/main/java/com/sun/enterprise/web/VirtualServer.java
Transmitting file data .
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:

<https://svn.java.net:443> Subversion Repository

can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/srikrkri/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no

Committed revision 64499.

Comment by Yamini K B [ 07/Feb/17 ]

Closing this issue since problem is fixed.





[GLASSFISH-21574] asadmin deploy --precompilejsp doesn't check compilerSourceVM and compilerTargetVM in glassfish-web.xml Created: 31/Oct/16  Updated: 06/Feb/17  Resolved: 06/Feb/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1, 4.1.1, 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: yama0428 Assignee: Kokil_Jain
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

asadmin deploy --precompilejsp doesn't check compilerSourceVM and compilerTargetVM in glassfish-web.xml.

Therefore, if I use the grammar of JDK7, compilation of jsp is failed.

This is the patch for this problem.

org.glassfish.web.jsp.JSPCompiler.java configureJspc(JspC jspc, String pName, String pValue)
            } else if ("ignoreJspFragmentErrors".equals(pName)) {
                jspc.setIgnoreJspFragmentErrors(
                    Boolean.valueOf(pValue).booleanValue());
+           } else if ("compilerSourceVM".equals(pName)) {
+               jspc.setCompilerSourceVM(pValue);
+           } else if ("compilerTargetVM".equals(pName)) {
+               jspc.setCompilerTargetVM(pValue); 
            }
        }


 Comments   
Comment by Kokil_Jain [ 06/Feb/17 ]

Fixed by r64500.





[GLASSFISH-21390] The message of 「PWC4011: Unable to set request character encoding」 does not output. Created: 08/Jul/15  Updated: 06/Feb/17  Resolved: 23/Sep/15

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1, 4.1.2
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: lzg5039 Assignee: Vinay Vishal
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux


Tags: javaee_ri_fix

 Description   

Access the servlet which contains the following source.


String param1 = request.getParameter("KEY");
request.setCharacterEncoding("UTF-8");


The result of GlassfishV3:
① The Exception of「PWC4011: Unable to set request character encoding」happens.
②"UTF-8" has not been set suceesssfully.

The result of GlassfishV4:
① The Exception of「PWC4011: Unable to set request character encoding」does not happen. ★
② "UTF-8" has not been set suceesssfully.

★ is V4 different from V3

Reason:
requestParametersParsed has been deleted in V4 source.

The source of V4

Class:web\web-core\src\main\java\org\apache\catalina\connector\Request.java
method: setCharacterEncoding
        if (usingReader) {
            String contextName =
                getContext() != null ? getContext().getName() : "UNKNOWN";
            log.log(Level.WARNING, UNABLE_SET_REQUEST_CHARS, new Object[] {enc, contextName});
            return;
        }

The source of V3

Class:web\web-core\src\main\java\org\apache\catalina\connector\Request.java
method: setCharacterEncoding
        if (requestParametersParsed || usingReader) {
            String contextName =
                    (getContext() != null ? getContext().getName() : "UNKNOWN");
            log.warning(sm.getString("coyoteRequest.setCharacterEncoding.ise",
                    enc, contextName));
            return;
        }

The message of 「PWC4011: Unable to set request character encoding」 does not output.
It is mistake? It is pattern changed?



 Comments   
Comment by Vinay Vishal [ 21/Jul/15 ]

Servlet spec 3.1 in section 3.11 does mention that "setCharacterEncoding(String enc) must be called prior to parsing any post data or reading any input from the request. Calling this method once data has been read will not affect the encoding." , there is no explicit mention about warning message to be logged in such case. Will further analyse and update in due course.

Comment by lzg5039 [ 07/Sep/15 ]

Hi Vinay Vishal

But if we use getReader() in such case, the warning message will be printted.

Comment by Vinay Vishal [ 09/Sep/15 ]

Can you please share the warning message getting printed when getReader() is being called?

Comment by Vinay Vishal [ 09/Sep/15 ]

I think I got what you are trying to say. As per javadoc, calling setCharacterEncoding(String enc) will not have any affect when either request parameter has been read or input has been read using getReader. So probably behavior should be same with regards to warning message too when setCharacterEncoding is called . But at present, no warning message gets printed when request parameter has been read. But when getReader is called prior to setCharacterEncoding call, warning message gets printed. I will update further once we have a decision on expected behavior in this case.

Comment by lzg5039 [ 10/Sep/15 ]

Hi Vinay Vishal

>Can you please share the warning message getting printed when getReader() is being called?
[2015-09-10T19:08:28.802+0900] [glassfish 4.1] [WARNING] [AS-WEB-CORE-00059] [javax.enterprise.web.core] [tid: _ThreadID=26 _ThreadName=http-listener-1(1)] [timeMillis: 1441879708802] [levelValue: 900] Unable to set request character encoding to Shift_JIS from context /DirectoryDeployWeb, because request parameters have already been read, or ServletRequest.getReader() has already been called


I think I got what you are trying to say. As per javadoc, calling setCharacterEncoding(String enc) will not have any affect when either request parameter has been read or input has been read using getReader. So probably behavior should be same with regards to warning message too when setCharacterEncoding is called . But at present, no warning message gets printed when request parameter has been read. But when getReader is called prior to setCharacterEncoding call, warning message gets printed. I will update further once we have a decision on expected behavior in this case.

Yes, thanks.

Comment by Vinay Vishal [ 23/Sep/15 ]

As per servlet spec 3.1, when Request.setCharacterEncoding(String enc) is called, the call should be a no-op if request input parameters have already been read or if getReader() has been called. However, at present, check is there only in case of use of reader and no check if parameter has been read by a different method call (e.g by calling getParameter()). Changes have been made to check if parameters have been processed/read too. character encoding will not be set if either parameters have been reader or reader is being used. Change has been reviewed and approved by Shing Wai Chan. Build, quick look and web-dev-test run went fine. CTS run planned post merge in trunk.

The log message is now coming in server.log when setCharacterEncoding(String str) is invoked and is shown below:

[2015-09-23T12:34:33.832+0530] [glassfish 4.1] [WARNING] [AS-WEB-CORE-00059] [javax.enterprise.web.core] [tid: _ThreadID=88 _ThreadName=http-listener-1(1)] [timeMillis: 1442991873832] [levelValue: 900] [[
Unable to set request character encoding to UTF-8 from context /test, because request parameters have already been read, or ServletRequest.getReader() has already been called]]

Commit details:

Sending appserver/web/web-core/src/main/java/org/apache/catalina/connector/Request.java
Transmitting file data .
Committed revision 64117.

Comment by srinik76 [ 06/Feb/17 ]

Backported to 4.1.2. Checkin information

Sending web-core/src/main/java/org/apache/catalina/connector/Request.java
Transmitting file data .

Committed revision 64493.





[GLASSFISH-21478] Output written in the servlet response writer after dispatch.include() get lost Created: 03/Jan/16  Updated: 24/Jan/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1.1, 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: stoyants Assignee: Shing Wai Chan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10, Java jdk1.8.0_66, MS Edge & Chrome


Tags: dispatch, servlet

 Description   

Servlet is supposed to be able to continue to write in the output stream after dispatcher.include(request, response); (as opposite to dispatcher.forward(request, response))
While not throwing any exception or showing that anything went wrong, glassfish just does not deliver what is written to the client.
The same was tested under other Application servers and works as expected.
Issue is very easy to reproduce and test code, that shows the problem can be provided.



 Comments   
Comment by Yamini K B [ 13/Jan/17 ]

Can you please attach a reproducible test case?

Comment by stoyants [ 23/Jan/17 ]

Sorry, but under the "More" button I don't see an option to attach files.
Can you suggest how to attach the test case and screenshots, please?

Comment by Yamini K B [ 24/Jan/17 ]

You can put your files on dropbox (www.dropbox.com) and share the link here.

Comment by stoyants [ 24/Jan/17 ]

Here we go:
https://www.dropbox.com/sh/wct91va32jt76lt/AAAl8YH2DI56OX4aDA3MKAwia

Under the link you can find:
1. TestInclude.zip . NetBeans project to reproduce the problem
2. Glassfish-NotOK.PNG - Screenshot of the test page, which shows the problem: "just after dispatcher.include(...)" is missing.
3. WildFly-OK.PNG - Screenshot of the test page, done under WildFly, which show correct resul

Best Regards,
Stoyan





[GLASSFISH-20858] Message "Invalid Url Pattern" contains placeholder, while it obviously must contain the invalid pattern Created: 16/Oct/13  Updated: 24/Jan/17

Status: Reopened
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0, 4.1.2
Fix Version/s: 5.0

Type: Bug Priority: Minor
Reporter: mkarg Assignee: Shing Wai Chan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian 7.2, AMD64, JDK 8 (Developer's Preview)


Attachments: Text File WebResourceCollectionNode.java.patch    

 Description   

I did a typo in the URL pattern of web-resource-collection in web.xml, and as a result receive this stacktrace. Apparently the message contains the placeholder

{0} while it should contain the false pattern instead.

[2013-10-16T19:25:11.020+0200] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=99 _ThreadName=AutoDeployer] [timeMillis: 1381944311020] [levelValue: 1000] [[
Exception during lifecycle processing
java.lang.IllegalArgumentException: Invalid URL Pattern: [{0}

]
at org.glassfish.web.deployment.node.WebResourceCollectionNode.setElementValue(WebResourceCollectionNode.java:136)
at com.sun.enterprise.deployment.node.SaxParserHandler.endElement(SaxParserHandler.java:583)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:606)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:863)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1786)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2951)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:846)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:775)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:626)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:332)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:318)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:245)
at com.sun.enterprise.deployment.archivist.Archivist.readStandardDeploymentDescriptor(Archivist.java:665)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:391)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:198)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:222)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:878)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:818)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:374)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:537)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:164)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:595)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:482)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:410)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:401)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:233)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)



 Comments   
Comment by Terry2013 [ 04/Jan/15 ]

Hi, hong
I have confirmed the code.
I think the code for outputing the error message is wrong.
I create the a patch for this bug.I test it and it works fine.
Could you please reviwe it?

Comment by Hong Zhang [ 05/Jan/15 ]

Thanks for submitting a patch for this bug. The WebResourceCollectionNode is owned by the web team, reassign to them for them to review the patch.

Comment by jifeng [ 04/Feb/15 ]

Hi, Shing Wai Chan

I found that the same problem exists in the following classes. In these classes the usage of MessageFormat.format() method is error:

war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java
web-core/src/main/java/org/apache/catalina/core/StandardServer.java
web-glue/src/main/java/org/glassfish/web/config/WebSslConfigHandler.java
web-glue/src/main/java/org/glassfish/web/deployment/node/FilterMappingNode.java
web-glue/src/main/java/org/glassfish/web/deployment/node/ServletMappingNode.java
web-naming/src/main/java/org/apache/naming/ContextBindings.java
web-naming/src/main/java/org/apache/naming/resources/WARDirContext.java
web-naming/src/main/java/org/apache/naming/resources/WebDirContext.java

Comment by lzg5039 [ 19/Mar/15 ]

Hi, Shing Wai Chan

I use the following source to fix all problems , can you help me to review it .

Index: war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java
===================================================================
--- war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java	(revision 62639)
+++ war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java	(working copy)
@@ -1258,7 +1258,7 @@
                 } catch(AccessControlException ace) {
                     if (logger.isLoggable(Level.WARNING)) {
                         String msg = MessageFormat.format(
-                                FIND_CLASS_INTERNAL_SECURITY_EXCEPTION,
+                                rb.getString(FIND_CLASS_INTERNAL_SECURITY_EXCEPTION),
                                 new Object[]{name, ace.getMessage()});
                         logger.log(Level.WARNING, msg, ace);
                     }
@@ -1705,7 +1705,7 @@
                 try {
                     securityManager.checkPackageAccess(name.substring(0,i));
                 } catch (SecurityException se) {
-                    String error = MessageFormat.format(SECURITY_EXCEPTION, name);
+                    String error = MessageFormat.format(rb.getString(SECURITY_EXCEPTION), name);
                     if (logger.isLoggable(Level.INFO)) {
                         logger.log(Level.INFO, error, se);
                     }
Index: web-core/src/main/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- web-core/src/main/java/org/apache/catalina/core/StandardServer.java	(revision 62639)
+++ web-core/src/main/java/org/apache/catalina/core/StandardServer.java	(working copy)
@@ -892,7 +892,7 @@
             try {
                 oname=new ObjectName( "Catalina:type=Server");
             } catch (Exception e) {
-                String msg = MessageFormat.format(ERROR_REGISTERING, e.toString());
+                String msg = MessageFormat.format(rb.getString(ERROR_REGISTERING), e.toString());
                 log.log(Level.SEVERE, msg, e);
             }
         }
Index: web-glue/src/main/java/org/glassfish/web/config/WebSslConfigHandler.java
===================================================================
--- web-glue/src/main/java/org/glassfish/web/config/WebSslConfigHandler.java	(revision 62639)
+++ web-glue/src/main/java/org/glassfish/web/config/WebSslConfigHandler.java	(working copy)
@@ -94,9 +94,9 @@
         try {
             if (listener == null) {
                 report.setMessage(
-                        WebContainer.rb.getString(
-                                MessageFormat.format(
-                                        CREATE_SSL_HTTP_NOT_FOUND, command.listenerId)));
+                        MessageFormat.format(
+                                WebContainer.rb.getString(
+                                        CREATE_SSL_HTTP_NOT_FOUND), command.listenerId));
                 httpProtocol = command.findOrCreateProtocol(command.listenerId);
             } else {
                 httpProtocol = listener.findHttpProtocol();
@@ -103,9 +103,9 @@
                 Ssl ssl = httpProtocol.getSsl();
                 if (ssl != null) {
                     report.setMessage(
-                            WebContainer.rb.getString(
-                                    MessageFormat.format(
-                                            CREATE_SSL_HTTP_ALREADY_EXISTS, command.listenerId)));
+                            MessageFormat.format(
+                                    WebContainer.rb.getString(
+                                            CREATE_SSL_HTTP_ALREADY_EXISTS), command.listenerId));
                     report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                     return;
                 }
@@ -134,8 +134,8 @@
 
         if (networkListener == null) {
             report.setMessage(
-                    WebContainer.rb.getString(
-                            MessageFormat.format(DELETE_SSL_HTTP_LISTENER_NOT_FOUND, command.listenerId)));
+                    MessageFormat.format(
+                            WebContainer.rb.getString(DELETE_SSL_HTTP_LISTENER_NOT_FOUND), command.listenerId));
             report.setActionExitCode(ActionReport.ExitCode.FAILURE);
             return;
         }
@@ -143,8 +143,8 @@
         Protocol protocol = networkListener.findHttpProtocol();
         if (protocol.getSsl() == null) {
             report.setMessage(
-                    WebContainer.rb.getString(
-                            MessageFormat.format(DELETE_SSL_ELEMENT_DOES_NOT_EXIST, command.listenerId)));
+                    MessageFormat.format(
+                            WebContainer.rb.getString(DELETE_SSL_ELEMENT_DOES_NOT_EXIST), command.listenerId));
             report.setActionExitCode(ActionReport.ExitCode.FAILURE);
             return;
         }
Index: web-glue/src/main/java/org/glassfish/web/deployment/node/FilterMappingNode.java
===================================================================
--- web-glue/src/main/java/org/glassfish/web/deployment/node/FilterMappingNode.java	(revision 62639)
+++ web-glue/src/main/java/org/glassfish/web/deployment/node/FilterMappingNode.java	(working copy)
@@ -141,9 +141,9 @@
                     value = trimmedUrl;
                 } else {
                     throw new IllegalArgumentException(
-                            WebContainer.rb.getString(
-                                    MessageFormat.format(
-                                            ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN, value)));
+                            MessageFormat.format(
+                                    WebContainer.rb.getString(
+                                            ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN), value));
                 }
             }
             descriptor.addURLPattern(value);
Index: web-glue/src/main/java/org/glassfish/web/deployment/node/ServletMappingNode.java
===================================================================
--- web-glue/src/main/java/org/glassfish/web/deployment/node/ServletMappingNode.java	(revision 62639)
+++ web-glue/src/main/java/org/glassfish/web/deployment/node/ServletMappingNode.java	(working copy)
@@ -112,9 +112,9 @@
                     value = trimmedUrl;
                 } else {
                     throw new IllegalArgumentException(
-                            WebContainer.rb.getString(
-                                    MessageFormat.format(
-                                            FilterMappingNode.ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN, value)));
+                            MessageFormat.format(
+                                    WebContainer.rb.getString(
+                                            FilterMappingNode.ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN), value));
                 }
             }
 
Index: web-naming/src/main/java/org/apache/naming/ContextBindings.java
===================================================================
--- web-naming/src/main/java/org/apache/naming/ContextBindings.java	(revision 62639)
+++ web-naming/src/main/java/org/apache/naming/ContextBindings.java	(working copy)
@@ -223,8 +223,8 @@
             Context context = contextNameBindings.get(name);
             if (context == null)
                 throw new NamingException(
-                        rb.getString(
-                                MessageFormat.format(UNKNOWN_CONTEXT, name)));
+                        MessageFormat.format(
+                                rb.getString(UNKNOWN_CONTEXT), name));
             threadBindings.put(Thread.currentThread(), context);
             threadNameBindings.put(Thread.currentThread(), name);
         }
@@ -326,8 +326,8 @@
             Context context = contextNameBindings.get(name);
             if (context == null)
                 throw new NamingException(
-                        rb.getString(
-                                MessageFormat.format(UNKNOWN_CONTEXT, name)));
+                        MessageFormat.format(
+                                rb.getString(UNKNOWN_CONTEXT), name));
             clBindings.put(classLoader, context);
             clNameBindings.put(classLoader, name);
         }
Index: web-naming/src/main/java/org/apache/naming/resources/WARDirContext.java
===================================================================
--- web-naming/src/main/java/org/apache/naming/resources/WARDirContext.java	(revision 62639)
+++ web-naming/src/main/java/org/apache/naming/resources/WARDirContext.java	(working copy)
@@ -215,7 +215,7 @@
             try {
                 base.close();
             } catch (IOException e) {
-                String msg = MessageFormat.format(EXCEPTION_CLOSING_WAR, base.getName());
+                String msg = MessageFormat.format(rb.getString(EXCEPTION_CLOSING_WAR), base.getName());
                 log.log(Level.WARNING, msg, e);
             }
         }
Index: web-naming/src/main/java/org/apache/naming/resources/WebDirContext.java
===================================================================
--- web-naming/src/main/java/org/apache/naming/resources/WebDirContext.java	(revision 62639)
+++ web-naming/src/main/java/org/apache/naming/resources/WebDirContext.java	(working copy)
@@ -165,7 +165,7 @@
             jfEntry = lookupFromJars(name);
             if (jfEntry == null) {
                 throw new NamingException
-                    (rb.getString(MessageFormat.format(RESOURCES_NOT_FOUND, name)));
+                    (MessageFormat.format(rb.getString(RESOURCES_NOT_FOUND), name));
             }
         }
 
@@ -223,7 +223,7 @@
 
         if (file == null && jfeEntries.size() == 0) {
             throw new NamingException
-                    (rb.getString(MessageFormat.format(RESOURCES_NOT_FOUND, name)));
+                    (MessageFormat.format(rb.getString(RESOURCES_NOT_FOUND), name));
         }
         return new NamingContextEnumeration(namingEntries.iterator());
     }
@@ -263,7 +263,7 @@
 
         if (file == null && jfeEntries.size() == 0) {
             throw new NamingException
-                    (rb.getString(MessageFormat.format(RESOURCES_NOT_FOUND, name)));
+                    (MessageFormat.format(rb.getString(RESOURCES_NOT_FOUND), name));
         }
 
         return new NamingContextBindingsEnumeration(namingEntries.iterator(),
@@ -298,7 +298,7 @@
             JarFileEntry jfEntry = lookupFromJars(name);
             if (jfEntry == null) {
                 throw new NamingException
-                    (rb.getString(MessageFormat.format(RESOURCES_NOT_FOUND, name)));
+                    (MessageFormat.format(rb.getString(RESOURCES_NOT_FOUND), name));
             } else {
                 return new JarResourceAttributes(jfEntry.getJarEntry());
             }

Index: web-glue/src/main/java/org/glassfish/web/deployment/node/WebResourceCollectionNode.java
===================================================================
--- web-glue/src/main/java/org/glassfish/web/deployment/node/WebResourceCollectionNode.java	(revision 63724)
+++ web-glue/src/main/java/org/glassfish/web/deployment/node/WebResourceCollectionNode.java	(working copy)
@@ -134,9 +134,9 @@
                     value = trimmedUrl;
                 } else {
                     throw new IllegalArgumentException(
-                            WebContainer.rb.getString(
-                                    MessageFormat.format(
-                                            FilterMappingNode.ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN, value)));
+                            MessageFormat.format(
+                                    WebContainer.rb.getString(FilterMappingNode.ENTERPRISE_DEPLOYMENT_INVALID_URL_PATTERN),
+                                    value));
                 }
             }
             descriptor.addUrlPattern(value);
Comment by Shing Wai Chan [ 10/Jan/17 ]

Sending web/admin/src/main/java/org/glassfish/web/admin/cli/CreateNetworkListener.java
Sending web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java
Sending web/web-core/src/main/java/org/apache/catalina/core/ApplicationDispatcher.java
Sending web/web-core/src/main/java/org/apache/catalina/core/StandardServer.java
Sending web/web-core/src/main/java/org/apache/catalina/servlets/DefaultServlet.java
Sending web/web-glue/src/main/java/org/glassfish/web/config/WebSslConfigHandler.java
Sending web/web-glue/src/main/java/org/glassfish/web/deployment/node/FilterMappingNode.java
Sending web/web-glue/src/main/java/org/glassfish/web/deployment/node/ServletMappingNode.java
Sending web/web-glue/src/main/java/org/glassfish/web/deployment/node/WebResourceCollectionNode.java
Sending web/web-naming/src/main/java/org/apache/naming/ContextBindings.java
Sending web/web-naming/src/main/java/org/apache/naming/resources/WARDirContext.java
Sending web/web-naming/src/main/java/org/apache/naming/resources/WebDirContext.java
Transmitting file data ............done
Committing transaction...
Committed revision 64387.





[GLASSFISH-21043] Glassfish 4 admin gui class loading issue when built from source (as at svn revision 63170) Created: 17/Apr/14  Updated: 23/Jan/17  Resolved: 23/Jan/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dave Whitla Assignee: Shing Wai Chan
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: 0 minutes
Environment:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 23:51:28+1000)
Maven home: /opt/local/share/java/maven3
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: utf-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"


Tags: admin-gui

 Description   

The default domain starts without error. Attempting to access the admin application fails with the root cause being failure to locate com.sun.webui.jsf.faces.UIComponentELResolver.
The class in question exists within $INSTALL_ROOT/lib/install/applications/__admingui/WEB-INF/extra/webui-jsf-4.0.2.10.jar and was compiled using the same JDK I am using to start the container.

Root cause:

The current source for sun-web.xml in the __admingui module contains the following:

<class-loader delegate="true"
extra-class-path="WEB-INF/extra/webui-jsf-suntheme-4.0.2.10.jar
:WEB-INF/extra/dojo-ajax-nodemo-0.4.1.jar
:WEB-INF/extra/webui-jsf-4.0.2.10.jar
:WEB-INF/extra/commons-fileupload-1.1.1.jar
:WEB-INF/extra/commons-io-1.3.1.jar
:WEB-INF/extra/json-1.0.jar
:WEB-INF/extra/prototype-1.5.0.jar" />

com.sun.enterprise.glassfish.web.WarHandler.configureLoaderAttributes() does not strip whitespace characters when splitting extra-class-path into path elements.
See com.sun.enterprise.glassfish.web.WarHandler:286 for details.

Consequently at line 310:
URL url = file.toURI().toURL();

the spaces are URL encoded as %20 before passing the string to:
cloader.addRepository(url.toString());

which then silently fails to add the jar to the classpath.
Strangely addRepository(String) converts the string back to a URL before passing it (eventually) to URLClassPath.addURL(). I don't have the source for this class but it evidently doesn't like the trailing encoded whitespace characters, because after this call returns the classpath has not changed.

A patch for the issue is attached to https://www.java.net/forum/topic/glassfish/glassfish/glassfish-4-admin-console-class-loading-issue-when-built-source where the problem was first reported.



 Comments   
Comment by Dave Whitla [ 17/Apr/14 ]

When reviewing my changes to commit the fix (to my git clone) I noticed that the reformatting of sun-web.xml had actually been done automagically by my IDE (IntelliJ).
This explains the issue not affecting others.

While the conditions were thus self inflicted, I think this is still a latent bug.
The documentation does state that the extra-class-path consists of path elements separated by ':' or ';' with no explicit allowance for whitespace. However whitespace at the end of a path is perfectly valid and failure to handle it robustly is a future problem. Further, the root cause failure is silent in the shipped configuration, giving new users/developers no clue at all as to why their application fails to load.

Request that you apply the patch.

Comment by Anissa Lam [ 17/Apr/14 ]

Thanks for filing and debugging the issue.
The suspect code is in web container, I am transferring this to that team for further evaluation.
If we can't load the console, then this is very critical and we will need to upgrade this to P2 and need to be fixed for 4.0.1.

Comment by Dave Whitla [ 18/Apr/14 ]

Hi Anissa,

You may have missed that I already have a fix and that, on further analysis, this does not affect all users as first suspected - indeed it is a bit of an edge case.
I would attach my patch but I don't seem to have permissions to attach files to this bug report.

Please see the link in my original report for the patch I have created for this issue.

Comment by Anissa Lam [ 18/Apr/14 ]

Yes, looks like our comments cross each other, with 2 min. difference.
The web container team will make the decision on how to proceed with the bug.
thanks.

Comment by Shing Wai Chan [ 10/Jan/17 ]

The link of the above patch is not available anymore.

According the comments in DTD, we have
extra-class-path List of comma-separated JAR files to be
added to the web application's class path

It is not a comma-separated here.





[GLASSFISH-21508] A failure when running a WebSocket application on Java EE 7 RI Created: 02/Feb/16  Updated: 23/Jan/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1, 4.1.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: xj Assignee: Vinay Vishal
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

One licensee found a failure upon processing a request when running a WebSocket application on Java EE 7 RI.
Could you please forward this to the responsible engineer to answer their questions.
It is easily reproduced with our RI.

After deploying a WebSocket application(App1) on Domain Administration Server(DAS), the following error (a) occurred when accessing App1's URL after re-starting DAS.
(a)
-------------------------------------
javax.websocket.server.ServerContainer=null
-------------------------------------

The expected value (b) returned from App1 is below.
(b)
-------------------------------------
javax.websocket.server.ServerContainer=org.glassfish.tyrus.servlet.TyrusServletContainerInitializer$<Object hash>
-------------------------------------

Return value is changed every time (a) or (b) if DAS is re-started. There are 50% chances that (a) is returned.

The two similiar issues has been reported here.
https://java.net/jira/browse/GLASSFISH-16872
https://java.net/jira/browse/GLASSFISH-19551

Below is Hitachi's investigation result and they thought it is a defect in Java EE 7 RI.

1. The root cause is the attribute "javax.websocket.server.ServerContainer" is not set in ServletContext.

The set of "javax.websocket.server.ServerContainer" is done at line 123 of org.glassfish.tyrus.servlet.TyrusServletContainerInitializer.onStartup(Set, ServletContext). It returns without doing anything if the passed parameter classes is null or empty.
The above problem occurred because classes is null.

2. The reason about why the parameter classes of TyrusServletContainerInitializer is null.

At the line 455 of org.glassfish.web.loader.ServletContainerInitializerUtil.checkAgainstInterestList(Types, Map, List, Map, Set, ClassLoader),
-----------------------------
Type type = classInfo.getBy(c.getName());
-----------------------------

classInfo.getBy(c.getName()) returns null when the variable c is "javax.websocket.Endpoint".

3. The reason why the return value of TypesCtr.getBy(String) becomes null.

The method org.glassfish.hk2.classmodel.reflect.impl.TypesCtr.getBy(String) searches storage.values() which is a HashMap whose key is type of Class and it looks for the first hit and returns TypeProxy.get();

The problem is both of ClassModel and InterfaceModel are registered in the key of storage. The return value is null or not depending on which is first found as java.util.Map.values() is unordered.

4. The reason why InterfaceModel is registered as "javax.websocket.Endpoint".

In org.glassfish.hk2.classmodel.reflect.impl.SignatureVisitorImpl.visitClassType(String), it makes a determination if the parameter "s" is InterfaceModel by using TypeBuilder.getHolder(String, Class).
-----------------------------
public void visitClassType(String s) {
String interfaceName = org.glassfish.hk2.external.org.objectweb.asm.Type.getObjectType(s).getClassName();
TypeProxy<InterfaceModel> interfaceTypeProxy = typeBuilder.getHolder(interfaceName, InterfaceModel.class);
if (interfaceTypeProxy!=null) {
: <If "s" is the interface>
}
}
-----------------------------

If TypeBuilder.getHolder is invoked, that class is registered as InterfaceModel and null is never returned.

Due to the method SignatureVisitorImpl.visitClassType, if anonymous class is used as below, BBB is registered as InterfaceModel in storage though BBB is not interface.
---------------------------------
new AAA<BBB> {
:
}
---------------------------------

Using getHolder() to determine if it is of InterfaceModel is the root cause.

And the similar implementation was found in SignatureVisitorImpl.visitTypeVariable(String).

Questions:
1. Is this symptom a defect?
2. By setting true at system property "org.glassfish.web.parsing" can work around this problem. Does Oracle's engineer has any comment on this?
3. If it is a bug, do we have a plan to address it?

To reproduce:
1. Deploy attached war file on Java EE server
2. Re-start the Java EE server.
3. Access http://<host>:<port>/test/TestServle
4. If the following message is back, jump back to step 2.
javax.websocket.server.ServerContainer=org.glassfish.tyrus.servlet.TyrusServletContainerInitializer$<Object hash>



 Comments   
Comment by Pavel Bucek [ 12/Jan/17 ]

I don't believe this is anywhere in the WebSocket RI (Tyrus) Code.

If you read the report, only point "1." is related Tyrus and is caused because of "2.", which is already on webcontainer level.

Reassigning back to Shing Wai.





[GLASSFISH-21523] @MultipartConfig does not work as expected with forwarded requests Created: 06/Mar/16  Updated: 23/Jan/17

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: omolenkamp Assignee: Vinay Vishal
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When a filter forwards a request to a servlet annotated with @MultipartConfig, GlassFish processes the request as if the annotation wasn't there if the request URI was changed.

When a request that is mapped to a servlet with @MultipartConfig is forwarded to another servlet that doesn't have this annotation, the request is still processed as if the annotation was used on the target servlet.

It looks like a @MultipartConfig annotation is applied to all requests with an original URI that matches the servlet's url-patterns, instead of all requests that are actually handled by the servlet.

This breaks the whole forwarding functionality for servlets that depend on @MultipartConfig.



 Comments   
Comment by omolenkamp [ 06/Mar/16 ]

Here you can find a simple test case for this issue: http://dump.flox.org/testcase-GLASSFISH-21523.tar.gz
(unfortunately, I don't have the permissions to attach the file to this bug)

It contains two servlets, one with @MultipartConfig and one without it, and a filter that can forward requests to either servlet. For all requests handled by the servlet with @MultipartConfig, I'd expect HttpServletRequest.getParts() to work, while all requests that are handled by the other servlet should throw an IllegalStateException when using HttpServletRequest.getParts().





[GLASSFISH-21650] countopenconnections is not counted at the request to http-listener-2 of the cluster Created: 26/Dec/16  Updated: 23/Jan/17  Resolved: 23/Jan/17

Status: Resolved
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: sameerpandit
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

countopenconnections is not counted at the request to http-listener-2 of the cluster

https://localhost:24855/monitoring/domain1/monitorins/http-service/server/request/countopenconnections

countopenconnections

    count : 0
    lastsampletime : -1
    description : The number of open connections
    unit : count
    name : CountOpenConnections
    starttime : 1482721891713

In domain.xml, virtual server is defined as follows.

<virtual-server id="server" network-listeners="http-listener-1, http-listener-2">

Therefore, taking into account spaces is needed when splitting network-listeners of virtual server.

This is the patch for this problem.

HttpServiceStatsProvider.java
import java.util.List;
import com.sun.enterprise.util.StringUtils;

    public HttpServiceStatsProvider(String vsName, String listeners, NetworkConfig networkConfig) {
        this.virtualServerName = vsName;
        List<String> listenerList = StringUtils.parseStringList(listeners, ",");
        this.networkListeners = (listenerList != null) ?
                listenerList.toArray(new String[listenerList.size()]) :
                new String[0];
        this.networkConfig = networkConfig;
    }


 Comments   
Comment by sameerpandit [ 23/Jan/17 ]

Committed revision 64425.





[GLASSFISH-21649] countqueued1minuteaverage does not count the value for one minute Created: 22/Dec/16  Updated: 23/Jan/17  Resolved: 23/Jan/17

Status: Resolved
Project: glassfish
Component/s: monitoring, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: yama0428 Assignee: srinik76
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

countqueued1minuteaverage does not count the value for one minute.

http://localhost:4848/monitoring/domain1/server/network/http-listener-1/connection-queue/countqueued1minuteaverage

    countqueued1minuteaverage
        count : 0
        lastsampletime : 1482364980659
        description : Average number of connections queued in the last 1 minute
        unit : count
        name : CountQueued1MinuteAverage
        starttime : 1482364980659

It depends on the time when the REST request is sent.
Counter for countqueued1minuteaverage is reset at 0 second per minute.

This is the patch for this problem.

ConnectionQueueStatsProvider.java
    protected int getAverageBy(int mins) {
        synchronized(averageStatsPerMinute) {
            final long currentTime = System.currentTimeMillis();
            if (currentTime - averageLastShift >= MINUTE) {
                shiftAverage(currentTime);
            }

            int result = 0;
            final int statsToCount = Math.min(mins, averageStatsPerMinute.length);
            for(int i = 0; i < statsToCount; i++) {
                result += averageStatsPerMinute[i];
            }

            return result;
        }
    }


 Comments   
Comment by srinik76 [ 23/Jan/17 ]

Fixed checked in the changes. Ran the QL, Monitoring dev test and manually tested the changes.

Sending ConnectionQueueStatsProvider.java
Transmitting file data .
Committed revision 64426.





[GLASSFISH-21571] AS-WEB-GLUE-00080 is always logged to the server.log in spite of valid cipher suites for JDK8 Created: 25/Oct/16  Updated: 20/Jan/17

Status: In Progress
Project: glassfish
Component/s: security, web_container
Affects Version/s: 3.1.2.2, 4.1, 4.1.1, 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: yama0428 Assignee: ankur.kathuria
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

AS-WEB-GLUE-00080 is always logged to the server.log in spite of valid cipher suites for JDK8.

Reproducible steps are as follows.

C:\glassfish411\glassfish\bin>asadmin create-cluster cluster
Command create-cluster executed successfully.

C:\glassfish411\glassfish\bin>asadmin create-local-instance --cluster cluster in
stance
Rendezvoused with DAS on localhost:4848.
Port Assignments for server instance instance:
JMX_SYSTEM_CONNECTOR_PORT=28686
JMS_PROVIDER_PORT=27676
HTTP_LISTENER_PORT=28080
ASADMIN_LISTENER_PORT=24848
JAVA_DEBUGGER_PORT=29009
IIOP_SSL_LISTENER_PORT=23820
IIOP_LISTENER_PORT=23700
OSGI_SHELL_TELNET_PORT=26666
HTTP_SSL_LISTENER_PORT=28181
IIOP_SSL_MUTUALAUTH_PORT=23920
Command create-local-instance executed successfully.

C:\glassfish411\glassfish\bin>asadmin set cluster.network-config.protocols.proto
col.http-listener-2.ssl.ssl3-tls-ciphers=+TLS_RSA_WITH_AES_128_GCM_SHA256
cluster.network-config.protocols.protocol.http-listener-2.ssl.ssl3-tls-ciphers=+
TLS_RSA_WITH_AES_128_GCM_SHA256
Command set executed successfully.

C:\glassfish411\glassfish\bin>asadmin start-cluster cluster
Command start-cluster executed successfully.

This is the message.
TLS_RSA_WITH_AES_128_GCM_SHA256 is a valid cipher suite for JDK8.

[2016-10-25T08:33:44.251+0900] [glassfish 4.1] [WARNING] [AS-WEB-GLUE-00080] [javax.enterprise.web] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1477352021880] [timeMillis: 1477352024251] [levelValue: 900] [[
  Unrecognized cipher: TLS_RSA_WITH_AES_128_GCM_SHA256]]

The cause of this message is PECoyoteConnector.java.
PECoyoteConnector get cipher suites via CipherInfo#getCipherInfo(String).

In the static initializer of CipherInfo.java, SSLServerSocketFactory.getDefault() is called.
If the initialization of com.sun.enterprise.security.ssl.SSLUtils is not done, SSLServerSocketFactory.getDefault() returns an empty array.
By calling SSLUtils#getSSLContext, SSLServerSocketFactory.getDefault() returns cipher suites because SSLContext.setDefault is called in it.

In order to suppress this message, I think com.sun.enterprise.web.EmbeddedWebContainer should inject SSLUtils.

EmbeddedWebContainer.java
    @Inject
    private SSLUtils sslUtils;


 Comments   
Comment by ankur.kathuria [ 20/Jan/17 ]

I tried recreating the issue using steps given in description with jkd8, glassfish 4.1 and with both Linux and Windows. But not able to re-create the same.
Could you please provide more information like any missing step or any other configuration you are using ?
Also, i ran "list-supported-cipher-suites" and got "TLS_RSA_WITH_AES_128_GCM_SHA256" in supported list. You can check this as well if you have this cipher suite in your supported list.

Comment by yama0428 [ 20/Jan/17 ]

The result of list-supported-cipher-suites includes TLS_RSA_WITH_AES_128_GCM_SHA256.
In my environment(windows and RHEL6.5), reproducible steps are following only.
The kind of cipher suites is unrelated.

asadmin set XXX.network-config.protocols.protocol.http-listener-2.ssl.ssl3-tls-ciphers=supported cipher suites
asadmin start-cluster XXX

ex)

D:\glassfish4\glassfish\bin>asadmin start-domain
Waiting for domain1 to start ...........
Successfully started the domain : domain1
domain  Location: D:\glassfish4\glassfish\domains\domain1
Log File: D:\glassfish4\glassfish\domains\domain1\logs\server.log
Admin Port: 4848
Command start-domain executed successfully.

D:\glassfish4\glassfish\bin>asadmin create-cluster cluster2
Command create-cluster executed successfully.

D:\glassfish4\glassfish\bin>asadmin create-local-instance --cluster cluster2 ins
tance2
Rendezvoused with DAS on localhost:4848.
Using DAS host localhost and port 4848 from existing das.properties for node
localhost-domain1. To use a different DAS, create a new node using create-node-s
sh or
create-node-config. Create the instance with the new node and correct
host and port:
asadmin --host das_host --port das_port create-local-instance --node node_name i
nstance_name.
Port Assignments for server instance instance2:
OSGI_SHELL_TELNET_PORT=26667
JAVA_DEBUGGER_PORT=29010
JMS_PROVIDER_PORT=27677
HTTP_LISTENER_PORT=28081
IIOP_SSL_LISTENER_PORT=23821
ASADMIN_LISTENER_PORT=24849
IIOP_SSL_MUTUALAUTH_PORT=23921
JMX_SYSTEM_CONNECTOR_PORT=28687
HTTP_SSL_LISTENER_PORT=28182
IIOP_LISTENER_PORT=23701
Command create-local-instance executed successfully.

D:\glassfish4\glassfish\bin>asadmin list-supported-cipher-suites
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
TLS_RSA_WITH_AES_128_CBC_SHA256
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
TLS_DHE_DSS_WITH_AES_128_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
SSL_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
TLS_EMPTY_RENEGOTIATION_INFO_SCSV
TLS_DH_anon_WITH_AES_128_GCM_SHA256
TLS_DH_anon_WITH_AES_128_CBC_SHA256
TLS_ECDH_anon_WITH_AES_128_CBC_SHA
TLS_DH_anon_WITH_AES_128_CBC_SHA
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA
SSL_DH_anon_WITH_3DES_EDE_CBC_SHA
SSL_RSA_WITH_DES_CBC_SHA
SSL_DHE_RSA_WITH_DES_CBC_SHA
SSL_DHE_DSS_WITH_DES_CBC_SHA
SSL_DH_anon_WITH_DES_CBC_SHA
SSL_RSA_EXPORT_WITH_DES40_CBC_SHA
SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA
TLS_RSA_WITH_NULL_SHA256
TLS_ECDHE_ECDSA_WITH_NULL_SHA
TLS_ECDHE_RSA_WITH_NULL_SHA
SSL_RSA_WITH_NULL_SHA
TLS_ECDH_ECDSA_WITH_NULL_SHA
TLS_ECDH_RSA_WITH_NULL_SHA
TLS_ECDH_anon_WITH_NULL_SHA
SSL_RSA_WITH_NULL_MD5
Command list-supported-cipher-suites executed successfully.

D:\glassfish4\glassfish\bin>asadmin set cluster2.network-config.protocols.protoc
ol.http-listener-2.ssl.ssl3-tls-ciphers=+TLS_RSA_WITH_AES_128_GCM_SHA256
cluster2.network-config.protocols.protocol.http-listener-2.ssl.ssl3-tls-ciphers=
+TLS_RSA_WITH_AES_128_GCM_SHA256
Command set executed successfully.

D:\glassfish4\glassfish\bin>asadmin start-cluster cluster2
Command start-cluster executed successfully.

This is the server.log.

[2017-01-20T23:56:21.472+0900] [] [INFO] [NCLS-GFLAUNCHER-00005] [javax.enterprise.launcher] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1484924181472] [levelValue: 800] [[
  JVM invocation command line:
C:\Program Files\Java\jre1.8.0_66\bin\java.exe
-cp
D:/glassfish4/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-XX:MaxPermSize=192m
-Xmx512m
-server
-javaagent:D:/glassfish4/glassfish/lib/monitor/flashlight-agent.jar
-Djavax.net.ssl.trustStore=D:\glassfish4\glassfish\nodes\localhost-domain1\instance2/config/cacerts.jks
-Djdk.corba.allowOutputStreamSubclass=true
-Dfelix.fileinstall.dir=D:\glassfish4\glassfish/modules/autostart/
-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.fileinstall
-Dcom.sun.aas.installRoot=D:\glassfish4\glassfish
-Dfelix.fileinstall.poll=5000
-Djava.endorsed.dirs=D:\glassfish4\glassfish/modules/endorsed;D:\glassfish4\glassfish/lib/endorsed
-Djava.security.policy=D:\glassfish4\glassfish\nodes\localhost-domain1\instance2/config/server.policy
-Dosgi.shell.telnet.maxconn=1
-Dfelix.fileinstall.bundles.startTransient=true
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Dfelix.fileinstall.log.level=3
-Djavax.net.ssl.keyStore=D:\glassfish4\glassfish\nodes\localhost-domain1\instance2/config/keystore.jks
-Djava.security.auth.login.config=D:\glassfish4\glassfish\nodes\localhost-domain1\instance2/config/login.conf
-Dfelix.fileinstall.disableConfigSave=false
-Dfelix.fileinstall.bundles.new.start=true
-Dcom.sun.aas.instanceRoot=D:\glassfish4\glassfish\nodes\localhost-domain1\instance2
-Dosgi.shell.telnet.port=26667
-Dgosh.args=--noshutdown -c noop=true
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-Dosgi.shell.telnet.ip=127.0.0.1
-DANTLR_USE_DIRECT_CLASS_LOADING=true
-Djava.awt.headless=true
-Djava.ext.dirs=C:\Program Files\Java\jre1.8.0_66/lib/ext;C:\Program Files\Java\jre1.8.0_66/jre/lib/ext;D:\glassfish4\glassfish\nodes\localhost-domain1\instance2/lib/ext
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djava.library.path=D:/glassfish4/glassfish/lib;C:/ProgramData/Oracle/Java/javapath;C:/windows/Sun/Java/bin;C:/windows/System32;C:/windows;C:/Program Files/Common Files/Microsoft Shared/Windows Live;C:/Program Files (x86)/Common Files/microsoft shared/Windows Live;C:/windows/System32/wbem;C:/windows/System32/WindowsPowerShell/v1.0;C:/Program Files (x86)/Common Files/Roxio Shared/OEM/DLLShared;C:/Program Files (x86)/Common Files/Roxio Shared/OEM/12.0/DLLShared;C:/Program Files (x86)/Roxio 2010/OEM/AudioCore;C:/Program Files (x86)/Windows Live/Shared;C:/Program Files/Softex/OmniPass;C:/Program Files (x86)/Common Files/Roxio Shared/DLLShared;C:/Program Files/Intel/WiFi/bin;C:/Program Files/Common Files/Intel/WirelessCommon;C:/Program Files (x86)/Common Files/Ulead Systems/MPEG;C:/Program Files/TortoiseSVN/bin;C:/Program Files/TortoiseGit/bin;G:/programs/apache-ant-1.9.3-bin/apache-ant-1.9.3/bin;C:/Program Files/TortoiseHg;C:/Program Files (x86)/QuickTime/QTSystem;G:/programs/apache-maven-3.2.5/bin;C:/Program Files (x86)/CVSNT;D:/glassfish4/glassfish/domains/domain1/config
com.sun.enterprise.glassfish.bootstrap.ASMain
-upgrade
false
-read-stdin
true
-asadmin-args
--host,,,localhost,,,--port,,,4848,,,--user,,,admin,,,--secure=false,,,--terse=false,,,--echo=false,,,--interactive=false,,,start-local-instance,,,--verbose=false,,,--watchdog=false,,,--debug=false,,,--node,,,localhost-domain1,,,instance2
-instancename
instance2
-type
INSTANCE
-verbose
false
-instancedir
D:/glassfish4/glassfish/nodes/localhost-domain1/instance2
-asadmin-classpath
D:/glassfish4/glassfish/modules/admin-cli.jar
-debug
false
-asadmin-classname
com.sun.enterprise.admin.cli.AdminMain]]

[2017-01-20T23:56:25.164+0900] [glassfish 4.1] [INFO] [NCLS-LOGGING-00009] [javax.enterprise.logging] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1484924185035] [timeMillis: 1484924185164] [levelValue: 800] [[
  Running GlassFish Version: GlassFish Server Open Source Edition  4.1.1  (build 1)]]

[2017-01-20T23:56:25.166+0900] [glassfish 4.1] [INFO] [NCLS-LOGGING-00010] [javax.enterprise.logging] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1484924185035] [timeMillis: 1484924185166] [levelValue: 800] [[
  Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter]]

[2017-01-20T23:56:25.295+0900] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924185295] [levelValue: 800] [[
  Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2017-01-20T23:56:25.297+0900] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924185297] [levelValue: 800] [[
  Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2017-01-20T23:56:25.301+0900] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924185301] [levelValue: 800] [[
  Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.]]

[2017-01-20T23:56:25.487+0900] [glassfish 4.1] [INFO] [gms.join] [ShoalLogger] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1484924185034] [timeMillis: 1484924185487] [levelValue: 800] [[
  GMS1095: member: instance2 is joining group: cluster2 ...]]

[2017-01-20T23:56:25.517+0900] [glassfish 4.1] [CONFIG] [] [ShoalLogger] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1484924185034] [timeMillis: 1484924185517] [levelValue: 700] [[
  instantiated following NetworkManager implementation:com.sun.enterprise.mgmt.transport.grizzly.grizzly2.GrizzlyNetworkManager2]]

[2017-01-20T23:56:25.519+0900] [glassfish 4.1] [CONFIG] [] [ShoalLogger] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1484924185034] [timeMillis: 1484924185519] [levelValue: 700] [[
  GMS MAX_MESSAGE_LENGTH=4,196,352]]

[2017-01-20T23:56:25.524+0900] [glassfish 4.1] [CONFIG] [] [ShoalLogger] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1484924185034] [timeMillis: 1484924185524] [levelValue: 700] [[
  
GrizzlyNetworkManager2 Configuration
BIND_INTERFACE_ADDRESS:null  NetworkInterfaceName:null
TCPSTARTPORT..TCPENDPORT:9090..9200
MULTICAST_ADDRESS:MULTICAST_PORT:228.9.162.62:9544 MULTICAST_PACKET_SIZE:65536 MULTICAST_TIME_TO_LIVE: default
FAILURE_DETECT_TCP_RETRANSMIT_TIMEOUT(ms):10000
 MAX_PARALLEL:15
START_TIMEOUT(ms):15000 WRITE_TIMEOUT(ms):10000
MAX_WRITE_SELECTOR_POOL_SIZE:30
]]

[2017-01-20T23:56:25.520+0900] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=17 _ThreadName=Thread-8] [timeMillis: 1484924185520] [levelValue: 800] [[
  Grizzly 2.0 NetworkManager]]

[2017-01-20T23:56:25.763+0900] [glassfish 4.1] [INFO] [] [org.hibernate.validator.internal.util.Version] [tid: _ThreadID=18 _ThreadName=RunLevelControllerThread-1484924185035] [timeMillis: 1484924185763] [levelValue: 800] [[
  HV000001: Hibernate Validator 5.1.2.Final]]

[2017-01-20T23:56:25.841+0900] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924185841] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2017-01-20T23:56:25.844+0900] [glassfish 4.1] [INFO] [SEC-SVCS-00100] [javax.enterprise.security.services] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924185844] [levelValue: 800] [[
  Authorization Service has successfully initialized.]]

[2017-01-20T23:56:25.937+0900] [glassfish 4.1] [CONFIG] [] [ShoalLogger] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1484924185034] [timeMillis: 1484924185937] [levelValue: 700] [[
  Grizzly controller listening on /0:0:0:0:0:0:0:0:9140. Transport started in 395 ms]]

[2017-01-20T23:56:26.054+0900] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186054] [levelValue: 800] [[
  Grizzly Framework 2.3.23 started in: 94ms - bound to [/0.0.0.0:28081]]]

[2017-01-20T23:56:26.077+0900] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186077] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2017-01-20T23:56:26.150+0900] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186150] [levelValue: 800] [[
  Grizzly Framework 2.3.23 started in: 27ms - bound to [/0.0.0.0:28182]]]

[2017-01-20T23:56:26.182+0900] [glassfish 4.1] [WARNING] [] [org.glassfish.grizzly.config.Utils] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186182] [levelValue: 900] [[
  Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=admin-listener, realClassName=org.glassfish.grizzly.http2.Http2AddOn]]

[2017-01-20T23:56:26.212+0900] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186212] [levelValue: 800] [[
  Grizzly Framework 2.3.23 started in: 16ms - bound to [/0.0.0.0:24849]]]

[2017-01-20T23:56:26.353+0900] [glassfish 4.1] [INFO] [] [org.glassfish.ha.store.spi.BackingStoreFactoryRegistry] [tid: _ThreadID=20 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186353] [levelValue: 800] [[
  Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry]]

[2017-01-20T23:56:26.471+0900] [glassfish 4.1] [INFO] [jts.startup_msg] [javax.enterprise.system.core.transaction.com.sun.jts.CosTransactions] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186471] [levelValue: 800] [[
  JTS5014: Recoverable JTS instance, serverId = [100]]]

[2017-01-20T23:56:26.485+0900] [glassfish 4.1] [INFO] [jts.startup_msg] [javax.enterprise.system.core.transaction.com.sun.jts.CosTransactions] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186485] [levelValue: 800] [[
  JTS5014: Recoverable JTS instance, serverId = [100]]]

[2017-01-20T23:56:26.797+0900] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186797] [levelValue: 800] [[
  Created HTTP listener http-listener-1 on host/port 0.0.0.0:28081]]

[2017-01-20T23:56:26.813+0900] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186813] [levelValue: 800] [[
  Created HTTP listener http-listener-2 on host/port 0.0.0.0:28182]]

[2017-01-20T23:56:26.998+0900] [glassfish 4.1] [WARNING] [AS-WEB-GLUE-00080] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924186998] [levelValue: 900] [[
  Unrecognized cipher: TLS_RSA_WITH_AES_128_GCM_SHA256]]

[2017-01-20T23:56:27.018+0900] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924187018] [levelValue: 800] [[
  Created HTTP listener admin-listener on host/port 0.0.0.0:24849]]

[2017-01-20T23:56:27.090+0900] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924187090] [levelValue: 800] [[
  Created virtual server server]]

[2017-01-20T23:56:27.094+0900] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=RunLevelControllerThread-1484924185042] [timeMillis: 1484924187094] [levelValue: 800] [[
  Created virtual server __asadmin]]

[2017-01-20T23:56:27.105+0900] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=76 _ThreadName=Recovery Helper Thread] [timeMillis: 1484924187105] [levelValue: 800] [[
  visiting unvisited references]]

My environment is following.

OS: Windows 7 Professional Service Pack 1 (64bit)
CPU: Intel(R) Core(TM) i7-2640M CPU @ 2.80 GHz
Memory: 8GB

D:\glassfish4\glassfish\bin>java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)




[GLASSFISH-21636] proxy-auth-cert web devtest fails in Hudsons Created: 09/Dec/16  Updated: 18/Jan/17  Resolved: 18/Jan/17

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: xin.li
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The test fails in continuous and nightly Hudsons.

Continuous build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/lastSuccessfulBuild/artifact/appserv-tests/test_results.html

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html

deploy-war-commonpe:
[exec] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true deploy --contextroot /web-proxy-auth-cert --force=false --precompilejsp=true --verify=false --generatermistubs=false --availabilityenabled=false --asyncreplication=true --target server --keepreposdir=false --keepfailedstubs=false --isredeploy=false --logreportederrors=true --_classicstyle=false --upload=true /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/build/module/archive/web-proxy-auth-cert-web.war
[exec] Application deployed with name web-proxy-auth-cert-web.

deploy-war-commonee:

run:
[java] proxy-auth-cert test failed
[java] java.lang.Exception: Wrong response. Expected: true, received:
[java] at WebTest.invoke(Unknown Source)
[java] at WebTest.doTest(Unknown Source)
[java] at WebTest.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:498)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:809)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - proxy-auth-cert: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by Shing Wai Chan [ 21/Dec/16 ]

I also see the failure in my local workspace.

Comment by Shing Wai Chan [ 10/Jan/17 ]

I see the following in sever.log:
Error parsing client cert chain into array of java.security.cert.X509Certificate instances
java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: java.lang.IllegalArgumentException: Last unit does not have enough valid bits
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:110)
at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:339)
at com.sun.enterprise.web.ProxyHandlerImpl.getSSLClientCertificateChain(ProxyHandlerImpl.java:89)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: java.lang.IllegalArgumentException: Last unit does not have enough valid bits
at sun.security.util.Pem.decode(Pem.java:49)
at sun.security.provider.X509Factory.readOneBlock(X509Factory.java:638)
at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:96)
... 23 more
Caused by: java.lang.IllegalArgumentException: Last unit does not have enough valid bits
at java.util.Base64$Decoder.decode0(Base64.java:734)
at java.util.Base64$Decoder.decode(Base64.java:526)
at sun.security.util.Pem.decode(Pem.java:47)
... 25 more

Comment by xin.li [ 10/Jan/17 ]

We created standalone test to parse CLIENT_CERT. Then we found it can pass in JDK7 but fail in JDK8.
There is a difference between JDK7 and JDK8.
In JDK7, X509Factory use BASE64Decoder and BASE64Encoder under sun.misc to encode and decode string.
In JDK8, it use java.util.Base64 to do it.
It seems like java.util.Base64 check more strictly than BASE64Decoder/BASE64Encoder.
I will look into JDK source to find root cause

Comment by xin.li [ 18/Jan/17 ]

Committed revision 64399





[GLASSFISH-21634] max-keep-alive-requests web devtest hudson test fails Created: 09/Dec/16  Updated: 12/Jan/17  Resolved: 12/Jan/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: micheng
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

max-keep-alive-requests fails in continuous and nightly runs.

Continuous build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-trunk-web-devtests-continuous/lastSuccessfulBuild/artifact/appserv-tests/test_results.html

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html

asadmin-common-ignore-fail:
[echo] asadmin set --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --host localhost.localdomain --port 45707 --echo=true --terse=true server.network-config.protocols.protocol.http-listener-1.http.max-connections=1
[exec] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set server.network-config.protocols.protocol.http-listener-1.http.max-connections=1
[exec] remote failure: Could not change the attributes: Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[exec] Config bean already locked GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http
[exec] Result: 1

run:
[javac] /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/devtests/web/maxKeepAliveRequests/build.xml:78: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file
[javac] Note: /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/devtests/web/maxKeepAliveRequests/WebTest.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[java] GET / HTTP/1.1
[java]
[java] GET / HTTP/1.1
[java]
[java] GET / HTTP/1.1
[java]
[java] line: HTTP/1.1 200 OK
[java] line: Server: GlassFish Server Open Source Edition 5.0
[java] line: X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition 5.0 Java/Oracle Corporation/1.8)
[java] line: Accept-Ranges: bytes
[java] line: ETag: W/"4626-1481107595000"
[java] line: Last-Modified: Wed, 07 Dec 2016 10:46:35 GMT
[java] line: Content-Type: text/html
[java] line: Date: Wed, 07 Dec 2016 10:56:15 GMT
[java] line: Content-Length: 4626
[java] line:
[java] line: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
[java] line: <html lang="en">
[java] line: <!--
[java] line: DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
[java] line:
[java] line: Copyright (c) 2010, 2014 Oracle and/or its affiliates. All rights reserved.
[java] line:
[java] line: Use is subject to License Terms
[java] line: -->
[java] line: <head>
[java] line: <style type="text/css">
[java] line: body

{margin-top:0}

[java] line: body,td,p,div,span,a,ul,ul li, ol, ol li, ol li b, dl,h1,h2,h3,h4,h5,h6,li

{font-family:geneva,helvetica,arial,"lucida sans",sans-serif; font-size:10pt}

[java] line: h1

{font-size:18pt}

[java] line: h2

{font-size:14pt}

[java] line: h3

{font-size:12pt}

[java] line: code,kbd,tt,pre

{font-family:monaco,courier,"courier new"; font-size:10pt;}

[java] line: li

{padding-bottom: 8px}

[java] line: p.copy, p.copy a

{font-family:geneva,helvetica,arial,"lucida sans",sans-serif; font-size:8pt}

[java] line: p.copy

{text-align: center}

[java] line: table.grey1,tr.grey1,td.grey1

{background:#f1f1f1}

[java] line: th

color: Color value is invalid

[java] line: td.insidehead

{font-weight:bold; background:white; text-align: left;}

[java] line: a

{text-decoration:none; color:#3E6B8A}

[java] line: a:visited
[java] line: a:hover

{text-decoration:underline}

[java] line: </style>
[java] line: <title>GlassFish Server - Server Running</title>
[java] line: </head>
[java] line: <body bgcolor="#ffffff" text="#000000" link="#594fbf" vlink="#1005fb" alink="#333366"><br> <table width="100%" border="0" cellspacing="0" cellpadding="3">
[java] line: <tbody>
[java] line: <tr><td align="right" valign="top"> <a href="http://www.oracle.com">oracle.com</a> </td></tr>
[java] line: <tr><td align="left" valign="top" bgcolor="#587993"> <font color="#ffffff"> <b>GlassFish Server</b></font> </td></tr>
[java] line: </tbody>
[java] line: </table>
[java] line: <h1>Your server is now running</h1>
[java] line: <p>To replace this page, overwrite the file <code>index.html</code> in the document root folder of this server. The document root folder for this server is the <code>docroot</code> subdirectory of this server's domain directory.</p>
[java] line: <p>To manage a server on the <b>local host</b> with the <b>default administration port</b>, <a href="http://localhost:4848">go to the Administration Console</a>.</p>
[java] line: <!--
[java] line: <h2>Get Oracle GlassFish Server with Premier Support</h2>
[java] line: <p>For production deployments, consider Oracle GlassFish Server with <a href="http://www.oracle.com/support/premier/index.html">Oracle Premier Support for Software</a>. Premier Support helps lower the total cost and risk of owning your Oracle solutions, improve the return from your IT investment, and optimize the business value of your IT solutions. Benefits of Premier Support include product updates and enhancements, global reach, lifetime support, ecosystem support, and proactive, automated support.</p>
[java] line: <h2>Install and update additional software components</h2>
[java] line: <p>Use the <a href="http://wikis.oracle.com/display/IpsBestPractices/">Update Tool</a> to install and update additional technologies and frameworks such as:</p>
[java] line: <ul>
[java] line: <li>OSGi HTTP Service</li>
[java] line: <li>Generic Resource Adapter for JMS</li>
[java] line: <li>OSGi Administration Console</li>
[java] line: </ul>
[java] line: <p>If you are using the web profile, you can also use Update Tool to obtain technologies that are included by default in the full platform, such as:</p>
[java] line: <ul>
[java] line: <li>Enterprise Java Beans</li>
[java] line: <li><a href="http://metro.java.net/">Metro</a></li>
[java] line: <li><a href="http://jersey.java.net/">Jersey</a></li>
[java] line: </ul>
[java] line: <p>To improve the user experience and optimize offerings to users, Oracle collects data about <a href="http://wikis.oracle.com/display/GlassFish/UsageMetrics">GlassFish Server usage</a> that is transmitted by the Update Tool installer as part of the automatic update processes. No personally identifiable information is collected by this process.</p>
[java] line: -->
[java] line: <h2>Join the GlassFish community</h2>
[java] line: <p>Visit the <a href="http://glassfish.java.net">GlassFish Community</a> page for information about how to join the GlassFish community. The GlassFish community is developing an open source, production-quality, enterprise-class application server that implements the newest features of the Java™ Platform, Enterprise Edition (Java EE) platform and related enterprise technologies.</p>
[java] line: <h2>Learn more about GlassFish Server</h2>
[java] line: <p>For more information about GlassFish Server, samples, documentation, and additional resources, see <var>as-install</var><code>/docs/about.html</code>, where <var>as-install</var> is the GlassFish Server installation directory.</p>
[java] line: <hr style="width: 80%; height: 2px;">
[java] line: <p class="copy"><a href="http://www.oracle.com/corporate/">Company Info</a>   |   <a href="http://www.oracle.com/corporate/contact/">Contact</a>   |  
[java] line: Copyright © 2010, 2014 Oracle Corporation   |   <a href="./copyright.html">Legal Notices</a></p></body></html>
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - maxKeepAliveRequests: FAIL -
[java] -----------------------------------------
[java] - Total PASS : 0 -
[java] - Total FAIL : 1 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by liangzzhang [ 07/Jan/17 ]

this should be a duplicate bug of GLASSFISH-21633. in the build.xml of devetests/web. when a disable the target 'httpCompression'. Then the 'httpConnectorKeepAlive' passed without fail. It looks like the fails of previous test target blocked the configBean. So the 'httpConnectorKeepAlive' target was not able to config well.

Comment by liangzzhang [ 12/Jan/17 ]

For GLASSFISH-21634, the test http-compression & max-keep-alive-requests are both belong to ant target “http-connector”. The max-keep-alive-requests fails when I run the whole “http-connector”. It passed when I disabled the previous test (http-compression). I investigated the test.log and server.log of both tests. Then I found http-compression’s fails caused the GlassFishConfigBean.org.glassfish.grizzly.config.dom.Http locked. As a consequence, all the following tests could not use the config bean anymore. The max-keep-alive-requests tries to use the bean, then it fails.

I think GLASSFISH-21634 is not a bug. It fails only because the previous test broke the config bean, so it could not use the bean anymore. The real issue is GLASSFISH-21633. set it to duplicate.

Comment by liangzzhang [ 12/Jan/17 ]

GLASSFISH-21633





[GLASSFISH-21496] Directory traversal exposes file system resources Created: 28/Jan/16  Updated: 10/Jan/17

Status: Open
Project: glassfish
Component/s: admin, web_container
Affects Version/s: 4.1
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: ggierer Assignee: Vinay Vishal
Resolution: Unresolved Votes: 3
Labels: security
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested on both windows and linux



 Description   

This vulnerability has been tested on windows and linux, GlassFish version 4.1, but is most likely in previous versions as well.

Assuming the GlassFish 4.1 admin console is running locally on 4848 use the following URL to display the asenv.conf file in a browser (no logon required):

http://localhost:4848/theme/META-INF/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/config/asenv.conf

A similar URL can be crafted to examine file system resources or web application resources. I have examples of URLs that can display the WEB-INF/web.xml or even the /etc/passwd file on a unix server.

Note that I have added this as a "critical" priority due to the nature of the potential security threat. Application level servlet filtering can be used to remove the threat but the only option with the admin console is to block the port via a firewall. Please contact me for more information if required.



 Comments   
Comment by makiey [ 02/Feb/16 ]

howdy,
a possible workaround: it seems we need an extra-check for malformed utf-8 input in org.glassfish.grizzly.http.util.UTF8Decoder.
i.e. with a little help of java.nio.charset.CharsetDecoder.decode(...) - we could then examine the coderResult and - if error/malformed - throw a new CharConversionException to stop request processing.

public int convert(final byte[] buffer, final int srcOff, final char[] c, int dstOff, final int length) throws IOException {
final CharsetDecoder cd = StandardCharsets.UTF_8.newDecoder();
final byte[] bufferClone = buffer.clone();
final char[] cClone = c.clone();

final CoderResult decRes = cd.decode(ByteBuffer.wrap(bufferClone), CharBuffer.wrap(cClone), false);
if ((decRes != null) && (decRes.isError() || decRes.isMalformed()))

{ throw new CharConversionException("Conversion error"); }

....

Would be great if someone from grizzly team could take a look at it (Grizzly Framework 2.3.23).

Comment by ggierer [ 03/Feb/16 ]

Hi Guys,

This is a critical issue for our environment. Can you point me in the right direction to perhaps deploy a patch? Is it as simple as modifying org.glassfish.grizzly.http.util.UTF8Decoder and deploying this class? Any help would be greatly appreciated.

Gerald

Comment by makiey [ 04/Feb/16 ]

I think the mentioned workaround should help you. Patch the org.glassfish.grizzly.http.util.UTF8Decoder as described above, compile and put it into the nucleus-grizzly-all.jar (in glassfish/modules), evtl. distribute nucleus-grizzly-all.jar to all your machines, evtl. clear the osgi-caches, restart domain and test it thoughtfully - overlong control characters should cause the CharConversionExceptions.

Comment by ggierer [ 04/Feb/16 ]

Hi,

Thanks for the update. Where can I find the file org.glassfish.grizzly.http.util.UTF8Decoder appropriate to V4.1? Can you attach it to this issue or send to me directly at gerald.gierer@gieman.com? Many thanks for your help!

Comment by makiey [ 04/Feb/16 ]

4.1 -> http://search.maven.org/#artifactdetails|org.glassfish.grizzly|grizzly-http|2.3.15|bundle
4.1.1 -> http://search.maven.org/#artifactdetails|org.glassfish.grizzly|grizzly-http|2.3.23|bundle

Comment by ggierer [ 04/Feb/16 ]

Many thanks!

Comment by ggierer [ 05/Feb/16 ]

Have implemented the suggested fix and all seems well. Thank you very much for your help!

Comment by ggierer [ 03/Mar/16 ]

After more testing we have found that repeated hack attempts will make the server unresponsive requiring a restart. Unfortunately this fix is not enough and should be investigated further...





[GLASSFISH-21423] ServletRequest.getRemoteAddr() returns null in JASPIC SAM Created: 31/Aug/15  Updated: 10/Jan/17  Resolved: 10/Jan/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jgiok Assignee: Shing Wai Chan
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

getRemoteAddr(), getRemoteHost() and getRemotePort() return null / -1 when invoked on a MessageInfo-encapsulated HttpServletRequest, from within a javax.security.auth.message.ServerAuthModule implementation. The SAM has not been deployed as part of an application.



 Comments   
Comment by jgiok [ 03/Sep/15 ]

This issue is erroneous; please disregard it. AJP was the cause. Sorry for the inconvenience.

Comment by Shing Wai Chan [ 10/Jan/17 ]

Close the issue as this is related AJP, not container.





[GLASSFISH-21638] wrongTransportTarget web devtest fails in nightly Hudson Created: 09/Dec/16  Updated: 05/Jan/17  Resolved: 05/Jan/17

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 5.0

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Nightly build:
http://gf-hudson.us.oracle.com/hudson/view/GlassFish/view/Trunk%20Continuous/job/gf-lw-web-devtests/406/artifact/appserv-tests/test_results.html

run:
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true create-protocol --securityenabled=false --target clusterA http-redirect
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true create-protocol-filter --protocol http-redirect --classname org.glassfish.grizzly.config.portunif.HttpRedirectFilter --target clusterA redirect-filter
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true create-protocol --securityenabled=false --target clusterA pu-protocol-test
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true create-protocol-finder --protocol pu-protocol-test --targetprotocol http-listener-2 --classname org.glassfish.grizzly.config.portunif.HttpProtocolFinder --target clusterA http-finder-test
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true create-protocol-finder --protocol pu-protocol-test --targetprotocol http-redirect --classname org.glassfish.grizzly.config.portunif.HttpProtocolFinder --target clusterA http-redirect
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=pu-protocol-test
[java] inst1:
[java] configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=pu-protocol-test
[java]
[java] configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=pu-protocol-test
[java]
[java]
[java] responseCode= 200 location= null
[java] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
[java] <html lang="en">
[java] <!--
[java] DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
[java]
[java] Copyright (c) 2010, 2014 Oracle and/or its affiliates. All rights reserved.
[java]
[java] Use is subject to License Terms
[java] -->
[java] <head>
[java] <style type="text/css">
[java] body

{margin-top:0}

[java] body,td,p,div,span,a,ul,ul li, ol, ol li, ol li b, dl,h1,h2,h3,h4,h5,h6,li

{font-family:geneva,helvetica,arial,"lucida sans",sans-serif; font-size:10pt}

[java] h1

{font-size:18pt}

[java] h2

{font-size:14pt}

[java] h3

{font-size:12pt}

[java] code,kbd,tt,pre

{font-family:monaco,courier,"courier new"; font-size:10pt;}

[java] li

{padding-bottom: 8px}

[java] p.copy, p.copy a

{font-family:geneva,helvetica,arial,"lucida sans",sans-serif; font-size:8pt}

[java] p.copy

{text-align: center}

[java] table.grey1,tr.grey1,td.grey1

{background:#f1f1f1}

[java] th

color: Color value is invalid

[java] td.insidehead

{font-weight:bold; background:white; text-align: left;}

[java] a

{text-decoration:none; color:#3E6B8A}

[java] a:visited
[java] a:hover

{text-decoration:underline}

[java] </style>
[java] <title>GlassFish Server - Server Running</title>
[java] </head>
[java] <body bgcolor="#ffffff" text="#000000" link="#594fbf" vlink="#1005fb" alink="#333366"><br> <table width="100%" border="0" cellspacing="0" cellpadding="3">
[java] <tbody>
[java] <tr><td align="right" valign="top"> <a href="<a href="http://www.oracle.com">http://www.oracle.com</a>">oracle.com</a> </td></tr>
[java] <tr><td align="left" valign="top" bgcolor="#587993"> <font color="#ffffff">&nbsp;<b>GlassFish Server</b></font> </td></tr>
[java] </tbody>
[java] </table>
[java] <h1>Your server is now running</h1>
[java] <p>To replace this page, overwrite the file <code>index.html</code> in the document root folder of this server. The document root folder for this server is the <code>docroot</code> subdirectory of this server's domain directory.</p>
[java] <p>To manage a server on the <b>local host</b> with the <b>default administration port</b>, <a href="<a href="http://localhost:4848">http://localhost:4848</a>">go to the Administration Console</a>.</p>
[java] <!--
[java] <h2>Get Oracle GlassFish Server with Premier Support</h2>
[java] <p>For production deployments, consider Oracle GlassFish Server with <a href="<a href="http://www.oracle.com/support/premier/index.html">http://www.oracle.com/support/premier/index.html</a>">Oracle Premier Support for Software</a>. Premier Support helps lower the total cost and risk of owning your Oracle solutions, improve the return from your IT investment, and optimize the business value of your IT solutions. Benefits of Premier Support include product updates and enhancements, global reach, lifetime support, ecosystem support, and proactive, automated support.</p>
[java] <h2>Install and update additional software components</h2>
[java] <p>Use the <a href="<a href="http://wikis.oracle.com/display/IpsBestPractices/">http://wikis.oracle.com/display/IpsBestPractices/</a>">Update Tool</a> to install and update additional technologies and frameworks such as:</p>
[java] <ul>
[java] <li>OSGi HTTP Service</li>
[java] <li>Generic Resource Adapter for JMS</li>
[java] <li>OSGi Administration Console</li>
[java] </ul>
[java] <p>If you are using the web profile, you can also use Update Tool to obtain technologies that are included by default in the full platform, such as:</p>
[java] <ul>
[java] <li>Enterprise Java Beans</li>
[java] <li><a href="<a href="http://metro.java.net/">http://metro.java.net/</a>">Metro</a></li>
[java] <li><a href="<a href="http://jersey.java.net/">http://jersey.java.net/</a>">Jersey</a></li>
[java] </ul>
[java] <p>To improve the user experience and optimize offerings to users, Oracle collects data about <a href="<a href="http://wikis.oracle.com/display/GlassFish/UsageMetrics">http://wikis.oracle.com/display/GlassFish/UsageMetrics</a>">GlassFish Server usage</a> that is transmitted by the Update Tool installer as part of the automatic update processes. No personally identifiable information is collected by this process.</p>
[java] -->
[java] <h2>Join the GlassFish community</h2>
[java] <p>Visit the <a href="<a href="http://glassfish.java.net">http://glassfish.java.net</a>">GlassFish Community</a> page for information about how to join the GlassFish community. The GlassFish community is developing an open source, production-quality, enterprise-class application server that implements the newest features of the Java&trade; Platform, Enterprise Edition (Java EE) platform and related enterprise technologies.</p>
[java] <h2>Learn more about GlassFish Server</h2>
[java] <p>For more information about GlassFish Server, samples, documentation, and additional resources, see <var>as-install</var><code>/docs/about.html</code>, where <var>as-install</var> is the GlassFish Server installation directory.</p>
[java] <hr style="width: 80%; height: 2px;">
[java] <p class="copy"><a href="<a href="http://www.oracle.com/corporate/">http://www.oracle.com/corporate/</a>">Company Info</a> &nbsp;&nbsp;|&nbsp;&nbsp; <a href="<a href="http://www.oracle.com/corporate/contact/">http://www.oracle.com/corporate/contact/</a>">Contact</a> &nbsp;&nbsp;|&nbsp;&nbsp;
[java] Copyright &copy; 2010, 2014 Oracle Corporation &nbsp;&nbsp;|&nbsp;&nbsp; <a href="./copyright.html">Legal Notices</a></p></body></html>
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=http-listener-1
[java] inst1:
[java] configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=http-listener-1
[java]
[java] configs.config.clusterA-config.network-config.network-listeners.network-listener.http-listener-1.protocol=http-listener-1
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true delete-protocol --target clusterA pu-protocol-test
[java]
[java]
[java] asadmin --host localhost.localdomain --port 45707 --user admin --passwordfile /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true delete-protocol --target clusterA http-redirect
[java]
[java]
[java] Generating report at /scratch/BUILD_AREA/workspace/gf-lw-web-devtests/appserv-tests/test_results.xml
[java]
[java]
[java] -----------------------------------------
[java] - create-http-redirect-protocol: PASS -
[java] - create-protocol-filter-redirect: PASS -
[java] - create-pu-protocol: PASS -
[java] - create-protocol-finder-http-finder: PASS -
[java] - create-protocol-finder-http-redirect: PASS -
[java] - set-http-listener-protocol: PASS -
[java] - response-code: FAIL -
[java] - returned-location: FAIL -
[java] - reset-http-listener-protocol: PASS -
[java] - delete-pu-protocol: PASS -
[java] - delete-http-redirect: PASS -
[java] -----------------------------------------
[java] - Total PASS : 9 -
[java] - Total FAIL : 2 -
[java] - Total DID NOT RUN : 0 -
[java] -----------------------------------------



 Comments   
Comment by Shing Wai Chan [ 05/Jan/17 ]

After fixing the nightly Hudson setup for GLASSFISH-21631, this issue has been resolved.





[GLASSFISH-21067] ClassCastException: org.glassfish.web.ha.session.management.ReplicationWebEventPersistentManager cannot be cast to org.apache.catalina.session.StandardManager Created: 18/May/14  Updated: 20/Dec/16

Status: Open
Project: glassfish
Component/s: load_balancer, web_container
Affects Version/s: 4.1_dev
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Eng.Fouad Assignee: kshitiz_saxena
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have a cluster with 2 instances. When I deploy a web module on the cluster level and enable the option "Availability", the following exception occurs:

java.lang.Exception: java.lang.ClassCastException: org.glassfish.web.ha.session.management.ReplicationWebEventPersistentManager cannot be cast to org.apache.catalina.session.StandardManager
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:2169)
at com.sun.enterprise.v3.server.ApplicationLifecycle.enable(ApplicationLifecycle.java:113)
at com.sun.enterprise.v3.server.ApplicationConfigListener.enableApplication(ApplicationConfigListener.java:272)
at com.sun.enterprise.v3.server.ApplicationConfigListener.handleOtherAppConfigChanges(ApplicationConfigListener.java:223)
at com.sun.enterprise.v3.server.ApplicationConfigListener.transactionCommited(ApplicationConfigListener.java:170)
at org.jvnet.hk2.config.Transactions$TransactionListenerJob.process(Transactions.java:365)
at org.jvnet.hk2.config.Transactions$TransactionListenerJob.process(Transactions.java:356)
at org.jvnet.hk2.config.Transactions$ListenerNotifier$1.call(Transactions.java:213)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:167)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

It seems that the webapp cannot be started because of this line (com.sun.enterprise.web.WebModule:1752):

StandardManager manager = (StandardManager) getManager();

http://grepcode.com/file/maven.java.net/content/groups/promoted/org.glassfish.main.web/web-glue/4.0.1-b01/com/sun/enterprise/web/WebModule.java#WebModule.loadSessions%28java.util.Properties%29

`getManager()` returns a reference of type `org.glassfish.web.ha.session.management.ReplicationWebEventPersistentManager`, whereas it doesn't inherit from `org.apache.catalina.session.StandardManager`.






[GLASSFISH-18619] the default value of traceEnabled is true in V4 when web container is not started. Created: 11/Apr/12  Updated: 20/Dec/16  Resolved: 07/May/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: 4.1_dev

Type: Bug Priority: Trivial
Reporter: Jeremy_Lv Assignee: oleksiys
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all



 Description   

the value of traceEnabled is set to false to make the server less susceptible to cross-site scripting attacks, but in the glassfish the default value are true. The default value of traceEnable is set to false seems to better.



 Comments   
Comment by Shing Wai Chan [ 17/Apr/12 ]

TRACE is disabled by default once web container is started.
I have verified this by deploying a war file. And I got the following:

HTTP/1.1 405 TRACE method is not allowed
X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 4.0 Java/Apple Inc./1.6)
Allow: POST, GET, DELETE, OPTIONS, PUT, HEAD
Date: Tue, 17 Apr 2012 00:10:03 GMT
Connection: close
Content-Length: 0

But when the web container is not started, then TRACE is "not" disabled by default.

Comment by oleksiys [ 07/May/14 ]

fixed





[GLASSFISH-21107] When uploading a large file using an async servlet, after 30 seconds it throws an InterruptedByTimeoutException Created: 26/Jun/14  Updated: 20/Dec/16

Status: Open
Project: glassfish
Component/s: configuration, grizzly-kernel, web_container
Affects Version/s: 4.1_dev
Fix Version/s: None

Type: Bug Priority: Major
Reporter: raulgd Assignee: Chris Kasso
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 64 bit, Java JDK 1.7.0u60 64 bit Glassfish 4.0.1b7 nightly build downloaded on 2014-06-25



 Description   

I created an async servlet for users to upload files, that way the inputstream is buffered without having to load the whole file in memory, as there can be very big files uploaded.

When trying out to upload a 4.6GB file, after 30 seconds, the servlet enters the onError(Throwable t) method with the exception:

Severe:   java.nio.channels.InterruptedByTimeoutException
	at org.apache.catalina.connector.InputBuffer.disableReadHandler(InputBuffer.java:324)
	at org.apache.catalina.connector.Request.asyncTimeout(Request.java:4418)
	at org.apache.catalina.connector.Request.processTimeout(Request.java:4469)
	at org.apache.catalina.connector.Request.access$000(Request.java:156)
	at org.apache.catalina.connector.Request$6.onTimeout(Request.java:4300)
	at org.glassfish.grizzly.http.server.Response$SuspendTimeout.onTimeout(Response.java:2131)
	at org.glassfish.grizzly.http.server.Response$DelayQueueWorker.doWork(Response.java:2180)
	at org.glassfish.grizzly.http.server.Response$DelayQueueWorker.doWork(Response.java:2175)
	at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

Warning:   Context path from ServletContext:  differs from path from bundle: /
WARN:   WELD-000715: HttpContextLifecycle guard not set. The Servlet container is not fully compliant.

Now, I already configured Glassfish for longer timeouts on both Configurations-> server-config -> Network Config -> Network Listeners -> http-listener-1 -> HTTP So that timeout: -1, Connection upload timeout: 3600000 (1 hour), Request Timeout: -1, Max Post Size: -1

And on Configurations-> server-config -> Network Config -> Transports -> tcp so that Read Timeout: 3600000 (1 hour), Write Timeout: 3600000 (1 hour)

Now, AFAIK, because it's an NIO timeout exception, just by changing the tcp read and write timeout to 1 hour should avoid the issue, but still, the exception happens exactly 30 seconds later, as if the timeout configurations are being ignored.

I saw previous issues on grizzly ignoring the read and write timeouts, but they where closed as fixed in mid. 2013 so it shouldn't be an issue now.

For reference, here's my domain.xml:

<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="7">
  <security-configurations>
    <authentication-service default="true" name="adminAuth" use-password-credential="true">
      <security-provider name="spcrealm" type="LoginModule" provider-name="adminSpc">
        <login-module-config name="adminSpecialLM" control-flag="sufficient" module-class="com.sun.enterprise.admin.util.AdminLoginModule">
          <property name="config" value="server-config"></property>
          <property name="auth-realm" value="admin-realm"></property>
        </login-module-config>
      </security-provider>
      <security-provider name="filerealm" type="LoginModule" provider-name="adminFile">
        <login-module-config name="adminFileLM" control-flag="sufficient" module-class="com.sun.enterprise.security.auth.login.FileLoginModule">
          <property name="config" value="server-config"></property>
          <property name="auth-realm" value="admin-realm"></property>
        </login-module-config>
      </security-provider>
    </authentication-service>
    <authorization-service default="true" name="authorizationService">
      <security-provider name="simpleAuthorization" type="Simple" provider-name="simpleAuthorizationProvider">
        <authorization-provider-config support-policy-deploy="false" name="simpleAuthorizationProviderConfig"></authorization-provider-config>
      </security-provider>
    </authorization-service>
  </security-configurations>
  <managed-job-config></managed-job-config>
  <system-applications>
    <application context-root="" location="${com.sun.aas.installRootURI}/lib/install/applications/__admingui" directory-deployed="true" name="__admingui" object-type="system-admin">
      <module name="__admingui">
        <engine sniffer="web"></engine>
        <engine sniffer="security"></engine>
      </module>
    </application>
  </system-applications>
  <resources>
    <jdbc-resource pool-name="SamplePool" jndi-name="jdbc/sample"></jdbc-resource>
    <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin"></jdbc-resource>
    <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default" object-type="system-all"></jdbc-resource>
    <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool">
      <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"></property>
      <property name="connectionAttributes" value=";create=true"></property>
    </jdbc-connection-pool>
    <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.ClientDataSource" is-isolation-level-guaranteed="false" res-type="javax.sql.DataSource" name="DerbyPool">
      <property name="PortNumber" value="1527"></property>
      <property name="Password" value="APP"></property>
      <property name="User" value="APP"></property>
      <property name="serverName" value="localhost"></property>
      <property name="DatabaseName" value="sun-appserv-samples"></property>
      <property name="connectionAttributes" value=";create=true"></property>
    </jdbc-connection-pool>
    <connector-connection-pool max-pool-size="250" steady-pool-size="1" name="jms/__defaultConnectionFactory-Connection-Pool" resource-adapter-name="jmsra" connection-definition-name="javax.jms.ConnectionFactory"></connector-connection-pool>
    <connector-resource pool-name="jms/__defaultConnectionFactory-Connection-Pool" jndi-name="jms/__defaultConnectionFactory" object-type="system-all-req"></connector-resource>
    <context-service jndi-name="concurrent/__defaultContextService" object-type="system-all"></context-service>
    <managed-executor-service jndi-name="concurrent/__defaultManagedExecutorService" object-type="system-all"></managed-executor-service>
    <managed-scheduled-executor-service jndi-name="concurrent/__defaultManagedScheduledExecutorService" object-type="system-all"></managed-scheduled-executor-service>
    <managed-thread-factory jndi-name="concurrent/__defaultManagedThreadFactory" object-type="system-all"></managed-thread-factory>
    <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource" name="SamplePool">
      <property name="DatabaseName" value="sample"></property>
      <property name="User" value="app"></property>
      <property name="Password" value="app"></property>
      <property name="URL" value="jdbc:derby://localhost:1527/sample"></property>
      <property name="PortNumber" value="1527"></property>
      <property name="serverName" value="localhost"></property>
    </jdbc-connection-pool>
  </resources>
  <servers>
    <server name="server" config-ref="server-config">
      <application-ref ref="__admingui" virtual-servers="__asadmin"></application-ref>
      <application-ref ref="VegosPortal" virtual-servers="server"></application-ref>
      <resource-ref ref="jdbc/__TimerPool"></resource-ref>
      <resource-ref ref="jdbc/__default"></resource-ref>
      <resource-ref ref="jms/__defaultConnectionFactory"></resource-ref>
      <resource-ref ref="concurrent/__defaultContextService"></resource-ref>
      <resource-ref ref="concurrent/__defaultManagedExecutorService"></resource-ref>
      <resource-ref ref="concurrent/__defaultManagedScheduledExecutorService"></resource-ref>
      <resource-ref ref="concurrent/__defaultManagedThreadFactory"></resource-ref>
      <resource-ref ref="jdbc/sample"></resource-ref>
    </server>
  </servers>
  <nodes>
    <node node-host="localhost" name="localhost-domain1" type="CONFIG" install-dir="${com.sun.aas.productRoot}"></node>
  </nodes>
  <configs>
    <config name="server-config">
      <system-property description="Port Number that JMS Service will listen for remote clients connection." name="JMS_PROVIDER_PORT" value="7676"></system-property>
      <http-service>
        <access-log></access-log>
        <virtual-server id="server" network-listeners="http-listener-1,http-listener-2"></virtual-server>
        <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server>
      </http-service>
      <iiop-service>
        <orb use-thread-pool-ids="thread-pool-1"></orb>
        <iiop-listener id="orb-listener-1" port="3700" address="0.0.0.0" lazy-init="true"></iiop-listener>
        <iiop-listener id="SSL" port="3820" address="0.0.0.0" security-enabled="true">
          <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl>
        </iiop-listener>
        <iiop-listener id="SSL_MUTUALAUTH" port="3920" address="0.0.0.0" security-enabled="true">
          <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl>
        </iiop-listener>
      </iiop-service>
      <admin-service system-jmx-connector-name="system" type="das-and-server">
        <jmx-connector port="8686" address="0.0.0.0" auth-realm-name="admin-realm" name="system">
          <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl>
        </jmx-connector>
        <property name="adminConsoleContextRoot" value="/admin"></property>
        <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property>
        <property name="ipsRoot" value="${com.sun.aas.installRoot}/.."></property>
        <das-config></das-config>
      </admin-service>
      <connector-service></connector-service>
      <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs"></transaction-service>
      <batch-runtime-configuration></batch-runtime-configuration>
      <jms-service default-jms-host="default_JMS_host" type="EMBEDDED">
        <jms-host port="${JMS_PROVIDER_PORT}" host="localhost" name="default_JMS_host"></jms-host>
      </jms-service>
      <ejb-container>
        <ejb-timer-service></ejb-timer-service>
      </ejb-container>
      <web-container>
        <session-config>
          <session-manager>
            <manager-properties></manager-properties>
            <store-properties></store-properties>
          </session-manager>
          <session-properties></session-properties>
        </session-config>
      </web-container>
      <rest-config></rest-config>
      <cdi-service></cdi-service>
      <diagnostic-service></diagnostic-service>
      <security-service>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">
          <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property>
          <property name="jaas-context" value="fileRealm"></property>
        </auth-realm>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">
          <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile"></property>
          <property name="jaas-context" value="fileRealm"></property>
        </auth-realm>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm>
        <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl">
          <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property>
        </jacc-provider>
        <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider>
        <audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
          <property name="auditOn" value="false"></property>
        </audit-module>
        <message-security-config auth-layer="SOAP">
          <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="dynamic.username.password" value="false"></property>
            <property name="debug" value="false"></property>
          </provider-config>
          <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="dynamic.username.password" value="false"></property>
            <property name="debug" value="false"></property>
            <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
          </provider-config>
          <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="debug" value="false"></property>
          </provider-config>
          <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="debug" value="false"></property>
            <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
          </provider-config>
        </message-security-config>
        <message-security-config auth-layer="HttpServlet">
          <provider-config provider-type="server" provider-id="GFConsoleAuthModule" class-name="org.glassfish.admingui.common.security.AdminConsoleAuthModule">
            <request-policy auth-source="sender"></request-policy>
            <response-policy></response-policy>
            <property name="loginPage" value="/login.jsf"></property>
            <property name="loginErrorPage" value="/loginError.jsf"></property>
          </provider-config>
        </message-security-config>
        <property name="default-digest-algorithm" value="SHA-256"></property>
      </security-service>
      <java-config debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" classpath-suffix="">
        <jvm-options>-XX:MaxPermSize=256m</jvm-options>
        <jvm-options>-client</jvm-options>
        <jvm-options>-Djava.awt.headless=true</jvm-options>
        <jvm-options>-Djdk.corba.allowOutputStreamSubclass=true</jvm-options>
        <jvm-options>-Djavax.management.builder.initial=com.sun.enterprise.v3.admin.AppServerMBeanServerBuilder</jvm-options>
        <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
        <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
        <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
        <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
        <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
        <jvm-options>-Xmx1024m</jvm-options>
        <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
        <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
        <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
        <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
        <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
        <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
        <jvm-options>-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
        <jvm-options>-Dgosh.args=--nointeractive</jvm-options>
        <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
        <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
        <jvm-options>-Dfelix.fileinstall.log.level=2</jvm-options>
        <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
        <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
        <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
        <jvm-options>-XX:NewRatio=2</jvm-options>
      </java-config>
      <network-config>
        <protocols>
          <protocol name="http-listener-1">
            <http request-timeout-seconds="-1" timeout-seconds="-1" connection-upload-timeout-millis="3600000" default-virtual-server="server" max-connections="1500">
              <file-cache></file-cache>
            </http>
          </protocol>
          <protocol security-enabled="true" name="http-listener-2">
            <http default-virtual-server="server" max-connections="250">
              <file-cache></file-cache>
            </http>
            <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" ssl3-enabled="false" cert-nickname="s1as"></ssl>
          </protocol>
          <protocol name="admin-listener">
            <http default-virtual-server="__asadmin" max-connections="250" encoded-slash-enabled="true">
              <file-cache></file-cache>
            </http>
          </protocol>
          <protocol security-enabled="true" name="sec-admin-listener">
            <http default-virtual-server="__asadmin" encoded-slash-enabled="true">
              <file-cache></file-cache>
            </http>
            <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl>
          </protocol>
          <protocol name="admin-http-redirect">
            <http-redirect secure="true"></http-redirect>
          </protocol>
          <protocol name="pu-protocol">
            <port-unification>
              <protocol-finder protocol="sec-admin-listener" name="http-finder" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder"></protocol-finder>
              <protocol-finder protocol="admin-http-redirect" name="admin-http-redirect" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder"></protocol-finder>
            </port-unification>
          </protocol>
        </protocols>
        <network-listeners>
          <network-listener port="80" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
          <network-listener port="8181" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
          <network-listener port="4848" protocol="pu-protocol" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
        </network-listeners>
        <transports>
          <transport write-timeout-millis="3600000" byte-buffer-type="HEAP" read-timeout-millis="3600000" display-configuration="true" name="tcp"></transport>
        </transports>
      </network-config>
      <thread-pools>
        <thread-pool max-thread-pool-size="50" name="admin-thread-pool" max-queue-size="256"></thread-pool>
        <thread-pool name="http-thread-pool"></thread-pool>
        <thread-pool max-thread-pool-size="200" name="thread-pool-1"></thread-pool>
      </thread-pools>
      <monitoring-service>
        <module-monitoring-levels></module-monitoring-levels>
      </monitoring-service>
      <group-management-service>
        <failure-detection></failure-detection>
      </group-management-service>
      <availability-service></availability-service>
    </config>
    <config name="default-config">
      <http-service>
        <access-log></access-log>
        <virtual-server id="server" network-listeners="http-listener-1, http-listener-2">
          <property name="default-web-xml" value="${com.sun.aas.instanceRoot}/config/default-web.xml"></property>
        </virtual-server>
        <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server>
      </http-service>
      <iiop-service>
        <orb use-thread-pool-ids="thread-pool-1"></orb>
        <iiop-listener id="orb-listener-1" port="${IIOP_LISTENER_PORT}" address="0.0.0.0"></iiop-listener>
        <iiop-listener id="SSL" port="${IIOP_SSL_LISTENER_PORT}" address="0.0.0.0" security-enabled="true">
          <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as"></ssl>
        </iiop-listener>
        <iiop-listener id="SSL_MUTUALAUTH" port="${IIOP_SSL_MUTUALAUTH_PORT}" address="0.0.0.0" security-enabled="true">
          <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true"></ssl>
        </iiop-listener>
      </iiop-service>
      <admin-service system-jmx-connector-name="system">
        <jmx-connector port="${JMX_SYSTEM_CONNECTOR_PORT}" address="0.0.0.0" auth-realm-name="admin-realm" name="system">
          <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="glassfish-instance"></ssl>
        </jmx-connector>
        <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war"></property>
        <das-config></das-config>
      </admin-service>
      <web-container>
        <session-config>
          <session-manager>
            <manager-properties></manager-properties>
            <store-properties></store-properties>
          </session-manager>
          <session-properties></session-properties>
        </session-config>
      </web-container>
      <ejb-container>
        <ejb-timer-service></ejb-timer-service>
      </ejb-container>
      <mdb-container></mdb-container>
      <jms-service addresslist-behavior="priority" default-jms-host="default_JMS_host" type="EMBEDDED">
        <jms-host port="${JMS_PROVIDER_PORT}" host="localhost" name="default_JMS_host"></jms-host>
      </jms-service>
      <log-service log-rotation-limit-in-bytes="2000000" file="${com.sun.aas.instanceRoot}/logs/server.log">
        <module-log-levels></module-log-levels>
      </log-service>
      <security-service>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">
          <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property>
          <property name="jaas-context" value="fileRealm"></property>
        </auth-realm>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">
          <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile"></property>
          <property name="jaas-context" value="fileRealm"></property>
        </auth-realm>
        <auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate"></auth-realm>
        <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl">
          <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy"></property>
        </jacc-provider>
        <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory"></jacc-provider>
        <audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
          <property name="auditOn" value="false"></property>
        </audit-module>
        <message-security-config auth-layer="SOAP">
          <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="dynamic.username.password" value="false"></property>
            <property name="debug" value="false"></property>
          </provider-config>
          <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="dynamic.username.password" value="false"></property>
            <property name="debug" value="false"></property>
            <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
          </provider-config>
          <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="debug" value="false"></property>
          </provider-config>
          <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
            <request-policy auth-source="content"></request-policy>
            <response-policy auth-source="content"></response-policy>
            <property name="encryption.key.alias" value="s1as"></property>
            <property name="signature.key.alias" value="s1as"></property>
            <property name="debug" value="false"></property>
            <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml"></property>
          </provider-config>
        </message-security-config>
      </security-service>
      <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" automatic-recovery="true"></transaction-service>
      <diagnostic-service></diagnostic-service>
      <java-config debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix="">
        <jvm-options>-XX:MaxPermSize=256m</jvm-options>
        <jvm-options>-server</jvm-options>
        <jvm-options>-Djava.awt.headless=true</jvm-options>
        <jvm-options>-Djdk.corba.allowOutputStreamSubclass=true</jvm-options>
        <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
        <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
        <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
        <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
        <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
        <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
        <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
        <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
        <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
        <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
        <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
        <jvm-options>-XX:NewRatio=2</jvm-options>
        <jvm-options>-Xmx1024m</jvm-options>
        <jvm-options>-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.fileinstall</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
        <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
        <jvm-options>-Dgosh.args=--noshutdown -c noop=true</jvm-options>
        <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
        <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
        <jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options>
        <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
        <jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
        <jvm-options>-Dfelix.fileinstall.disableConfigSave=false</jvm-options>
      </java-config>
      <availability-service>
        <web-container-availability></web-container-availability>
        <ejb-container-availability sfsb-store-pool-name="jdbc/hastore"></ejb-container-availability>
        <jms-availability></jms-availability>
      </availability-service>
      <network-config>
        <protocols>
          <protocol name="http-listener-1">
            <http default-virtual-server="server">
              <file-cache></file-cache>
            </http>
          </protocol>
          <protocol security-enabled="true" name="http-listener-2">
            <http default-virtual-server="server">
              <file-cache></file-cache>
            </http>
            <ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" ssl3-enabled="false" cert-nickname="s1as"></ssl>
          </protocol>
          <protocol name="admin-listener">
            <http default-virtual-server="__asadmin" max-connections="250">
              <file-cache></file-cache>
            </http>
          </protocol>
          <protocol security-enabled="true" name="sec-admin-listener">
            <http default-virtual-server="__asadmin" encoded-slash-enabled="true">
              <file-cache></file-cache>
            </http>
            <ssl client-auth="want" classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="glassfish-instance"></ssl>
          </protocol>
          <protocol name="admin-http-redirect">
            <http-redirect secure="true"></http-redirect>
          </protocol>
          <protocol name="pu-protocol">
            <port-unification>
              <protocol-finder protocol="sec-admin-listener" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder" name="http-finder"></protocol-finder>
              <protocol-finder protocol="admin-http-redirect" classname="org.glassfish.grizzly.config.portunif.HttpProtocolFinder" name="admin-http-redirect"></protocol-finder>
            </port-unification>
          </protocol>
        </protocols>
        <network-listeners>
          <network-listener port="${HTTP_LISTENER_PORT}" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
          <network-listener port="${HTTP_SSL_LISTENER_PORT}" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
          <network-listener port="${ASADMIN_LISTENER_PORT}" protocol="pu-protocol" transport="tcp" name="admin-listener" thread-pool="http-thread-pool"></network-listener>
        </network-listeners>
        <transports>
          <transport name="tcp"></transport>
        </transports>
      </network-config>
      <thread-pools>
        <thread-pool name="http-thread-pool"></thread-pool>
        <thread-pool max-thread-pool-size="200" name="thread-pool-1"></thread-pool>
        <thread-pool max-thread-pool-size="50" name="admin-thread-pool" max-queue-size="256"></thread-pool>
      </thread-pools>
      <group-management-service>
        <failure-detection></failure-detection>
      </group-management-service>
      <system-property description="Port Number that JMS Service will listen for remote clients connection." name="JMS_PROVIDER_PORT" value="27676"></system-property>
      <system-property name="ASADMIN_LISTENER_PORT" value="24848"></system-property>
      <system-property name="HTTP_LISTENER_PORT" value="28080"></system-property>
      <system-property name="HTTP_SSL_LISTENER_PORT" value="28181"></system-property>
      <system-property name="IIOP_LISTENER_PORT" value="23700"></system-property>
      <system-property name="IIOP_SSL_LISTENER_PORT" value="23820"></system-property>
      <system-property name="IIOP_SSL_MUTUALAUTH_PORT" value="23920"></system-property>
      <system-property name="JMX_SYSTEM_CONNECTOR_PORT" value="28686"></system-property>
      <system-property name="OSGI_SHELL_TELNET_PORT" value="26666"></system-property>
      <system-property name="JAVA_DEBUGGER_PORT" value="29009"></system-property>
      <monitoring-service>
        <module-monitoring-levels></module-monitoring-levels>
      </monitoring-service>
    </config>
  </configs>
  <property name="administrative.domain.name" value="domain1"></property>
  <secure-admin enabled="true" special-admin-indicator="8666d952-1f41-4ba9-a0c0-ec7396d974b7">
    <secure-admin-principal dn="CN=localhost,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal>
    <secure-admin-principal dn="CN=localhost-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US"></secure-admin-principal>
  </secure-admin>
  <clusters></clusters>
  <applications>
    <application context-root="/vegos" location="file:/D:/NetbeansProjects/VegosPortal/target/VegosPortal-1.0/" name="VegosPortal" directory-deployed="true" object-type="user">
      <property name="archiveType" value="war"></property>
      <property name="appLocation" value="file:/D:/NetbeansProjects/VegosPortal/target/VegosPortal-1.0/"></property>
      <property name="org.glassfish.ejb.container.application_unique_id" value="91995825334714368"></property>
      <property name="defaultAppName" value="VegosPortal-1.0"></property>
      <module name="VegosPortal">
        <engine sniffer="ejb"></engine>
        <engine sniffer="security"></engine>
        <engine sniffer="weld"></engine>
        <engine sniffer="web"></engine>
      </module>
    </application>
  </applications>
</domain>

I tried the exact same code in WildFly 8.1.0 and works perfectly, so I know it's grizzly's NIO configuration.



 Comments   
Comment by raulgd [ 10/Dec/14 ]

This problem doesn't happen in Glassfish 4.1b13 with JDK 8u25 anymore.

Only there are 2 things to specify, first, the http-thread-pool timeout also has to be set to the same timeout as the tcp read timeout and connection upload timeout.

The other one, on the async servlet, right after initiating the async context with:

AsyncContext context = request.startAsync(); 

You have to set the timeout for the context with:

context.setTimeout(3600000);

Just replace the 3600000 with whatever timeout you set.

It would be ideal to just have the servlet get the timeout specified from the domain configuration, but at least is working now setting it by hand.

Comment by Masoud Kalali [ 07/Dec/15 ]

Considering that I am no longer active in GlassFish space I am assigning all the tickets to Chris Kasso in Java EE/ Application Servers team and he can reassign them as appropriate.





[GLASSFISH-20670] Performance problem in getInitParameter and getInitParameterNames() of org.apache.catalina.core.ApplicationContext (glassfish version), which are called very often by JSF frameworks Created: 28/Jun/13  Updated: 20/Dec/16  Resolved: 13/May/14

Status: Resolved
Project: glassfish
Component/s: performance, web_container
Affects Version/s: 3.1.2.2, 4.0_dev
Fix Version/s: 4.1_dev

Type: Bug Priority: Major
Reporter: lsxx Assignee: Scott Oaks
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: 4_0_1-review

 Description   

During performance tests (multiple parallel threads) of our enterprise application we discovered that 62% of time is spent in org.apache.catalina.core.ApplicationContext.mergeParameters.

      • Background:
        The calls to this method have origin in JSF stack - there are calls to context.getExternalContext().getInitParameter() from
        javax.faces.component.UIComponent.pushComponentToEL
        javax.faces.component.UIComponent.popComponentFromEL
        In default JSF implementation provided with glassfish the value for UIComponent.HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME is obtained (without caching) for each call withing these methods.
      • Source of problem:
        The mergeParameters, which is internally called from getInitParameter and getInitParameterNames(), is synchronized.
        I analysed source of this class and believe that synchronization in this area could be improved.
        The problem was discovered during tests with glassfish 3.1.1.2, but it seems that other versions including trunk are affected as well.
      • Suggested solution:
        The problem seems to be easy to fix.

This is the original body for mergeParameters:
private synchronized void mergeParameters() {
if (parametersMerged)

{ return; }

[...]

parametersMerged = true;
}

As:
- this is the only synchronized method and there no "synchronized (this)" in this class
- the field parametersMerged is assigned a value only in mergeParameters (last line) and at initialization (private volatile boolean parametersMerged = false
- after the first execution of mergeParameters the field parametersMerged will never be assigned any value (especially false) and other calls to mergeParameters are waste of time.
- the field parametersMerged is volatile
the problem could be successfully solved by moving the synchronization to inside of the method and double checking the initial condition:

private void mergeParameters() {
if (parametersMerged) { return; }

synchronized(this){
if (parametersMerged)

{ return; }

[...]

parametersMerged = true;
}
}



 Comments   
Comment by Shing Wai Chan [ 13/May/14 ]

Sending src/main/java/org/apache/catalina/core/ApplicationContext.java
Transmitting file data .
Committed revision 63266.

Comment by lsxx [ 08/Aug/14 ]

The bug is not fixed - the introduced change has no effect as long the method mergeParameters is still synchronized.
Adding "sychnronized(this)"-block within synchronized method has no effect.

Comment by Sergiy_Rezvan [ 26/Feb/15 ]

I have had the same problem. This bug can be fixed by using the double-checked locking pattern.
It looks like:
org.apache.catalina.ApplicationContext

public class ApplicationContext implements ServletContext {
....
private volatile Object lockObject = new Object();
....
private void mergeParameters()
{
if (!this.parametersMerged) {
synchronized (this.lockObject) {
if (!this.parametersMerged) {
for (String name : this.context.findParameters())

{ this.parameters.put(name, this.context.findParameter(name)); }

List<ApplicationParameter> params = this.context.findApplicationParameters();
Iterator<ApplicationParameter> i = params.iterator();
while (i.hasNext())
{
ApplicationParameter param = (ApplicationParameter)i.next();
if (param.getOverride())
{
if (this.parameters.get(param.getName()) == null)

{ this.parameters.put(param.getName(), param.getValue()); }

}
else

{ this.parameters.put(param.getName(), param.getValue()); }

}
this.parametersMerged = true;
}
}
}
}

Could you please check this approach and give me feedback that everything is okay?
I have tested it and now I don't have this problem, but I want to be sure that it is correct.

Comment by Yury_Morozov [ 02/Mar/15 ]

The bug hasn't been fixed in any version, the method mergeParameters is still synchronized and blocks all threads.
Solution above fixes the problem. Please, include this in your next release.

Comment by Shing Wai Chan [ 03/Apr/15 ]

Tomcat 7 has a different fix on this issue by moving the merging parameters logic into the beginning of the life cycle.
Sending org/apache/catalina/core/ApplicationContext.java
Sending org/apache/catalina/core/StandardContext.java
Transmitting file data ..
Committed revision 63827.





[GLASSFISH-20933] When the session is newly made by asynchronization Servlet, the time-outis not done while locked Created: 18/Dec/13  Updated: 20/Dec/16  Resolved: 24/Jun/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: 4.1_dev

Type: Bug Priority: Major
Reporter: xianwu Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS
Windows 7 Enterprise (Service Pack 1)

JDK
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21) Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

GlassFish build: glassfish-4.0.1-b02-07_22_2013



 Description   

We have a web application atest2.war, which contains two servlets: "simple" and "test".
"simple" is a non-async servlet and "test" is an async servlet.
The session time out was set to 1 minute in web.xml

When accessing non-async servlet "/simple", a session was created, then destroyed when time out was reached

However, when accessing async servlet "/test", a session was created but not destroyed time out was reached.

Reproducible operational steps:

1) deploy atest2.war
asadmin deploy c:\tmp\atest2.war
Application deployed with name atest2.
Command deploy executed successfully.

2) access non-async servlet
http://localhost:8080/atest2/simple

The lifecycle of the session can be confirmed in the server.log. The session (2d5e8779e02499f08d42ea52cd0a)was created then destroyed when time out was reached.

[2013-12-18T10:13:29.719+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=106 _ThreadName=Thread-7] [timeMillis: 1387322009719] [levelValue: 800] [[
SessionCreated: 2d5e8779e02499f08d42ea52cd0a]]

[2013-12-18T10:14:52.990+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=147 _ThreadName=Thread-7] [timeMillis: 1387322092990] [levelValue: 800] [[
SessionDestroyed: 2d5e8779e02499f08d42ea52cd0a]]

3) access async servlet
http://localhost:8080/atest2/test

The lifecycle of the session can be confirmed in the server.log. The session (2f028ea7bf9fc3aa8c6680ed196e)was created but it was not destroyed when time out (about 1 minute) was reached.

[2013-12-18T10:42:10.154+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=180 _ThreadName=Thread-7] [timeMillis: 1387323730154] [levelValue: 800] [[
SessionCreated: 2f028ea7bf9fc3aa8c6680ed196e]]

[2013-12-18T10:42:10.154+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=180 _ThreadName=Thread-7] [timeMillis: 1387323730154] [levelValue: 800] [[
AsyncHandler#onComplete]]

4) stop domain to stop the process of async servlet
asadmin stop-domain domain1
Waiting for the domain to stop .
Command stop-domain executed successfully.

When the server was shutdown, then, the session of async servlet (2f028ea7bf9fc3aa8c6680ed196e) was destroyed.

[2013-12-18T10:47:25.246+1100] [glassfish 4.0] [INFO] [NCLS-CORE-00092] [javax.enterprise.system.core] [tid: _ThreadID=182 _ThreadName=Thread-35] [timeMillis: 1387324045246] [levelValue: 800] [[
Server shutdown initiated]]

[2013-12-18T10:47:25.246+1100] [glassfish 4.0] [INFO] [NCLS-BOOTSTRAP-00028] [javax.enterprise.bootstrap] [tid: _ThreadID=182 _ThreadName=Thread-35] [timeMillis: 1387324045246] [levelValue: 800] [[
Unregistered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@658f8f43 from service registry.]]

[2013-12-18T10:47:25.246+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=182 _ThreadName=Thread-7] [timeMillis: 1387324045246] [levelValue: 800] [[
FileMonitoring shutdown]]

[2013-12-18T10:47:25.246+1100] [glassfish 4.0] [INFO] [NCLS-JMX-00002] [javax.enterprise.system.jmx] [tid: _ThreadID=182 _ThreadName=Thread-35] [timeMillis: 1387324045246] [levelValue: 800] [[
JMXStartupService: Stopped JMXConnectorServer: null]]

[2013-12-18T10:47:25.246+1100] [glassfish 4.0] [INFO] [NCLS-JMX-00001] [javax.enterprise.system.jmx] [tid: _ThreadID=182 _ThreadName=Thread-35] [timeMillis: 1387324045246] [levelValue: 800] [[
JMXStartupService and JMXConnectors have been shut down.]]

[2013-12-18T10:47:25.277+1100] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=186 _ThreadName=Thread-7] [timeMillis: 1387324045277] [levelValue: 800] [[
SessionDestroyed: 2f028ea7bf9fc3aa8c6680ed196e]]



 Comments   
Comment by xianwu [ 18/Dec/13 ]

I have uploaded the sample application atest.war at

https://www.dropbox.com/s/x5tbo5yqca9whrg/atest2.war

Comment by Shing Wai Chan [ 24/Jun/14 ]

Sending src/main/java/org/apache/catalina/connector/CoyoteAdapter.java
Transmitting file data .
Committed revision 63382.





[GLASSFISH-21032] NPE if alternatedocroot_1 has from=/* Created: 07/Apr/14  Updated: 20/Dec/16  Resolved: 28/May/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1
Fix Version/s: 4.1_dev

Type: Bug Priority: Major
Reporter: m.zdila Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

glassfish-4.0.1-b04-04_05_2014-ml
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.5) (7u51-2.4.5-2)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)


Tags: 4_0_1-review

 Description   

glassfish-4.0.1-b04-04_05_2014-ml

In glassfish-web.xml I have following element:
<property name="alternatedocroot_1" value="from=/* dir=/home/martin/teris-client"/>

On deploy Glassfish throws exception:

2014-04-07T16:32:31.149+0200|SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: start:
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)
at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2286)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1932)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:215)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:291)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:209)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:137)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:115)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:550)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.catalina.LifecycleException: start:
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:770)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5864)
... 49 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at org.apache.naming.resources.WebDirContext.getAbsoluteJarResourceName(WebDirContext.java:416)
at org.apache.naming.resources.WebDirContext.lookupAllFromJars(WebDirContext.java:349)
at org.apache.naming.resources.WebDirContext.list(WebDirContext.java:214)
at org.apache.catalina.loader.WebappLoader.copyDir(WebappLoader.java:1321)
at org.apache.catalina.loader.WebappLoader.setRepositories(WebappLoader.java:1116)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:759)
... 50 more

In Glassfish 4.0 it works.



 Comments   
Comment by Shing Wai Chan [ 17/May/14 ]

Local testing seems ok. Can you attach a test case for this?

Comment by Shing Wai Chan [ 27/May/14 ]

According to stack trace, an empty String is passed to WebDirContext.getAbsoluteJarResourceName.
The code need to be fixed in this case.

Comment by Shing Wai Chan [ 28/May/14 ]

Sending src/main/java/org/apache/naming/resources/WebDirContext.java
Transmitting file data .
Committed revision 63309.





[GLASSFISH-21052] NPE occurs in AuthenticatorBase.register with log level Fine. Created: 28/Apr/14  Updated: 20/Dec/16  Resolved: 13/May/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0, 4.1
Fix Version/s: 4.1_dev

Type: Bug Priority: Minor
Reporter: nkobayashi Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All


Tags: 4_0_1-review

 Description   

This is NPE
java.lang.NullPointerException
at org.apache.catalina.authenticator.AuthenticatorBase.register(AuthenticatorBase.java:861)
at org.apache.catalina.authenticator.AuthenticatorBase.logout(AuthenticatorBase.java:973)
at com.sun.web.security.RealmAdapter.doLogout(RealmAdapter.java:503)
at com.sun.web.security.RealmAdapter.logout(RealmAdapter.java:485)
at org.apache.catalina.connector.Request.logout(Request.java:2262)
at org.apache.catalina.connector.RequestFacade.logout(RequestFacade.java:1121)

org.apache.catalina.authenticator.AuthenticatorBase#register

protected void register(HttpRequest request, HttpResponse response,
        Principal principal, String authType,
        String username, char[] password) {

    if (log.isLoggable(Level.FINE)) {
        String msg = "Authenticated '" + principal.getName() + "' with type '"
                     + authType + "'";
        log.log(Level.FINE, msg);
    }

principal is null. because
org.apache.catalina.authenticator.AuthenticatorBase#logout

        // principal and authType set to null in the following
        register(request, (HttpResponse)request.getResponse(), null,
                null, null, null);


 Comments   
Comment by Shing Wai Chan [ 13/May/14 ]

Sending src/main/java/org/apache/catalina/authenticator/AuthenticatorBase.java
Transmitting file data .
Committed revision 63267.





[GLASSFISH-21146] GlassFishSingleSignOn logging does not log values and throws NPE Created: 28/Jul/14  Updated: 20/Dec/16  Resolved: 06/Nov/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.1_dev
Fix Version/s: None

Type: Bug Priority: Major
Reporter: dmatej Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 1 hour
Time Spent: Not Specified
Original Estimate: 1 hour

Attachments: Zip Archive GLASSFISH-21166.zip    
Tags: cluster, logging, sso

 Description   

1) All GlassFishSingleSignOn logs look like this:
Found cached principal

{0}

with auth type

{1}

in realm

{2}
  • that makes them unusable.

2) Also getPrincipal().getName() causes NPE, because sometimes the principal is null (don't know why at this time, it occurs on cluster instances with SSO, many webapp modules with the same realm and one web application module without any realm - I will create another issue if I will get it).

You can remove getName() method call, because the getPrincipal() should write the same and in fact, in the message you already write that the value is principal.
Old:
logger.log(Level.FINE, FOUND_CACHED_PRINCIPAL, new Object[]

{entry.getPrincipal().getName(), entry.getAuthType(), entry.getRealmName()}

);
Better:
logger.log(Level.FINE, FOUND_CACHED_PRINCIPAL, new Object[]

{entry.getPrincipal(), entry.getAuthType(), entry.getRealmName()}

);

3) And finally, I think the first log in invoke should not be PRINCIPAL_ALREADY_AUTHENTICATED but REQUEST_PROCESSED - only swap these two constants. Now it logs nosense



 Comments   
Comment by dmatej [ 28/Jul/14 ]

Environment:
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Comment by Shing Wai Chan [ 28/Jul/14 ]

There are other logs in GlassFishSingleSignOn other than (1).
For (2), there is a different issue here as we should not have a null principal for SSO. We may like to understand why there is a null principal there. Any test cases? Note that principal.toString() and principal.getName() may be different in some implementations.
(3) is a regression from v3 to v4.

Comment by Shing Wai Chan [ 28/Jul/14 ]

a fix for (3):
Sending src/main/java/com/sun/enterprise/security/web/GlassFishSingleSignOn.java
Transmitting file data .
Committed revision 63544.

Comment by dmatej [ 30/Jul/14 ]

(1) Many of these logs does not contain values, only those curly braces, but some does. It is not the only place where this issue exists, but I could not find why:

....
[2014-07-30T15:39:12.396+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00031] [javax.enterprise.web] [tid: _ThreadID=58 _ThreadName=http-listener-1(1)] [timeMillis: 1406727552396] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: invoke] [[
  Process request for {0}]]
[2014-07-30T15:39:12.396+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00033] [javax.enterprise.web] [tid: _ThreadID=58 _ThreadName=http-listener-1(1)] [timeMillis: 1406727552396] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: invoke] [[
  Checking for SSO cookie]]
[2014-07-30T15:39:12.397+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00037] [javax.enterprise.web] [tid: _ThreadID=58 _ThreadName=http-listener-1(1)] [timeMillis: 1406727552397] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: invoke] [[
  Checking for cached principal for {0}]]
[2014-07-30T15:39:12.398+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00038] [javax.enterprise.web] [tid: _ThreadID=58 _ThreadName=http-listener-1(1)] [timeMillis: 1406727552398] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: invoke] [[
  Found cached principal {0} with auth type {1} in realm {2}]]
....
[2014-07-30T15:42:32.487+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00042] [javax.enterprise.web] [tid: _ThreadID=96 _ThreadName=SingleSignOnExpiration] [timeMillis: 1406727752487] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: processExpires] [[
  SSO expiration started. Current entries: 1]]
[2014-07-30T15:42:32.487+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00043] [javax.enterprise.web] [tid: _ThreadID=96 _ThreadName=SingleSignOnExpiration] [timeMillis: 1406727752487] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: processExpires] [[
  SSO cache will expire 0 entries]]
[2014-07-30T15:42:32.533+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00042] [javax.enterprise.web] [tid: _ThreadID=97 _ThreadName=SingleSignOnExpiration] [timeMillis: 1406727752533] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: processExpires] [[
  SSO expiration started. Current entries: 0]]
[2014-07-30T15:42:32.533+0200] [glassfish 4.0] [FINE] [AS-WEB-GLUE-00043] [javax.enterprise.web] [tid: _ThreadID=97 _ThreadName=SingleSignOnExpiration] [timeMillis: 1406727752533] [levelValue: 500] [CLASSNAME: com.sun.enterprise.security.web.GlassFishSingleSignOn] [METHODNAME: processExpires] [[
  SSO cache will expire 0 entries]]

(2) Yes, and I fixed it (I will create another issue and attach a patch), but the code should be more robust.
The log message says it is a principal, not principal's name. And - it can be null, even if it is caused by some bug. Logging must not crash funcionality, it should be passive as it is possible. Note that Principal implementation must implement toString(), so it should be alright.
(3) Thank you and thank you for really fast response
(4) One of parameters is userName, I'm not sure about difference between principal's name and userName - the class should be also better documented.

Comment by dmatej [ 30/Jul/14 ]

Relates to GLASSFISH-21148 - that issue caused (2)

Comment by dmatej [ 20/Aug/14 ]

GLASSFISH-21148 is one of causes, but not only one - on standalone instance even with the fixed web-ha library I got NPE again.
(2) Exception in server.log after setting log level to FINE - can be resolved simply by applying my patch (Principal should implement toString(), so it is much better than calling getName() which sometimes throws NPE and complicates searching for another bugs!):

[2014-08-20T18:43:28.249+0200] [glassfish 4.1] [SEVERE] [AS-WEB-CORE-00037] [javax.enterprise.web.core] [tid: _ThreadID=34 _ThreadName=http-listener-1(5)] [timeMillis: 1408553008249] [levelValue: 1000] [[
  An exception or error occurred in the container during the request processing
java.lang.NullPointerException
        at com.sun.enterprise.security.web.GlassFishSingleSignOn.invoke(GlassFishSingleSignOn.java:487)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:702)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:412)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)

I have signed the OCA, but still cannot commit to SVN and it seems there is noone interested in fixing bugs ...
I have to compile and replace several libraries to write a single test for another bug ... those bugs are interacting, some are clear, some are not ... it would be nice to fix those clear at least.
Possibly related bugs - NPE in one stops/skips processing in another or it causes the NPEs ...:
GLASSFISH-21166
GLASSFISH-21147
GLASSFISH-21146
GLASSFISH-21148

Comment by reza_rahman [ 22/Aug/14 ]

Reproducible test case from David attached.

Comment by reza_rahman [ 22/Aug/14 ]

Please provide David attach permissions?

Comment by dmatej [ 25/Aug/14 ]

Hi Reza, the test was for GLASSFISH-21166, not GLASSFISH-21146, I am sorry, it was my typo in e-mail subject

This issue state:
3) is fixed
2) still not fixed; this issue is only about logging, the reason why the principal is null should be resolved in some issue from the list I mentioned before.
1) This is something bigger, in some modules of Glassfish logging does not work as expected and values are missing. Logging may need some attention and maybe better conventions (select one of already used). It will need some work.

Comment by dmatej [ 14/Oct/14 ]

Patch for NPE. Please, can you apply it to SVN?

commit 2c94c5fa5f887a0531e42f313459f0bc152bcee5
Author: David Matejcek <david.matejcek@i.cz>
Date:   Tue Oct 14 12:10:50 2014 +0200

    GLASSFISH-21146 Fixed NPE in log
    
    - avoid toString call (implicit)
    - debug replaced with logging level FINE

diff --git a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
index 2c3cb81..15e3352 100644
--- a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
+++ b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
@@ -73,11 +73,11 @@ public class HASingleSignOn extends GlassFishSingleSignOn {
     @Override
     protected void deregister(String ssoId) {
 
-        //S1AS8 6155481 START        
+        //S1AS8 6155481 START
         if (logger.isLoggable(Level.FINE)) {
             logger.fine("Deregistering sso id '" + ssoId + "'");
         }
-        //S1AS8 6155481 END 
+        //S1AS8 6155481 END
         // Look up and remove the corresponding SingleSignOnEntry
         SingleSignOnEntry sso = null;
         synchronized (cache) {
@@ -104,9 +104,10 @@ public class HASingleSignOn extends GlassFishSingleSignOn {
     protected void register(String ssoId, Principal principal, String authType,
                   String username, char[] password, String realmName) {
 
-        if (debug >= 1)
-            log("Registering sso id '" + ssoId + "' for user '" +
-                principal.getName() + "' with auth type '" + authType + "'");
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("Registering sso id '" + ssoId+ "' for principal '" + principal + "' and username '" + username
+                    + "' with auth type '" + authType + "' and realmName '" + realmName + "'");
+        }
 
         HASingleSignOnEntry ssoEntry = null;
         synchronized (cache) {
@@ -178,8 +179,7 @@ public class HASingleSignOn extends GlassFishSingleSignOn {
     protected void removeSession(String ssoId, Session session) {
 
         if (logger.isLoggable(Level.FINE)) {
-            logger.fine("Removing session " + session.toString() 
-                        + " from sso id " + ssoId );
+            logger.fine("Removing session " + session + " from sso id " + ssoId );
         }
 
         // Get a reference to the SingleSignOn

Issue can be marked as FIXED.

Comment by dmatej [ 06/Nov/14 ]

Patches applied in Payara: https://github.com/payara/Payara/commit/c6eee9b76dccbd48d2332ff68c6cc4b8a873c3f8

Comment by Shing Wai Chan [ 06/Nov/14 ]

Sending src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
Transmitting file data .
Committed revision 63710.





[GLASSFISH-21148] User is logged out on SSO cluster Created: 30/Jul/14  Updated: 20/Dec/16  Resolved: 07/Nov/14

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0, 4.1_dev
Fix Version/s: None

Type: Bug Priority: Critical
Reporter: dmatej Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 1 hour
Time Spent: Not Specified
Original Estimate: 1 hour

Tags: cluster, sso

 Description   

Application:
EAR with many WAR and some EJB modules, sharing same custom realm.
Domain:
Cluster with two instances, both with the EAR enabled.
HA can be disabled or enabled, it has no effect on the issue.

Scenario:
1) User logs in on the instance1
2) User works on instance1 without problems
3) User switches to instance2
4) User works on instance2 without problems
5) User switches to instance1 - and sometimes is logged out.

I have found the source of the problem, I will attach a patch(es) today.



 Comments   
Comment by dmatej [ 30/Jul/14 ]

This is current patch fixing the bug. The problem was that the entry metadata instance is created with null in constructor parameter as principal, which is set later - but bytes are not updated and the null bytes is later synced to another instances. That causes the user is logged out and also nullpointers on another instances if you enable lower levels of logging.
I can provide even better refactored patch, because this is what could be called a little "constructor hell".

EDIT: patch removed

Comment by dmatej [ 30/Jul/14 ]

This is still not perfect, but I think this patch would be better instead of previous. Bugfix is the same, but it has less code in constructors and I think it is more readable ...
EDIT: patch removed

Comment by dmatej [ 30/Jul/14 ]

This issue caused also NPE reported in GLASSFISH-21146

Comment by dmatej [ 14/Oct/14 ]

Because there is no development from your side, I created a GitHub repository and I patch Glassfish there, since creating patches in JIRA is a bit problematic.
https://github.com/dmatej/Glassfish. This issue is fixed in two commits together with a little refactoring in this class.
Commit 1:

commit 245b7346b06783c352cda3348396f6f8eb040018
Author: David Matejcek <david.matejcek@i.cz>
Date:   Mon Sep 29 15:53:21 2014 +0200

    GLASSFISH-21148 Fixed parsing principal from metadata
    
    - prinicpal was parsed, but metadata were not updated

diff --git a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
index b9909b1..56e6f58 100644
--- a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
+++ b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
@@ -41,20 +41,25 @@
 package org.glassfish.web.ha.authenticator;
 
 import com.sun.enterprise.container.common.spi.util.JavaEEIOUtils;
+
 import org.apache.catalina.Container;
 import org.apache.catalina.core.StandardContext;
-
 import org.apache.catalina.Session;
 import org.apache.catalina.authenticator.SingleSignOn;
 import org.apache.catalina.authenticator.SingleSignOnEntry;
+import org.glassfish.web.ha.session.management.HAStoreBase;
 
 import java.io.*;
 import java.security.Principal;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * @author Shing Wai Chan
  */
 public class HASingleSignOnEntry extends SingleSignOnEntry {
+    private static final Logger logger = HAStoreBase._logger;
+
     protected long maxIdleTime;
 
     protected JavaEEIOUtils ioUtils;
@@ -73,36 +78,9 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
                 m.getLastAccessTime(), m.getMaxIdleTime(), m.getVersion(),
                 ioUtils);
 
-        ByteArrayInputStream bais = null;
-        BufferedInputStream bis = null;
-        ObjectInputStream ois = null;
-        try {
-            bais = new ByteArrayInputStream(m.getPrincipalBytes());
-            bis = new BufferedInputStream(bais);
-            ois = ioUtils.createObjectInputStream(bis, true, this.getClass().getClassLoader());
-            this.principal = (Principal)ois.readObject();
-        } catch(Exception ex) {
-            throw new IllegalStateException(ex);
-        } finally {
-            if (bais != null) {
-                try {
-                    bais.close();
-                } catch(IOException ex) {
-                }
-            }
-            if (bis != null) {
-                try {
-                    bis.close();
-                } catch(IOException ex) {
-                }
-            }
-            if (ois != null) {
-                try {
-                    ois.close();
-                } catch(IOException ex) {
-                }
-            }
-        }
+        // GLASSFISH-21148: constructor called with null - don't forget to update metadata!
+        this.principal = parsePrincipal(m);
+        this.metadata.principalBytes = m.getPrincipalBytes() == null ? null : m.getPrincipalBytes().clone();
 
         for (HASessionData data: m.getHASessionDataSet()) {
             StandardContext context = (StandardContext)container.findChild(data.getContextPath());
@@ -112,24 +90,29 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
             } catch(IOException ex) {
                 throw new IllegalStateException(ex);
             }
-            sessions.add(session);
+            if (session != null) {
+              sessions.add(session);
+            }
         }
+        logger.log(Level.FINER, "Loaded HA SSO entry from metadata. Principal: {}", this.principal);
     }
 
+    // TODO: javadoc: difference between principal.getName and userName?
     public HASingleSignOnEntry(String id, Principal principal, String authType,
             String username, String realmName,
             long lastAccessTime, long maxIdleTime, long version,
             JavaEEIOUtils ioUtils) {
-        
+
         super(id, version, principal, authType, username, realmName);
         this.lastAccessTime = lastAccessTime;
         this.maxIdleTime = maxIdleTime;
         this.ioUtils = ioUtils;
 
-        metadata = new HASingleSignOnEntryMetadata(
+        this.metadata = new HASingleSignOnEntryMetadata(
                 id, version, convertToByteArray(principal), authType,
                 username, realmName,
                 lastAccessTime, maxIdleTime);
+        logger.log(Level.FINER, "Created HA SSO entry. Principal: {}", this.principal);
     }
 
     public HASingleSignOnEntryMetadata getMetadata() {
@@ -171,39 +154,53 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
         return ver;
     }
 
-    // convert a Serializable object into byte array
-    private byte[] convertToByteArray(Object obj) {
-        ByteArrayOutputStream baos = null;
+    /** convert a principal into byte array */
+    private byte[] convertToByteArray(Principal obj) {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BufferedOutputStream bos = null;
         ObjectOutputStream oos = null;
         try {
-            baos = new ByteArrayOutputStream();
             bos = new BufferedOutputStream(baos);
             oos = ioUtils.createObjectOutputStream(bos, true);
             oos.writeObject(obj);
+            oos.flush();
+            return baos.toByteArray();
         } catch(Exception ex) {
             throw new IllegalStateException(ex);
         } finally {
-            if (baos != null) {
-                try {
-                    baos.close();
-                } catch(Exception ex) {
-                }
-            }
-            if (bos != null) {
-                try {
-                    bos.close();
-                } catch(Exception ex) {
-                }
-            }
-            if (oos != null) {
-                try {
-                    oos.close();
-                } catch(Exception ex) {
-                }
-            }
+          closeSilently(baos);
+          closeSilently(bos);
+          closeSilently(oos);
         }
+    }
+
+    /** Parse a principal from metadata */
+    private Principal parsePrincipal(HASingleSignOnEntryMetadata m) {
+      ByteArrayInputStream bais = null;
+      BufferedInputStream bis = null;
+      ObjectInputStream ois = null;
+      try {
+          bais = new ByteArrayInputStream(m.getPrincipalBytes());
+          bis = new BufferedInputStream(bais);
+          ois = ioUtils.createObjectInputStream(bis, true, this.getClass().getClassLoader());
+          return (Principal) ois.readObject();
+      } catch (Exception ex) {
+          throw new IllegalStateException(ex);
+      } finally {
+        closeSilently(bais);
+        closeSilently(bis);
+        closeSilently(ois);
+      }
+    }
 
-        return baos.toByteArray();
+    private void closeSilently(Closeable closeable) {
+      if (closeable == null) {
+        return;
+      }
+      try {
+        closeable.close();
+      } catch(Exception ex) {
+        // nothing
+      }
     }
 }

Commit 2:

commit ec5f162a648ad3e3be94028567127aeefd741a45
Author: David Matejcek <david.matejcek@i.cz>
Date:   Mon Sep 29 16:06:46 2014 +0200

    GLASSFISH-21148 More descriptive exception messages

diff --git a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
index 56e6f58..c9a7025 100644
--- a/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
+++ b/main/appserver/web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
@@ -88,7 +88,7 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
             try {
                 session = context.getManager().findSession(data.getSessionId());
             } catch(IOException ex) {
-                throw new IllegalStateException(ex);
+                throw new IllegalStateException("Cannot find the session: " + data.getSessionId(), ex);
             }
             if (session != null) {
               sessions.add(session);
@@ -166,7 +166,7 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
             oos.flush();
             return baos.toByteArray();
         } catch(Exception ex) {
-            throw new IllegalStateException(ex);
+            throw new IllegalStateException("Could not convert principal to byte array", ex);
         } finally {
           closeSilently(baos);
           closeSilently(bos);
@@ -185,7 +185,7 @@ public class HASingleSignOnEntry extends SingleSignOnEntry {
           ois = ioUtils.createObjectInputStream(bis, true, this.getClass().getClassLoader());
           return (Principal) ois.readObject();
       } catch (Exception ex) {
-          throw new IllegalStateException(ex);
+          throw new IllegalStateException("Could not parse principal from HA-SSO Metadata", ex);
       } finally {
         closeSilently(bais);
         closeSilently(bis);

I have finally configured the Apache loadbalancer and there are no problems with this any more (except bad Apache configuration).
Could you apply those two patches to your SVN, please?

Comment by dmatej [ 06/Nov/14 ]

Patches applied in Payara: https://github.com/payara/Payara/commit/3ff228aab2b78bbda4b9eea8ee3c6c68df39e291

Comment by Shing Wai Chan [ 07/Nov/14 ]

A slightly different fix is checkin as follows:

Sending src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
Sending src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
Transmitting file data ..
Committed revision 63712.





[GLASSFISH-19675] The weld servlet listener must be the first one intialized and the last one destroyed Created: 14/Feb/13  Updated: 20/Dec/16  Resolved: 14/Feb/13

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jjsnyder83 Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In order for CDI to work properly the org.jboss.weld.servlet.WeldListener must be the first listener initialized and the last one destroyed.



 Comments   
Comment by jjsnyder83 [ 14/Feb/13 ]

Fixed Committed revision 59505
The Weld Listener is the first listener in the list of listeners.





[GLASSFISH-19219] @WebServlet values are lost when the servlet is defined in deployment descriptor, under a different name Created: 23/Oct/12  Updated: 20/Dec/16  Resolved: 24/Oct/12

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: djiao Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When the same servlet class is declared in two places under @WebServlet and Deployment descriptor using different servlet name, they should be treated as different servlet. Right now, @WebServlet defined values are lost.



 Comments   
Comment by Shing Wai Chan [ 24/Oct/12 ]

Sending src/main/java/org/glassfish/web/deployment/annotation/handlers/WebServletHandler.java
Transmitting file data .
Committed revision 56712.





[GLASSFISH-18478] Incorrect type of Exception thrown: expecting IllegalStateException, got IllegalStateException wrapped in IllegalArgumentException instead Created: 07/Mar/12  Updated: 20/Dec/16  Due: 06/Apr/12  Resolved: 07/Mar/12

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: djiao Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

API ServletContext.addListener(Listener_to_be_Added) should throw IllegalStateException if called after ServletContext initialized. Right now it throws IllegalStateException wrapped in IllegalArgumentException instead.



 Comments   
Comment by Shing Wai Chan [ 07/Mar/12 ]

Sending web-core/src/main/java/org/apache/catalina/core/StandardContext.java
Transmitting file data .
Committed revision 52812.





[GLASSFISH-16377] Add HA SSO version cookie Created: 18/Apr/11  Updated: 20/Dec/16  Resolved: 18/Apr/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 4.0_dev

Type: New Feature Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In 3.1, HA SSO cookie does not have version.

HA SSO cookie version is a first step to support the round robin load balancer and other network latency issue for a given instance with a load balancer.



 Comments   
Comment by Shing Wai Chan [ 18/Apr/11 ]

Sending web/web-core/src/main/java/org/apache/catalina/Session.java
Sending web/web-core/src/main/java/org/apache/catalina/authenticator/AuthenticatorBase.java
Sending web/web-core/src/main/java/org/apache/catalina/authenticator/Constants.java
Sending web/web-core/src/main/java/org/apache/catalina/authenticator/FormAuthenticator.java
Sending web/web-core/src/main/java/org/apache/catalina/authenticator/SingleSignOn.java
Sending web/web-core/src/main/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
Sending web/web-core/src/main/java/org/apache/catalina/connector/OutputBuffer.java
Sending web/web-core/src/main/java/org/apache/catalina/connector/Request.java
Sending web/web-core/src/main/java/org/apache/catalina/session/StandardSession.java
Sending web/web-glue/src/main/java/com/sun/enterprise/security/web/GlassFishSingleSignOn.java
Sending web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOn.java
Sending web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntry.java
Sending web/web-ha/src/main/java/org/glassfish/web/ha/authenticator/HASingleSignOnEntryMetadata.java
Transmitting file data .............
Committed revision 46210.





[GLASSFISH-16578] "The log message is null." message logged when auto-deploying app Created: 06/May/11  Updated: 20/Dec/16  Resolved: 09/May/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1.1, 4.0_dev
Fix Version/s: 3.1.2_dev, 4.0_dev

Type: Bug Priority: Major
Reporter: Dies Koper Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

WinXP, GFv3.2_b05


Attachments: File BASIC_TEST.war    

 Description   

I noticed the following error in server.log:

[#|2011-05-07T13:36:35.882+1000|SEVERE|glassfish3.2|javax.enterprise.system.container.web.com.sun.enterprise.glassfish.web|_ThreadID=26;_ThreadName=Thread-1;|The log message is null.|#]

[#|2011-05-07T13:36:35.929+1000|SEVERE|glassfish3.2|javax.enterprise.system.container.web.com.sun.enterprise.glassfish.web|_ThreadID=26;_ThreadName=Thread-1;|The log message is null.|#]

[#|2011-05-07T13:36:36.007+1000|SEVERE|glassfish3.2|javax.enterprise.system.container.web.com.sun.enterprise.glassfish.web|_ThreadID=26;_ThreadName=Thread-1;|The log message is null.|#]

What went wrong??

This is what I did:
1. Fresh install of GFv3.2_b05 on WinXP.
2. Started domain.
3. In the admin console, changed server's VM option:
-Djavax.net.ssl.keyStore=$

{com.sun.aas.instanceRoot}/config/keystore.jks to
-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}

/config/keystore_.jks (file doesn't exist)
4. Copied war file to auto-deploy dir.



 Comments   
Comment by Dies Koper [ 06/May/11 ]

Probably this is caused by a statement in the GF container as follows:

} catch (SomeException e) {
logger.log(Level.SEVERE, e.getMessage());

If e.getMessage() returns null (which is not uncommon for runtime exceptions either!), the logger complains.

To fix it:

logger.log(Level.SEVERE, "msg.key.in.prop.file", (e.getMessage() == null) ? "" : e.getMessage() );

with msg.key.in.prop.file defined in the right LogStrings.properties, starting with a message ID and including

{0}

somewhere for the (optional) exception message.

Comment by Shing Wai Chan [ 09/May/11 ]

The error message is triggered by incorrect root element of glassfish-web.xml.
The xml element should be [glassfish-web-app] rather than [sun-web-app].

I have updated the corresponding message.

Sending src/main/java/com/sun/enterprise/glassfish/web/WarHandler.java
Sending src/main/resources/com/sun/logging/enterprise/system/container/web/LogStrings.properties
Transmitting file data ..
Committed revision 46748.





[GLASSFISH-16533] MessageID is missing in log messages Created: 03/May/11  Updated: 20/Dec/16  Resolved: 03/May/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1_dev
Fix Version/s: 3.1.2_dev, 4.0_dev

Type: Bug Priority: Major
Reporter: naman_mehta Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Message Id is missing. Message is directly used in the code.

http://wikis.sun.com/display/glassfish/GlassFishV3LoggingMessageFormat

web/web-core/src/main/java/org/apache/catalina/startup/HostConfig.java
log.log(Level.WARNING,
"Erorr stopping context " + context.getName(),
ex);



 Comments   
Comment by Shing Wai Chan [ 03/May/11 ]

Sending src/main/java/org/apache/catalina/startup/HostConfig.java
Sending src/main/resources/org/apache/catalina/startup/LocalStrings.properties
Transmitting file data ..
Committed revision 46622.





[GLASSFISH-16920] Embedded WebContainer return no Contexts on call to VirtualServer.getContexts() Created: 27/Jun/11  Updated: 20/Dec/16  Resolved: 01/Jul/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: 3.1.1_dev

Type: Bug Priority: Major
Reporter: Aslak Knutsen Assignee: Amy Roh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Source File ContextIssueTestCase.java    

 Description   

Steps to reproduce

  1. Deploy a War with a Servlet
    " Lookup WebContainer in GlassFish Runtime
  2. Get the VirtualServers
  3. Get the Contexts

VirtualServer.getContexts return 0, but casting to com.sun...VirtualServer and using findChildren returns a Container/WebModule with the Servlet registered.



 Comments   
Comment by Bhavanishankar [ 28/Jun/11 ]

re-categorized.

Comment by Amy Roh [ 01/Jul/11 ]

Fixed in 47758 & 47765.





[GLASSFISH-16622] Root applications (context root "/") listen on all virtual servers until server is restarted. Created: 12/May/11  Updated: 20/Dec/16  Resolved: 14/Oct/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1_dev
Fix Version/s: 4.0_dev

Type: Bug Priority: Major
Reporter: ckuehl Assignee: Amy Roh
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian inside VServer


Attachments: XML File domain.xml     Text File server.log    
Tags: 3_1-next, context_root, deployment, virtual_server

 Description   

When I deploy a web application with the context root of "/" via the web administrative panel to a virtual server listening on domain "example.com", the application will act as if deployed to every virtual server, including the admin panel. Restarting the server (via asadmin) fixes the problem (after a restart, it only listens on example.com). This happens on initial deployment of an application and upon redeployment of an application.

When redeploying an application, I am selecting the file and clicking OK. I am not changing any options from their default options. After redeploying, the admin panel will cease the function and will instead show errors (such as resource not found) and act as if I am accessing that resource.



 Comments   
Comment by Hong Zhang [ 13/May/11 ]

I tried with both admin cli and console (specifying the virtual server as part of the deployment), and the domain.xml application-ref enetry has the specified virtual server as expected.
Assign to web team to check if the application is also only loaded on the specified virtual server as expected and follow up with the user.

Comment by ckuehl [ 15/May/11 ]

Thanks for looking into this. I did some further testing and it appears to only happen when redeploying an existing application via the web panel, not during initial deployment as I initially reported.

Comment by Amy Roh [ 17/May/11 ]

Hi ckuehl,

To clarify, you're saying if you redeploy an existing application with the context root of "/" using the admin gui, the application will act as if it deployed to every virtual server including the admin webapp and the admin gui will cease to function until restart, correct?

Does this also happen when you redeploy using admin cli and not the admin gui?

Can you please include your domain.xml and server.log after you redeploy in order for us to understand your exact setup?

Thanks,
Amy

Comment by ckuehl [ 17/May/11 ]

Hi,

Yes, your summary is correct.

I have just tested and it also happens when redeploying via the CLI:

asadmin> redeploy --name GraalCenterAccounts /home/appman/GraalCenterAccounts.war
Enter admin user name> admin
Enter admin password for user "admin">
Application deployed with name GraalCenterAccounts.
Command redeploy executed successfully.

I will attach my domain.xml and server.log.

Thanks again for looking into this.

Comment by ckuehl [ 23/May/11 ]

I'd like to clarify again:

When redeploying, it does not act as if deployed to all virtual servers. Instead, all applications, including the administrative GUI, act as if undeployed. I see the "Your server is now running" page when trying to access other applications.

This is also happening occasionally when using the asadmin cli.

Comment by Amy Roh [ 26/May/11 ]

I tried your scenario on mac and everything works as expected. I'm trying to understand how and if our configurations are different.

I see "User [] from host localhost does not have administration access" in your server.log. How are you accessing the admin gui? Can you access it locally?

Comment by ckuehl [ 28/May/11 ]

I tried to setup reliable steps to replicate this bug but was unable to on a different system than the one it occurred on. I have updated to 3.2-b06 and the problem has resolved itself.

Thanks again for the help.

Comment by Amy Roh [ 31/May/11 ]

Issue resolved as the reporter stated. Couldn't reproduce.





[GLASSFISH-16252] Virtual server alternate docroot with a web module with context root / does not work properly after server restart Created: 23/Mar/11  Updated: 20/Dec/16

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: 3_1-next, 3_1_1-scrubbed, 3_1_x-exclude

 Description   

If one specify the alternate docroot in the virtual server and then deploy a web module with context-root /, then it does not work properly after restart.

This is related to
http://forums.java.net/node/783831

Per discussion with Jan, the following should be the expected behavior.
1. set alt docroot in virtual server
2. check that it works
3. deploy a web app with context root /
4. check that the web app works, but the alt docroot should not.

This is the case right now.
But if the server is restarted, then we find that both the web app and alt docroot work.



 Comments   
Comment by rob1213 [ 23/Mar/11 ]

Note that if one restart the server, then it works.??

you means Application server? i have try to restart my Glassfish application server, it seems not work.

Comment by Shing Wai Chan [ 25/Mar/11 ]

I find that if I set three alternate docroot properties, then the first one will work after restart, but not the second and third one. So, there is an issue even for restart. Need further investigations.

Comment by Amy Roh [ 12/Apr/11 ]

Here's what I tried.

bash-3.2$ bin/asadmin start-domain
Command start-domain executed successfully.

bash-3.2$ bin/asadmin set server.http-service.virtual-server.server.property.alternatedocroot_1="from=*.jsp dir=/Users/Amy/tests/hello"
server.http-service.virtual-server.server.property.alternatedocroot_1=from=*.jsp dir=/Users/Amy/tests/hello
Command set executed successfully.

bash-3.2$ bin/asadmin deploy /Users/Amy/tests/hello.war
Application deployed with name hello.
Command deploy executed successfully.

bash-3.2$ ls domains/domain1/applications/hello/
WEB-INF __MACOSX index.html index.jsp

Accessing http://localohst:8080/test.jsp correctly displays from /Users/Amy/tests/hello/test.jsp

bash-3.2$ bin/asadmin deploy --contextroot "/" /Users/Amy/tests/test.war
Application deployed with name test.
Command deploy executed successfully.

Accessing http://localohst:8080/test.jsp correctly displays 404

bash-3.2$ bin/asadmin restart-domain

Accessing http://localohst:8080/test.jsp correctly displays 404

Isn't this what is expected?

If I undeploy the webapp with contextroot "/", http://localhost:8080/test.jsp correctly displays from /Users/Amy/tests/hello/test.jsp again.

Comment by Shing Wai Chan [ 12/Apr/11 ]

asadmin --host localhost --port 4848 --user admin --passwordfile /export/gfv3/src/v2/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true set "server.http-service.virtual-server.server.property.alternatedocroot_1=from=/domain.xml dir=/export/gfv3/src/v3/install/glassfish3/glassfish/domains/domain1/config"

Deploy a war with context root /.

Access http://localhost:8080/domain.xml correctly display 404.

asadmin stop-domain domain1
asadmin start-domain domain1

Access http://localhost:8080/domain.xml return the page incorrectly.

Comment by Amy Roh [ 13/Apr/11 ]

If I use "from=*.xml" instead of "from=/domain.xml" everything works as expected even after restart. The issue appears to be isolated in the exact matching scenario.

Comment by Amy Roh [ 31/May/11 ]

The server is now correctly returning "Not Found" as expected even after restart.

However, instead of normal GlassFish 404 Not Found error page, Grizzly internal error page is returned.

Assigning to Alexey so the error page is customized for GlassFish.

Comment by oleksiys [ 12/May/14 ]

Looks like it works fine now.
The only issue I see now is 500 response returned for "http://host:port/domain.xml", when alternate docroot is pointing to a non-existing folder.

Shing Wai, can you pls. take a look at it?





[GLASSFISH-16768] CSRF Prevention Filter Created: 31/May/11  Updated: 20/Dec/16  Resolved: 31/May/11

Status: Closed
Project: glassfish
Component/s: web_container
Affects Version/s: None
Fix Version/s: 4.0_dev

Type: New Feature Priority: Major
Reporter: Shing Wai Chan Assignee: Shing Wai Chan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: 3_1_1-approved

 Description   

In Tomcat 7, a new filter is added for CSRF prevention.
http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CSRF_Prevention_Filter

One may like to have the same/similar functionality in GlassFish.



 Comments   
Comment by Shing Wai Chan [ 31/May/11 ]

Why fix this issue in 3.1.1?
This is a new security enhancement.

Which is the targeted build of 3.1.1 for this fix?
b07

Do regression tests exist for this issue?
No. I am going to add a new devtest.

Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
None

Comment by Shing Wai Chan [ 31/May/11 ]

Checkin to trunk

Adding web-core/src/main/java/org/apache/catalina/filters
Adding web-core/src/main/java/org/apache/catalina/filters/Constants.java
Adding web-core/src/main/java/org/apache/catalina/filters/CsrfPreventionFilter.java
Adding web-core/src/main/java/org/apache/catalina/filters/FilterBase.java
Adding web-core/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
Adding web-core/src/main/resources/org/apache/catalina/filters
Adding web-core/src/main/resources/org/apache/catalina/filters/LocalStrings.properties
Transmitting file data .....
Committed revision 47219.

Comment by Shing Wai Chan [ 31/May/11 ]

Add test case

Adding csrfFilter
Adding csrfFilter/WebTest.java
Adding csrfFilter/build.properties
Adding csrfFilter/build.xml
Adding csrfFilter/descriptor
Adding csrfFilter/descriptor/web.xml
Adding csrfFilter/docroot
Adding csrfFilter/docroot/index.jsp
Transmitting file data .....
Committed revision 47221.

Comment by scatari [ 31/May/11 ]

Approved for 3.1.1.

Comment by Shing Wai Chan [ 31/May/11 ]

Checkin fix to 3.1.1

Adding src/main/java/org/apache/catalina/filters
Adding src/main/java/org/apache/catalina/filters/Constants.java
Adding src/main/java/org/apache/catalina/filters/CsrfPreventionFilter.java
Adding src/main/java/org/apache/catalina/filters/FilterBase.java
Adding src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
Adding src/main/resources/org/apache/catalina/filters
Adding src/main/resources/org/apache/catalina/filters/LocalStrings.properties
Transmitting file data .....
Committed revision 47226.

Comment by Shing Wai Chan [ 01/Jun/11 ]

change spacing in copyright header and remove unused messages in LocalStrings.properties

trunk:
Sending web-core/src/main/java/org/apache/catalina/filters/Constants.java
Sending web-core/src/main/java/org/apache/catalina/filters/CsrfPreventionFilter.java
Sending web-core/src/main/java/org/apache/catalina/filters/FilterBase.java
Sending web-core/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
Sending web-core/src/main/resources/org/apache/catalina/filters/LocalStrings.properties
Transmitting file data .....
Committed revision 47259.

3.1.1 branch
Sending web-core/src/main/java/org/apache/catalina/filters/Constants.java
Sending web-core/src/main/java/org/apache/catalina/filters/CsrfPreventionFilter.java
Sending web-core/src/main/java/org/apache/catalina/filters/FilterBase.java
Sending web-core/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
Sending web-core/src/main/resources/org/apache/catalina/filters/LocalStrings.properties
Transmitting file data .....
Committed revision 47260.





[GLASSFISH-15535] Webtier embedded API Created: 11/Jan/11  Updated: 20/Dec/16  Due: 18/Jan/11  Resolved: 23/May/11

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1
Fix Version/s: 3.1.2, 4.0_dev, 4.0

Type: Bug Priority: Critical
Reporter: Nazrul Assignee: Amy Roh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

[Tracking bug]

We need to update the embedded APIs for webtier based on AS ARCH discussions.
Please close this bug when you have the updated APIs with Javadocs and the latest APIs has been reviewed by Bill and other AS ARCH members.



 Comments   
Comment by Nazrul [ 19/Jan/11 ]

Excluding from 3.1 count. Please use this issue to do any remaining changes during 3.2. We ran out of time in 3.1

Comment by Amy Roh [ 23/May/11 ]

The APIs have been reviewed and comments were updated in the javadocs.





[GLASSFISH-17915] THE EXECUTION OF THE APP THAT WAS DEPLOYED TO THE NEW VIRTUAL SERVER - FAILED. Created: 07/Dec/11  Updated: 20/Dec/16  Resolved: 04/Jan/12

Status: Resolved
Project: glassfish
Component/s: web_container
Affects Version/s: 4.0_dev
Fix Version/s: 4.0

Type: Bug Priority: Major
Reporter: easarina Assignee: