PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Debian: Jboss4 und Tomcat5 hört nur auf 127.0.0.1 anstatt auf 0.0.0.0



pablovschby
08.04.08, 13:51
Hallo Forum

Debian 4 Kernel 2.6.18-6-686 (net-inst)
jboss-4.2.2.GA
Java version "1.5.0_13"
Tomcat 5

Der Applikationsserver läuft problemlos, ebenso der Tomcat5. Das Problem ist nur, dass der Tomcat5 nicht auf 0.0.0.0:8080 sondern auf 127.0.0.1:8080 hören.

Also auf der Debian-Kiste selbst sehe ich die Applikationen über http://localhost:8080 (JBoss-Startseite), aber remote-mässig http://%IP_der_Debian-Kiste%:8080 meldet Mozilla immer: Verbindung fehlgeschlagen

Also ich kann die Debian-Kiste vom Mozilla-Rechner aus pingen mit der IP. Wie kann ich nun den Tomcat5-Server so umstellen, dass er nicht nur auf 127.0.0.1:8080 hört, sondern auf 0.0.0.0:8080 und somit auch von einem anderen Rechner her darauf zugegriffen werden kann?

Ich habe echt lange gesucht... und ich finde einfach nix, vlt. bin ich zu blöd.

Ich hänge mal noch die server.xml und die web.xml Datei des Tomcat5 an. Beide Dateien befinden sich in /etc/tomcat5/ .


(Vlt. suche ich falsch. Meiner Meinung nach müsste doch irgendwo der Eintrag sein: "Connector Port" und dann aber "127.0.0.1:8080", aber vlt. lieg ich falsch. Dann wäre es ja eigentlich sehr einfach, denn dann müsste nur aus 127.0.0.1 0.0.0.0 gemacht werden und dat Zeugs würde laufen.

Wenn ich vom Debian-Rechner her auf den JBoss zugreife und "Tomcat Status" wähle, meint der:

JVM
Free memory: 75.38 MB Total memory: 126.75 MB Max memory: 506.31 MB
ajp-127.0.0.1-8009
Max threads: 40 Current thread count: 0 Current thread busy: 0
Max processing time: 0 ms Processing time: 0.0 s Request count: 0 Error count: 0 Bytes received: 0.00 MB Bytes sent: 0.00 MB
Stage
Time
B Sent
B Recv
Client
VHost
Request
P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive
http-127.0.0.1-8080
Max threads: 250 Current thread count: 2 Current thread busy: 2
Max processing time: 83 ms Processing time: 0.088 s Request count: 2 Error count: 1 Bytes received: 0.00 MB Bytes sent: 0.00 MB
Stage
Time
B Sent
B Recv
Client
VHost
Request
S 52 ms 0 KB 0 KB 127.0.0.1 localhost GET /status HTTP/1.1
K 2501 ms ? ? 127.0.0.1 ? ?
P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive

Danke fürs Lesen und danke für jeden Link.


server.xml

war zu lang, der Beitrag... die web.xml ist imho wichtiger.



web.xml


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">


<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>



<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>


<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>


<session-config>
<session-timeout>30</session-timeout>
</session-config>





...dann das MIME-MAPPING zeugs, was imho nicht so wichtig ist... korrigiert mich, wenn ich falsch liege

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>

marce
08.04.08, 13:56
poste bitte die server.xml

Firewall ist aus?

pablovschby
08.04.08, 16:18
Danke für das Reply.

Firewall:
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
server.xml:
cat /etc/tomcat5/server.xml
<!-- Server Configuration File for Tomcat 5 on Debian
You can find a more complete example in /usr/share/doc/tomcat5/examples/
-->

<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.

Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycl eListen
er"
debug="0"/>

<!-- Global JNDI resources -->
<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactor y</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.

Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
-->

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8180 -->
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="8180" minProcessors="5" maxProcessors="75"
enableLookups="true" acceptCount="10" debug="0"
connectionTimeout="20000" useURIValidationHack="false" />

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" acceptCount="10" debug="0"
connectionTimeout="20000" useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->

<!-- Define the top level container in our container hierarchy
The name must be Catalina for correct function of the admin webapp -->
<Engine name="Catalina" defaultHost="localhost" debug="0">

<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_" suffix=".log" timestamp="true"/>

<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>

<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<!-- Logger shared by all Contexts related to this virtual host. -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_" suffix=".log"
timestamp="true"/>

</Host>

</Engine>

</Service>


</Server>
vm-labseexondebian:/home/testuser1# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
vm-labseexondebian:/home/testuser1# cat /etc/tomcat5/server.xml
<!-- Server Configuration File for Tomcat 5 on Debian
You can find a more complete example in /usr/share/doc/tomcat5/examples/
-->

<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.

Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<Server port="8005" shutdown="SHUTDOWN" debug="0">

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycl eListener"
debug="0"/>

<!-- Global JNDI resources -->
<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactor y</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>

</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.

Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
-->

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8180 -->
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="8180" minProcessors="5" maxProcessors="75"
enableLookups="true" acceptCount="10" debug="0"
connectionTimeout="20000" useURIValidationHack="false" />

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" acceptCount="10" debug="0"
connectionTimeout="20000" useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->

<!-- Define the top level container in our container hierarchy
The name must be Catalina for correct function of the admin webapp -->
<Engine name="Catalina" defaultHost="localhost" debug="0">

<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_" suffix=".log" timestamp="true"/>

<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>

<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<!-- Logger shared by all Contexts related to this virtual host. -->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_" suffix=".log"
timestamp="true"/>

</Host>

</Engine>

</Service>


</Server>

marce
08.04.08, 19:00
Sicher, dass dies die richtige Datei ist? Weil da nix auf 8080 hört... - weder an 127.0.0.1 noch sonst wo...

pablovschby
09.04.08, 10:32
Genau darum habe ich mich auch gefragt: Häää???

Marce, wo soll diese Datei denn bitte sonst sein? Die müsste doch /etc/tomcat5/server.xml sein, oder???

Könnte es ev. nicht sein, dass die standardmöässig so eingestellt ist, aber halt standardmässig der Tomcat5 auf 127.0.0.1 hört (auch wenn da nix von 127.0.0.1:8080 steht...)?

Wie sieht denn da eine solche Beispielskonfiguration aus mit 0.0.0.0:8080 aus?
Sry, komme mir zwar blöd vor, ist aber so, dass ich dazu wirklich nirgens eine Info finde. Kannst du nichtmal büdde ein so ein Beispiels-file posten mit einem Eintrag à la 0.0.0.0:8080 ???????
*anfleh* :cool:

marce
09.04.08, 10:41
Wo die Datei sonst sein kann - keine Ahnung, es gibt viele Möglichkeiten. Je nach dem, wie man dem Tomcat startet nimmt er jeden beliebigen Pfad an.

Bei mir sieht eine server.xml so aus:

<Server port="9080" shutdown="SHUTDOWN">
<GlobalNamingResources>
<Resource name="UserDatabase"
auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactor y"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

<Service name="Catalina">
<Connector port="8080"
maxThreads="1000"
minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false"
acceptCount="100"
connectionTimeout="20000"
compression="on"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript"
disableUploadTimeout="true" />

<Engine name="Catalina"
defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost"
appBase="webapps"
unpackWARs="true"
autoDeploy="false"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path=""
docBase="ROOT"
debug="0"
allowLinking="true"/>
</Host>
</Engine>
</Service>
</Server>

... wobei wir den Tomcat direkt einsetzen, ohne irgendeinen Apache oder sonstige Connectoren vornedran...

Und er horcht auf 127.0.0.1 und auf alles, was von außen an die Kiste herankommt.

Was bei Dir auf :8080 läuft - keine Ahnung. Lt. der Konfig von Dir ist es alles mögliche, aber nicht der Tomcat, der die von Dir gepostete Konfigdatei verwendet.

pablovschby
09.04.08, 12:31
Hallo liebe User

Also das Problem ist gelöst. Wie?

Ich starte nun das Skript "run.sh" im JBoss/bin Verzeichnis mit dem Parameter:
./run.sh -Djboss.bind.address=0.0.0.0und man kann von überall her auf den JBoss Server zugreifen...

Warum? Weil JBoss seinen eigenen tomcat5 startet und dieser auch nicht die config-files in /etc/tomcat5 hat.

Bestens also.

Danke euch.