eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
378 stars 144 forks source link

V3 does not work with modJK config #4521

Closed glassfishrobot closed 16 years ago

glassfishrobot commented 16 years ago

Glassfish Build used: V3 nightly build dated 03/25 OS Used: Solaris Sparc 10: 1) Installed the Apache httpd 2.2.6 in /usr/local/apache2 dir , with all the necessary packages like expat, openssl, zlib etc. 2) Installed the mod_jk 1.2.26 -httpd-2.2.6.so 3) Used the tomcat-ajp.jar from the tomcat apache-tomcat-5.5.16 version and placed it in the glassfish-V3/modules dir. 4) Used the commons-logging-1.0.4.jar and placed in the glassfish-v3/modules. 5) Used the commons-modeler-1.1.jar and placed in the glassfish-v3/modules. 6) Configured the httpd.conf and worker.properties file for the mod_jk 1.2.26 -httpd-2.2.6.so 7) Added the below JVM options to glassfish-v3: (manually edited the domain.xml) -Dcom.sun.enterprise.web.connector.enableJK=8009 8) Successfully started the httpd . 9) Started the glassfish v3. but I do not see the "|ajp13 listening on /0.0.0.0:8009|#]" or anything related to modJK in the server.log

Glassfish server.log does not have any messages or Exceptions related to modJK.

The same setup with Glassfish 9.1UR1 fcs build works fine, and all the requests to apache are forwarded to glassfish, but does not work with V3. I am attaching the mod_jk.log with this issue.

Environment

Operating System: All Platform: All

Affected Versions

[V3]

glassfishrobot commented 6 years ago
glassfishrobot commented 16 years ago

@glassfishrobot Commented shaline@java.net said: Created an attachment (id=1411) mod jk log file

glassfishrobot commented 16 years ago

@glassfishrobot Commented jluehe said: On Mar 28, 2008, at 9:53 AM, Amy Roh wrote:

From the logging message, I see that a jar gets added in glassfish \lib appropriately.

Mar 28, 2008 9:40:58 AM com.sun.enterprise.glassfish.bootstrap.ASMain $ExtensibleClassLoader jarAdded INFO: Added file:/v3/distributions/web/target/web/glassfish/lib/ tomcat-ajp.jar to shared classpath, no need to restart appserver

The tomcat-ajp.jar depends on coyote related classes which are in webtier.jar but cannot find it resulting in java.lang.NoClassDefFoundError: org/apache/coyote/...

Jars in lib added to shared classpath cannot access webtier.jar - I believe this is intended behavior.

Is there a way to get around this?

no, there is not

no only way to do this is to make tomcat-ajp.jar a module that imports webtier or add tomcat-ajp.jar to the webtier module. I believe that once we will have the support for --libraries when deploying applications, this will be resolved but you will need to put the jar in applibs and then deploy the application with --library flag.

jerome

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: Jane Young wrote:

This will limit modjk support in v3 until --libraries support is available then. Is there a time line for this?

Thanks, Amy

Hi, Amy.

I'm working on this. This option is not supported in TP2. Will be available this week or when workspace is opened after SCF.

Thanks, Jane

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: tp2-exclude

glassfishrobot commented 16 years ago

@glassfishrobot Commented jluehe said: We have a dependency on Sahoo for the OSGi-enabling of the tomcat-ajp.jar that is to be dropped into the domain's lib directory.

Sahoo wrote:

Though process has changed, and I am not thinking along the lines of converting every library in lib dir to be OSGi-ed automatically. I am thinking of a solution that may avoid such a magic.

Assigning to Sahoo.

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: CC myself

glassfishrobot commented 16 years ago

@glassfishrobot Commented ss141213 said: I am not very familiar with the setup needed to reproduce & fix the bug. I am wondering if the submitter can help me in doing some analysis. I am attaching a new version of tomcat-ajp.jar. It contains same classes as original tomcat_ajp.jar from tomcat 5.5.26; only the MANIFEST.MF is different. MANIFEST.MF contains OSGi metadata. Here is what needs to be done:

instead of copying tomcat-ajp.jar to lib directory, please copy tomcat-ajp-bundle.jar to modules directory and restart the server. Rest of the instructions remain unchanged. Let me know what you see.

Thanks, Sahoo

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: Hi Sahoo,

Did you forget to attach the new tomcat-ajp.jar with OSGi metadata?

I'll try it out and let you know.

Thanks, Amy

glassfishrobot commented 16 years ago

@glassfishrobot Commented ss141213 said: Created an attachment (id=1620) OSGi-ed tomcat-ajp.jar. Put it in modules dir.

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: Great. I was able to drop the OSGi-ed tomcat-ajp.jar in modules directory and it looks like the jar is getting picked up.

I'm getting another error in web container since this feature hadn't been tried since now due to this issue. Will look into this further.

[#|2008-07-23T13:07:17.500-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Apache mod_jk/jk2 attached to virtual-server server listening on port: 8009|#]

[#|2008-07-23T13:07:17.531-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;server;|webcontainer.ssodisabled|#]

[#|2008-07-23T13:07:17.562-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Virtual Server server set port 8080|#]

[#|2008-07-23T13:07:17.562-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Virtual Server server set jk port 8009|#]

[#|2008-07-23T13:07:17.593-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Created virtual server server|#]

[#|2008-07-23T13:07:17.593-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;__asadmin;|webcontainer.ssodisabled|#]

[#|2008-07-23T13:07:17.609-0700|INFO|GlassFish10.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Created virtual server __asadmin|#]

[#|2008-07-23T13:07:17.640-0700|INFO|GlassFish10.0|org.jvnet.hk2.osgiadapter|_ThreadID=13;_ThreadName=Thread-4;org.glassfish.deployment.dol [36];|Started bundle org.glassfish.deployment.dol [36]|#]

[#|2008-07-23T13:07:18.546-0700|SEVERE|GlassFish10.0|javax.enterprise.system.tools.deployment|_ThreadID=13;_ThreadName=Thread-4;|Cannot start container web java.lang.NullPointerException at com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:164) at com.sun.enterprise.v3.services.impl.GrizzlyProxy.registerEndpoint(GrizzlyProxy.java:51) at com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:230) at com.sun.enterprise.v3.services.impl.GrizzlyService.registerEndpoint(GrizzlyService.java:215) at com.sun.enterprise.web.WebContainer.loadDefaultWebModules(WebContainer.java:2447) at com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:607) at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:150) at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86) at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:75) at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58) at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107) at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60) at org.glassfish.internal.data.ContainerInfo.getContainer(ContainerInfo.java:75) at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:766) at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:411) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262) at com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:274) at com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:286) at com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:114) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:238) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:155) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:157) at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621) at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552) at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152) at com.sun.enterprise.v3.services.impl.HttpProtocolFilter.execute(HttpProtocolFilter.java:82) at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:61) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56) at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:169)

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: We should either put the tomcat-ajp-osgi.jar in glassfish/modules by default or have the jar available for update center so users can use this feature in v3.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jluehe said: See also https://glassfish.dev.java.net/issues/show_bug.cgi?id=5022

glassfishrobot commented 16 years ago

@glassfishrobot Commented @amyroh said: I addressed the NPE mentioned above and found that tomcat-ajp.jar is not getting loaded to v3 - getting ClassNotFoundException for org.apache.jk.server.JkCoyoteHandler although tomcat-ajp.jar contains the class.

[#|2008-07-23T14:48:01.375-0700|SEVERE||javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=Thread-4;|Unable to start web container LifecycleException: PWC3986: Protocol handler instantiation failed: java.lang.ClassNotFoundException: org.apache.jk.server.JkCoyoteHandler at org.apache.catalina.connector.Connector.initialize(Connector.java:1561)

Easy steps to produce

1. make sure you have the NPE patch 21388 https://glassfish-svn.dev.java.net/source/browse/glassfish-svn/trunk/v3/web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java?view=diff&rev=21388&p1=trunk/v3/web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java&p2=trunk/v3/web/web-glue/src/main/java/com/sun/enterprise/web/WebContainer.java&r1=21387&r2=21388

2. enable jk in domain.xml

-Dcom.sun.enterprise.web.connector.enableJK=8009

3. put tomcat-ajp-osgi.jar in modules

4. start web container

glassfishrobot commented 16 years ago

@glassfishrobot Commented jluehe said: I have not tried this myself, but from tomcat-ajp-osgi.jar's MANIFEST.MF file, I can see Import-Package dependencies on org.apache.commons.modeler and org.apache.commons.logging. While apache-commons-10.0-SNAPSHOT.jar still exports org.apache.commons.logging (which I believe is no longer needed), it no longer exports org.apache.commons.modeler. Therefore, it is quite possible that tomcat-ajp-osgi.jar could not be resolved, and therefore does not export org.apache.jk.server.JkCoyoteHandler or any other of its other classes.

Just a thought ...

glassfishrobot commented 16 years ago

@glassfishrobot Commented ss141213 said: Thanks Amy for doing the needful. I can see why web-core is not able to load org.apache.jk.server.JkCoyoteHandler.class. Although tomcat-ajp-osgi bundle exports org.apache.jk.server, web-core module does not import the corresponding package! When I add corresponding (optional) import in web-core, the class is loaded, but I get ClassCastException, as the code tries to cast to com.sun.grizzly.tcp.ProtocolHandler, where as org.apache.jk.server.JkCoyoteHandler implements org.apache.coyote.ProtocolHandler.

In order to fix this bug, we need to do the following: 1. Fix https://glassfish.dev.java.net/issues/show_bug.cgi?id=5022 so that we make a OSGi-ed tomcat-ajp in update centre or some other place. 2. Make change in web-core/pom.xml to add proper import. See attached pom.xml. 3. Fix ClassCastException described above.

I am transferring this bug to web-container now, as they have to resolve the ClassCastException issue. I am attaching the new web-core/pom.xml which has the proper Import-Package header.

Thanks, Sahoo

glassfishrobot commented 16 years ago

@glassfishrobot Commented ss141213 said: Created an attachment (id=1622) Patch for web/web-core/pom.xml to add proper Import-Package

glassfishrobot commented 16 years ago

@glassfishrobot Commented jluehe said:

glassfishrobot commented 16 years ago

@glassfishrobot Commented kumara said: Add gfv3-prelude-include to status whiteboard

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Re-assign to myself.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Make sure Mapper is never null.

Sending src/main/java/com/sun/enterprise/web/WebConnector.java Transmitting file data . Committed revision 22147.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Make sure we reference the Grizzly ProtocolHandler implementation instead of the Tomcat's one. With this fix, mod_jk works fine.

Sending src/main/java/org/apache/catalina/connector/Connector.java Sending src/main/java/org/apache/catalina/connector/MapperListener.java Transmitting file data .. Committed revision 22148.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Added the JK classed to the workspace.

Transmitting file data ................................... Committed revision 22171.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Adding the other monster to the distribution. Now mod-jk works.

Sending web/pom.xml Transmitting file data . Committed revision 22176.

glassfishrobot commented 16 years ago

@glassfishrobot Commented jfarcand said: Closing the bug as fixed.

glassfishrobot commented 16 years ago

@glassfishrobot Commented kumara said: v3 defect tracking

glassfishrobot commented 16 years ago

@glassfishrobot Commented File: issue_4521.patch.zip Attached By: ss141213

glassfishrobot commented 16 years ago

@glassfishrobot Commented File: mod_jk.log Attached By: shaline@java.net

glassfishrobot commented 16 years ago

@glassfishrobot Commented File: tomcat-ajp-osgi.jar Attached By: ss141213

glassfishrobot commented 16 years ago

@glassfishrobot Commented Was assigned to jfarcand

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-4521