Closed glassfishrobot closed 15 years ago
@glassfishrobot Commented shaline@java.net said: Created an attachment (id=2757) server.log
@glassfishrobot Commented shaline@java.net said: Created an attachment (id=2758) war file to reproduce issue
@glassfishrobot Commented @amyroh said: Jeanfrancois is currently investigating why the MapperListener isn't registering properly for /.
@glassfishrobot Commented jfarcand said: This will requires a change to the way MapperListener is registering the default web module. Looking at it.
@glassfishrobot Commented jfarcand said: Bumping this issue as a P1 as v3 is unusable after replacing the root. Looks like the CoyoteAdapter is no longer registered via the GrizzlyProxy.register(..). Need to find since when this notification no longer happens.
@glassfishrobot Commented jfarcand said: Adding more info (and Amy & Jan) as the following log looks suspicious
12-May-2009 8:17:08 PM com.sun.enterprise.web.WebContainer createHosts INFO: Created virtual server server 12-May-2009 8:17:08 PM com.sun.enterprise.web.WebContainer createHosts INFO: Created virtual server __asadmin 12-May-2009 8:17:08 PM OSGiModuleImpl start INFO: Started bundle org.glassfish.deployment.dol [117] 12-May-2009 8:17:08 PM OSGiModuleImpl start INFO: Started bundle org.glassfish.ejb.ejb-container [111] 12-May-2009 8:17:08 PM OSGiModuleImpl start INFO: Started bundle org.glassfish.webservices.jsr109-impl [157] 12-May-2009 8:17:09 PM com.sun.enterprise.web.VirtualServer findWebModuleInJ2eeApp SEVERE: vs.defaultWebModuleDisabled 12-May-2009 8:17:09 PM com.sun.enterprise.web.VirtualServer getDefaultWebModule SEVERE: vs.defaultWebModuleNotFound 12-May-2009 8:17:09 PM com.sun.enterprise.v3.services.impl.SnifferAdapter service INFO: Done with starting web container in 469 ms 12-May-2009 8:17:09 PM com.sun.enterprise.v3.services.impl.SnifferAdapter service SEVERE: Exception while mapping the request java.lang.RuntimeException: SnifferAdapter cannot map themself. at com.sun.enterprise.v3.services.impl.SnifferAdapter.service(SnifferAdapter.java:128) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:214) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:746) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:161) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:136) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
@glassfishrobot Commented @amyroh said: How do I reproduce the error you're seeing? From your log below, it looks like you're deploying ear application - default-web-module inside EAR isn't working right now because war inside ear isn't available during WebContainer.postConstruct (issue 7424). WebContainer.loadDefaultWebModule needs to be changed to handle that and I think it is a different issue from this ClassCastException.
12-May-2009 8:17:09 PM com.sun.enterprise.web.VirtualServer findWebModuleInJ2eeApp SEVERE: vs.defaultWebModuleDisabled 12-May-2009 8:17:09 PM com.sun.enterprise.web.VirtualServer getDefaultWebModule SEVERE: vs.defaultWebModuleNotFound 12-May-2009 8:17:09 PM com.sun.enterprise.v3.services.impl.SnifferAdapter service INFO: Done with starting web container in 469 ms 12-May-2009 8:17:09 PM com.sun.enterprise.v3.services.impl.SnifferAdapter service SEVERE: Exception while mapping the request java.lang.RuntimeException: SnifferAdapter cannot map themself. at com.sun.enterprise.v3.services.impl.SnifferAdapter.service(SnifferAdapter.java:128)
@glassfishrobot Commented jfarcand said: Salut,
just run the test with the restore and undeploy task, the shutdown and restart. I wasn't aware ear is not supported because I think I've a solution for the ClassCast exception...Thanks!@
@glassfishrobot Commented @amyroh said: Yeah, I have a couple of solutions for EAR default-web-module issue I can try once ClassCast exception is fixed.
@glassfishrobot Commented dhirup said: Added CC
@glassfishrobot Commented jfarcand said: The CCE can be fixed by applying the following:
— src/main/java/org/apache/catalina/connector/Connector.java (revision 27350) +++ src/main/java/org/apache/catalina/connector/Connector.java (working copy) @@ -1745,6 +1745,8 @@ }
if( this.domain != null ) {
But there is still an issue where the default-webmodule is not configured. A simple way to reproduce the issue:
% v3/bin/asadmin start-domain % asadmin create-http-listener --listenerport=8201 --listeneraddress=0.0.0.0 --defaultvs=server my-listener3
then
curl -i http://192.168.0.101:8201/index.jsp
produces
HTTP/1.1 400 Bad Request X-Powered-By: Servlet/3.0 Server: GlassFish/v3 Content-Type: text/plain; charset=iso-8859-1 Transfer-Encoding: chunked Date: Fri, 15 May 2009 21:18:20 GMT Connection: close
because there is no host/context mapped to /
@glassfishrobot Commented @amyroh said: I think I've addressed the issue with default-web-module not getting loaded.
bash-3.2$ glassfishv3/glassfish/bin/asadmin start-domain Name of the domain started: [domain1] and its location: [/Users/Amy/v3-5-15/v3/distributions/glassfish/target/glassfishv3/glassfish/domains/domain1]. Admin port for the domain: [4848]. bash-3.2$ glassfishv3/glassfish/bin/asadmin create-http-listener --listenerport=8201 --listeneraddress=0.0.0.0 --defaultvs=server my-listener3
Command create-http-listener executed successfully. bash-3.2$ curl -i http://localhost:8201/index.jspHTTP/1.1 200 OK Content-Type: text/plain; charset=iso-8859-1 Content-Length: 0 Date: Sun, 17 May 2009 22:54:40 GMT
However, the proposed patch for CCE causes other failures in devtests so mapper handling doesn't seem complete...
@glassfishrobot Commented oleksiys said: Amy, do you mean that tests, which didn't fail before, start to fail after applying the patch? Do these tests use some dynamic reconfiguration?
Looks like even if we fix the default-web-module loading, other deployed web applications are still unavailable on the newly created Web Connector.
@glassfishrobot Commented @amyroh said: There is an issue with dynamic reconfig for NetworkListener
@glassfishrobot Commented oleksiys said: IMHO issue #7919 is different. Here we don't create new http-listener nor update Host, we just change the port number of existing listener. Didn't we recently do any optimization of web application loading? Could it be related?
@glassfishrobot Commented oleksiys said: Seems I found the issue. The regression was introduced by commit r26977. After rolling back this commit [1], dynamic reconfiguration starts to work.
Do you have idea how we have to fix that?
FYI: when I'm debugging MapperListener .init(), myInstance = System.getProperty("com.sun.aas.instanceName"); always returns null
==== — main/java/org/apache/catalina/connector/MapperListener.java (revision 27305) +++ main/java/org/apache/catalina/connector/MapperListener.java (working copy) @@ -215,7 +215,8 @@
// Query contexts
// Query wrappers
@glassfishrobot Commented jfarcand said: Adding Dies
@glassfishrobot Commented jluehe said: Nice catch, Alexey!
I think this is a regression in the asadmin command: In GlassFish v2.x, it used to set this property:
"$AS_JAVA"/bin/java -Dcom.sun.aas.instanceName=server [...]
In GlassFish v3, it no longer does.
@glassfishrobot Commented jluehe said: Kedar, can we have asadmin in Glassfish v3 set the com.sun.aas.instanceName system property the same way it did in earlier releases?
@glassfishrobot Commented jluehe said: ...
@glassfishrobot Commented km said: Well, the situation has changed drastically between V2 and v3. In v2, the asadmin script and launcher used to set this (ugly) system property. But since v3 has other ways to start the server up (aka java -jar glassfish.jar), we needed another way of handling this.
The current way of getting this information is via an @Contract called ServerEnvironment. This contract is implemented by an @Service named ServerEnvironmentImpl.
So, the correct way is for you to look up (inject) the ServerEnvironmentImpl via habitat (since it is a service) and call the getInstanceName() method on it.
Check: v3/common/common-util/src/main/java/org/glassfish/server/ServerEnvironmentImpl.java.
Something like the following in MapperListener.java might help:
import com.sun.grizzly.util.http.mapper.MappingData; +import org.jvnet.hk2.annotations.Inject; +import org.glassfish.server.ServerEnvironmentImpl;
/**
Mapper listener. @@ -114,7 +116,10 @@ */ protected MBeanServer mBeanServer = null;
@Inject
private volatile ServerEnvironmentImpl env;
/**
The string manager for this package. */ @@ -192,7 +197,9 @@ public void init() {
// START SJSAS 6313044
Jan – I am giving this back to you. Let me know if this works.
@glassfishrobot Commented oleksiys said: Just tried that, and seems env is not getting injected. Ends up with NPE in line: myInstance = env.getInstanceName();
@glassfishrobot Commented jluehe said: Turns out we already determine the instance name in WebContainer.java. The following diffs simply propagate it to any newly generated Connector, and from there, to the Connector's associated MapperListener:
— web-core/src/main/java/org/apache/catalina/connector/MapperListener.java (revision 27459) +++ web-core/src/main/java/org/apache/catalina/connector/MapperListener.java (working copy) @@ -177,6 +177,10 @@ this.port = port; }
{ + myInstance = instanceName; + }
+ public String getDefaultHost()
{ return defaultHost; }
@@ -191,10 +195,6 @@ */ public void init() {
// START SJSAS 6313044
myInstance = System.getProperty("com.sun.aas.instanceName");
if (defaultHost != null) { mapper.setDefaultHostName(defaultHost); }
private String instanceName;
/**
/**
{ + this.instanceName = instanceName; + }
+ +
/**
Return the Coyote protocol handler in use. */ public String getProtocol() { @@ -1751,6 +1762,7 @@ mapperListener.setDefaultHost(this.defaultHost); // END S1AS 5000999 //mapperListener.setEngine( service.getContainer().getName() );
connector = (WebConnector)_embedded.createConnector(address, port,
isSecure);
if (mapper != null) { connector.setMapper(mapper); @@ -728,7 +729,7 @@ " on port " + listener.getPort());
if ( _logger.isLoggable(Level.FINE)){
@glassfishrobot Commented jfarcand said: +1 for the patch. Great work!
@glassfishrobot Commented jluehe said: Thanks, Jeanfrancois!
Sending web/web-core/src/main/java/org/apache/catalina/connector/Connector.java Sending web/web-core/src/main/java/org/apache/catalina/connector/MapperListener.java Sending web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java Transmitting file data ... Committed revision 27474.
@glassfishrobot Commented jluehe said: After the commit, I am no longer seeing this error upon restart:
Unable to set default web module [/virtual_server_config_webapp1] for virtual server [TestServer] LifecycleException: java.lang.Exception: No context matching /virtual_server_config_webapp1 deployed on virtual server TestServer
However, accessing http://localhost:8100/ still gives me the ClassCastException:
java.lang.ClassCastException: com.sun.enterprise.v3.services.impl.ContainerMapper$ContextRootInfo cannot be cast to org.apache.catalina.Context
It seems that WebContainer#updateDefaultWebModule still needs to update the mapper that is responsible for selecting the appropriate container ("container mapper"). Right now it only updates the mapper of the appropriate connector ("connector mapper").
I need Jeanfrancois' and Alexey's help for this last hurdle.
@glassfishrobot Commented dhirup said: Added JFA
@glassfishrobot Commented jfarcand said: Jan, can you apply the last patch I've added here (the one where I remove the host and context at / to see if that works?
@glassfishrobot Commented jluehe said: BINGO! )
Your patch made the ClassCastException go away - but QL fail.
I've reworked it slightly by removing the default context/host only in the case of a non-admin listener (for this, I had to move the setName and getName methods from the PECoyoteConnector sublcass to the Connector superclass).
Final diffs as follows:
— web-core/src/main/java/org/apache/catalina/connector/Connector.java (revision 27474) +++ web-core/src/main/java/org/apache/catalina/connector/Connector.java (working copy) @@ -396,6 +396,11 @@ private String instanceName;
/**
*/
private String name;
/**
Coyote adapter. */ private Adapter adapter = null; @@ -927,6 +932,22 @@
/**
{ + this.name = name; + }
+ +
{ + return name; + }
+ +
/**
Sets the instance name for this Connector. *
@param instanceName the instance name @@ -1756,7 +1777,11 @@ }
if( this.domain != null ) {
mapperListener.setDomain( domain );
if (!"admin-listener".equals(getName())) { + mapper.removeContext(defaultHost, ""); + mapper.removeHost(defaultHost); + }
— web-glue/src/main/java/com/sun/enterprise/web/connector/coyote/PECoyoteConnector.java (revision 27459) +++ web-glue/src/main/java/com/sun/enterprise/web/connector/coyote/PECoyoteConnector.java (working copy) @@ -194,12 +194,7 @@ */ private String rootFolder = "";
/**
*/
private String name;
// --------------------------------------------- FileCache support --//
/** @@ -765,22 +760,6 @@
/**
*/
public void setName(String name) { - this.name = name; - }
/**
*/
public String getName() { - return name; - }
/**
Sets the truststore location of this connector. *
@param truststore The truststore location
@glassfishrobot Commented jluehe said: Incremental and final fix (from Jeanfrancois), as per the above diffs:
Sending web-core/src/main/java/org/apache/catalina/connector/Connector.java Sending web-glue/src/main/java/com/sun/enterprise/web/connector/coyote/PECoyoteConnector.java Transmitting file data .. Committed revision 27492.
Build used: SDK b03a build47 jdk used : 1.6.0_13
When we set the default-web-module for a virtual server with a deployed webapplication contextname , and access the server at its root context, we see a emtpy page being rendered, rather than the webapplications index page. In the server.log ClassCastException is seen. Steps to reproduce: 1)install SDK build and start domain1 2) deploy a webapp to start the webcontainer. 3) create-virtual-server --hosts=localhost TestServer 4) asadmin create-http-listener --listenerport=8100 --listeneraddress=0.0.0.0 --defaultvs=TestServer my-listener 5) asadmin set configs.config.server-config.http-service.virtual-server.TestServer.network-listeners=my-listener
6) asadmin deploy --virtualservers=TestServer virtual_server_config_webapp1.war ( attached with this issue). 7) asadmin set configs.config.server-config.http-service.virtual-server.TestServer.default-web-module=virtual_server_config_webapp1 9) restart domain. 11) access the application: http://localhost:8100/ — We do not see the index page from the webapplication, and a empty page is rendered. In the server.log , we see the below Exceptions:
[#|2009-05-07T15:00:57.662-0700|SEVERE|glassfish|javax.enterprise.system.contain er.web.com.sun.enterprise.web|_ThreadID=12;_ThreadName=Thread-1;|WEB0149: Unable to set default web module [/virtual_server_config_webapp1] for virtual server [ TestServer] LifecycleException: java.lang.Exception: No context matching /virtual_server_co nfig_webapp1 deployed on virtual server TestServer at com.sun.enterprise.web.WebContainer.updateDefaultWebModule(WebContain er.java:2000) at com.sun.enterprise.web.WebContainer.loadDefaultWebModules(WebContaine r.java:1522) at com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:6 31) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:1 70) at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90) at java.security.AccessController.doPrivileged(Native Method) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java :87) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.jav a:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantIm pl.java:60) at org.glassfish.internal.data.EngineInfo.getContainer(EngineInfo.java:7 8) at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(App licationLifecycle.java:618) at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos (ApplicationLifecycle.java:404) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationL ifecycle.java:223) at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplicat ion(ApplicationLoaderService.java:296) at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(A pplicationLoaderService.java:144) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:1 70) at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90) at java.security.AccessController.doPrivileged(Native Method) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java :87) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.jav a:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantIm pl.java:60) at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.ja va:215) at com.sun.enterprise.v3.server.AppServerStartup$1.run(AppServerStartup. java:127)
| #] |
[#|2009-05-07T15:02:02.389-0700|SEVERE|glassfish|org.apache.catalina.connector.C oyoteAdapter|_ThreadID=15;_ThreadName=Thread-1;|PWC3989: An exception or error o ccurred in the container during the request processing java.lang.ClassCastException: com.sun.enterprise.v3.services.impl.ContainerMappe r$ContextRootInfo cannot be cast to org.apache.catalina.Context at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAd apter.java:528) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.j ava:297) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav a:249) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(Container Mapper.java:146) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:7 46) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:655) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:905) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFil ter.java:161) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultPro tocolChain.java:136) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav a:103) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav a:89) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java :76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextT ask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask. java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:908) at java.lang.Thread.run(Thread.java:619)
| #] |
[#|2009-05-07T15:02:27.025-0700|INFO|glassfish|org.jvnet.hk2.osgiadapter|_Thread ID=16;_ThreadName=Thread-1;org.glassfish.admin.monitoring-core [154];|Started bu ndle org.glassfish.admin.monitoring-core [154]|#]
Environment
Operating System: All Platform: All
Affected Versions
[V3]