Tomcat setup help: multiple ports not responding

My goal is for port 80 and 81 to listen and serve content from two different paths. I am considering replicating what I used with IIS, and building sites on specific ports.

I took the base configuration file and added the following tags in the Server tag (server.xml):

<Service name="stable"> <Connector port="80" protocol="HTTP/1.1" /> <Context docBase="C:\websites\test\stable\" /> </Service> <Service name="release"> <Connector port="81" protocol="HTTP/1.1" /> <Context docBase="C:\websites\test\release\" /> </Service> 

I was going to the tip where I had to set the Service tag with the Connector and Context tag for each port that I wanted to run (inside the main server tag).

I looked through my log and found the following:

 16-Jan-2011 8:54:44 AM org.apache.catalina.connector.CoyoteAdapter service SEVERE: An exception or error occurred in the container during the request processing java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584) at java.lang.Thread.run(Thread.java:619) 

I know that context works better in a more localized context.xml file, but I don't mind restarting until I get this working. Or maybe they NEED to be there (not APress Pro Apache TomCat6).

At the moment, the transition to IP: 80 does not cause anything, there is no file, there is no error, just a blank page. Even when I try to access index.html (which was copied to the proper docBase), I get a blank screen without any errors.

Edit # 2

I decided that I would send my files in case someone had more time on their hands and they want to go to them.

Here is my server.xml file: http://pastebin.com/DAunTPTg

Here's the error I'm getting at the moment: http://pastebin.com/mrrd0116

Edit # 3

To make things easier, I tried to configure port 80 correctly.

According to my book:

The name of this virtual host is as configured DNS. One of the hosts embedded in the engine must have a name that matches the defaultHost of this engine.

Why should I specify anything other than localhost (localhost1 doesn't work, right?)

This is where I am now, still not working:

 <Service name="Stable"> <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" /> <Engine name="Stable" defaultHost="localhost"> <Host name="localhost" appBase="webapps"> <Context docBase="C:\websites\test\stable" /> </Host> </Engine> </Service> 

I also get new errors:

18-Jan-2011 8:37:12 PM org.apache.catalina.startup.Catalina start SEVERE: Catalina.start: Error LifecycleException: error initialization: java.lang.NullPointerException with org.apache.catalina.core.StandardContext.start (StandardContext.java:4380) in org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1045) in org.apache.catalina.core.StandardHost.start (StandardHost.java:785) in org.apache. catalina.core.ContainerBase.start (ContainerBase.java:1045) in org.apache.catalina.core.StandardEngine.start (StandardEngine.java:445) in org.apache.catalina.core.StandardService.start (StandardService.java: 519) in org.apache.catalina.core.StandardServer.start (StandardServer.java:710) in org.apache.catalina.startup.Catalina.start (Catalina.java∗81) in sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) when sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) in sun.reflect.DelegatingMethodAccessorIm pl.invoke (DelegatingMethodAccessorImpl.java:25) in java.lang.reflect.Method.invoke (Method.java►97) in org.apache.catalina.startup.Bootstrap.start (Bootstrap.java:289) in org.apache .catalina.startup.Bootstrap.main (Bootstrap.java:414)

and

January 18, 2011 8:36:47 org.apache.catalina.mbeans.ServerLifecycleListener createMBeans SEVERE: createMBeans: Throwable java.lang.NullPointerException at org.apache.catalina.mbeans.MBeanUtils.createObjectName (MBeanUtils.ava org.apache.catalina.mbeans.MBeanUtils.createMBean (MBeanUtils.java:504) in org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans (ServerLifecycleListener.java=7070) in org.apache.caterineeeeleeeelebecyclelebecyclecycle ServerLifecycleListener.javahaps66) in org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans (ServerLifecycleListener.javahaps35) in org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans (ServerLifecycleListcatalava.ava .mbeans.ServerLifecycleListener.createMBeans (ServerLifecycleListener.java:656) in org.apache.catalina.mbeans.ServerLifecycleListener.createMBeans (ServerLifecycleListener.java:628) in org.apache.catalina.mbeansLenerLerlrever.ServerLer MBeans (ServerLifecycleListener.java:278) at org.apache.catalina.mbeans.ServerLifecycleListener.lifecycleEvent (ServerLifecycleListener.java:129) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (LifecycleSupport.java11ache .catalina.core.StandardServer.start (StandardServer.java:703) in org.apache.catalina.startup.Catalina.start (Catalina.java∗81) in sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) with sun.reflect .NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) in sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) in java.lang.reflect.Method.invoke (Method.javaache97cat orgina. startup.Bootstrap.start (Bootstrap.java:289) in org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:414)

Change # 4

I added the folder structure / Stable / localhost to the conf folder. Also added .xml host manager and manager.xml.

Still not working.

Change # 5

I think I got it, well, I serve html and cfml pages with some errors in the log files.

 <Service name="Stable"> <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" /> <Engine name="Stable" defaultHost="localhost"> <Host name="localhost" appBase="C:\websites\test\stable\"> <Context docBase="C:\websites\test\stable\" path="" /> </Host> </Engine> </Service> 

Errors:

18-Jan-2011 11:31:40 PM org.apache.catalina.core.StandardContext resourcesStart SEVERE: error while starting static resources java.lang.IllegalArgumentException: Document base C: \ websites \ test \ stable \ manager does not exist or Cannot read directory "

+5
railo tomcat configuration ports
Jan 18 '11 at 1:14
source share
2 answers

This works for me:

 <Service name="Stable"> <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" /> <Engine name="Stable" defaultHost="localhost"> <Host name="localhost" appBase="C:\websites\test\stable\"> <Context docBase="C:\websites\test\stable\" path="" /> </Host> </Engine> 

0
Jan 25 '11 at 16:41
source share

I think you are on the right track, but you are just missing some of the children listed in the specification for the Service element.

I think that you simply forget the Engine and Host elements, which are the grandfather and parent, respectively, of the Context element. p>

 <Service name="stable"> <Connector port="80" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000"/> <Engine name="stable" defaultHost="localhost"> <Host name="localhost1" appBase="webapp1"> <Context docBase="C:\websites\test\stable\" /> </Host> </Engine> </Service> <Service name="release"> <Connector port="81" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000"/> <Engine name="release" defaultHost="localhost2"> <Host name="localhost2" appBase="webapp2"> <Context docBase="C:\websites\test\release\" /> </Host> </Engine> </Service> 

For more information and a more detailed example that defines two elements of the service: one on port 8080 and one on port 9080, see this mailing list:

http://www.mail-archive.com/users@tomcat.apache.org/msg44729.html

+3
Jan 18 '11 at 1:40
source share



All Articles