top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can Tomcat be started at boot time as a non-root user

+3 votes
313 views
How can Tomcat be started at boot time as a non-root user
posted Oct 14, 2014 by Luv Kumar

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I am a python script which tries to create a file under directory /etc/ but I am getting the error as

IOError: [Errno 13] Permission denied: '/etc/file'

Any Idea how to create a file in /etc as non-root user?

+4 votes

Is there a command i can issue to get the exact system time that the remote Tomcat server is using? And then is there a command or some way (with applicable admin rights) to set the remote time?

The idea is the sync'ing of the different PC's I am hoping to use, if there is some other way used I am grateful to hear it. I am setting up a distributed system that's running in Linux.

0 votes

I have a questions regarding the Non Blocking API introduced in Tomcat 8. I'm looking at the TestNonBlockingAPI test as an example, specifically the NBReadServlet class.

@WebServlet(asyncSupported = true)
public class NBReadServlet extends TesterServlet {
 private static final long serialVersionUID = 1L;
 public volatile TestReadListener listener;
 @Override
 protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 // step 1 - start async
 AsyncContext actx = req.startAsync();
 actx.setTimeout(Long.MAX_VALUE);
 actx.addListener(new AsyncListener() {
 // removed for brevity 
 });
 // step 2 - notify on read
 ServletInputStream in = req.getInputStream();
 listener = new TestReadListener(actx);
 in.setReadListener(listener);

 listener.onDataAvailable();
 }
}

My question is why does the test call "listener.onDataAvailable()" at the end?

In regards to the "onDataAvailable()" method, Section 3.7 of the spec says…

"The onDataAvailable method is invoked on the ReadListener when data is available to read from the incoming request stream. The container will invoke the method the first time when data is available to read. The container will subsequently invoke the onDataAvailable method if and only if isReady method on ServletInputStream, described below, returns false."

...which leads me to believe that the container should be calling onDataAvailable and not the servlet.

As a side note, my test works if I call "onDataAvailable()" from my test servlet. Otherwise it fails and times out.

+2 votes

I'm receiving the following exception:

java.net.SocketException: "Permission denied": connect

when instantiating a Socket from a servlet:

final Socket smtpSocket = new Socket(mailTransportHost, mailTransportPort);

This application was running as a service under Windows Server 3003 R2 32-bits. After migrating it to Windows Server 2008 R2 64-bit, I cannot longer establish connection with the smtp server.

This only happen when running Tomcat as a service. Running as a standalone (starting it up using startup.bat) works fine. No exception instantiating Socket, emails are sent.

Environment:

 - Windows Server 2008 R2 64-bit
 - Tomcat 7.0.39
 - jdk1.6.0_33-x64
+1 vote

I am trying to generate static website based on dynamic site running on tomcat so I can take some load off my app servers.

A twist here is that we are serving different pages based on user location (Application has a logic that checks user IP and display content based on user location) and wondering is there a tool like wget that also accepts any locale?

...