Link to home
Start Free TrialLog in
Avatar of JGoyer
JGoyerFlag for United States of America

asked on

trying to compile and run a servlet in eclipse - errors!

Hello, I am new (again) to java and trying to run some initial tests of servlets in eclipse.  Getting the following errors and completely clueless on them:

Activation.main: warning: sun.rmi.activation.execPolicy system
property unspecified and no ExecPermissions/ExecOptionPermissions
granted; subsequent activation attempts may fail due to unsuccessful
ExecPermission/ExecOptionPermission permission checks.  For
documentation on how to configure rmid security, refer to:

http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/rmid.html
http://java.sun.com/j2se/1.4/docs/tooldocs/win32/rmid.html

Activation.main: an exception occurred: Port already in use: 1098; nested exception is:
      java.net.BindException: Address already in use: JVM_Bind
java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
      java.net.BindException: Address already in use: JVM_Bind
      at sun.rmi.transport.tcp.TCPTransport.listen(Unknown Source)
      at sun.rmi.transport.tcp.TCPTransport.exportObject(Unknown Source)
      at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unknown Source)
      at sun.rmi.transport.LiveRef.exportObject(Unknown Source)
      at sun.rmi.server.UnicastServerRef.exportObject(Unknown Source)
      at sun.rmi.registry.RegistryImpl.setup(Unknown Source)
      at sun.rmi.registry.RegistryImpl.<init>(Unknown Source)
      at java.rmi.registry.LocateRegistry.createRegistry(Unknown Source)
      at sun.rmi.server.Activation.main(Unknown Source)
Caused by: java.net.BindException: Address already in use: JVM_Bind
      at java.net.PlainSocketImpl.socketBind(Native Method)
      at java.net.PlainSocketImpl.bind(Unknown Source)
      at java.net.ServerSocket.bind(Unknown Source)
      at java.net.ServerSocket.<init>(Unknown Source)
      at java.net.ServerSocket.<init>(Unknown Source)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(Unknown Source)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(Unknown Source)
      at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(Unknown Source)
      ... 9 more


This is the code:

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;

public class TimeServlet extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
      IOException {
      response.setContentType("text/plain");
      
      PrintWriter out = response.getWriter();
      out.println("this is my first servlet");
      }
}
Avatar of Javatm
Javatm
Flag of Singapore image

You know what if your using just eclipse + some plugins + some servers(tomcat) :
You might be in trouble, this should be used by people who are experience
in jsp/servelts/xml in doing configurations.

If this is your 1st time it would be better to use netbeans instead (all are bundled including tomcat):
http://www.netbeans.org 

If you need a tutorial here's where you should start :
www.netbeans.org/kb/articles/quickstart-40.html

Hope that helps . . .
Javatm
>> java.net.BindException: Address already in use: JVM_Bind

It seems your webserver is already running and you are trying to start it again. Stop and terminate the running web-server, Start again and try.
That can also be true the server might already be running.
Try to use netbeans for all your JSP and Servlets.

Netbeans has got a lot of features and it has a builtin compile and run option. It also has a built in debugger.
Avatar of JGoyer

ASKER

Wonderful!  Thanks All!
Avatar of JGoyer

ASKER

I probably did not award the points properly.  I will definitely use the netbean solution from here on out BUT the problem was most likely the issue with the server already being started and therefore that is the correct answer.    I need to change the accepted answer and change the points around or award these points all to ldbkutty and ask a different q to award points to javatm and triguna.  I am willing to do either so this is done properly.

Thanks again I greatly appreciate it!
JGoyer
ASKER CERTIFIED SOLUTION
Avatar of ldbkutty
ldbkutty
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. :)
Avatar of JGoyer

ASKER

I have added a new question for Javatm and triguna here:  https://www.experts-exchange.com/questions/21308447/for-JavaTM-and-Triguna.html