Jump to content
Sign in to follow this  
RMiranda

Tomcat CGI to lunch Java Jar Server

Recommended Posts

Hey community, I'm having a problem making a cgi to run my alredy packed and "ready-for-sale" Java Server, in jar compact fully functional when i run the jar in the windows environment. Now im trying to make a cgi, on Tomcat6.0 WebServer via Eclipse, using a Dynamic Web Project with the strutcure(briefed): WebProject: >WebContent: >index.jsp (Where i have the links to the cgi's/bat's) >WEB-INF: >cgi: >ServerRemoteStart.bat >helloworld.bat I have alredy sucessfuly seted Tomcat to run CGI, the prof of that is that i can execute helloworld.bat with no problems. The ServerRemoteStart.bat is as follow:

"C:\Program Files\Java\jre6\bin\java.exe" -jar "D:\My Dropbox\isel\1011sv\SCDist\Trabs-G01D\T01\QAGame\Executaveis\Server QAGame\jar\ServerApp.jar"

And it works fine if i copy paste it to the cmd, but when i click the link in the index to the ServerRemoteStart.bat i get the following error:

INFO: cgi: runCGI (stderr):java.net.UnknownHostException: *********: *********  11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.InetAddress.getLocalHost(Unknown Source)  11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at server.Server.getIPownAdd(Server.java:84)  11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at server.Server.main(Server.java:33)  11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr):#Server port: 3333, alredy in use!  11/Jul/2011 9:53:27 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr):#Close Server App, or it will self-destroy in 10 seconds...

********* = HostName The 3 last lines are my handling of the IOException(there's nothing alredy running on that port, runned Netstat -a -n -o to checked) PS: i would like to change the server java code as least as possible, pref no change. Does this problem as somthing to do with the tomcat environment ports? It's my first time using this kind of Server so realy have no other clue or sulution ideia here ...Debug update, commented the part of the Java Server that was trowing the UnkownHostException(it was only used to print the host IP to the server console) and know i get the following exeception when trying to instanceate the ServerSocket:

INFO: cgi: runCGI (stderr):java.net.SocketException: Unrecognized Windows Sockets error: 126: create  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.ServerSocket.createImpl(Unknown Source)  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.ServerSocket.getImpl(Unknown Source)  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.ServerSocket.bind(Unknown Source)  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.ServerSocket.<init>(Unknown Source)  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at java.net.ServerSocket.<init>(Unknown Source)  13/Jul/2011 17:51:56 org.apache.catalina.core.ApplicationContext log  INFO: cgi: runCGI (stderr): at server.Server.main(Server.java:42)

Searched the ENTIRE WEB, no one as ever gotten the 126 error, my stated of mind is a mix of blessed but most of all extremly frusted, any clues ot there?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×