Bug 163169 - www/tomcat7: Tomcat7 is not able to connect to IPV4
Summary: www/tomcat7: Tomcat7 is not able to connect to IPV4
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alex Dupre
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-10 19:40 UTC by William Elasio Moreno Albarracin
Modified: 2011-12-13 01:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Elasio Moreno Albarracin 2011-12-10 19:40:03 UTC
I installed tomcat7 via ports.
Info at JAVA "Java TCP socket attributes, socket.soTrafficClass: Note: On some JDK versions, setting soTrafficClass causes a problem. A work around for this is to add the -Djava.net.preferIPv4Stack=true value to your JVM options."
Info at /usr/local/apache-tomcat-7.0/logs
Error at "tomcat7 start":
Dec 6, 2011 9:08:28 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[localhost:8005]: java.net.BindException: Can't assign requested address
Error at "tomcat7 stop":
java.net.SocketException: Invalid argument at java.net.PlainSocketImpl.socketConnect(Native Method)

Fix: 

1.1.- Add line to "/etc/rc.conf"
tomcat7_java_opts="-Djava.net.preferIPv4Stack=true"

or

1.2.- Add line to "/usr/local/etc/rc.d/tomcat7"
tomcat7_java_opts="-Djava.net.preferIPv4Stack=true"

test:
/usr/local/etc/rc.d/tomcat7 start/stop

and

2.- Create file "/usr/local/apache-tomcat-7.0/bin/setenv.sh" chown www:www setenv.sh, chmod 755 setenv.sh.
And add line:
JAVA_OPTS="-Djava.net.preferIPv4Stack=true"

test:
./catalina.sh start/stop
How-To-Repeat: ./catalina.sh start/stop
/usr/local/etc/rc.d/tomcat7 start/stop
Comment 1 Glen Barber freebsd_committer freebsd_triage 2011-12-10 20:02:40 UTC
Responsible Changed
From-To: freebsd-www->ale

Over to maintainer.
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2011-12-12 10:14:10 UTC
State Changed
From-To: open->closed

Not a tomcat-specific problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163169 

Date: Mon, 12 Dec 2011 06:26:18 -0800 (PST)