0

I'm try to deploy a java application with netbeans and tomcat8. When I click debug I get the exception in "Apache Tomcat or TomEE" tab:

java.io.FileNotFoundException: /usr/share/tomcat8/conf/Catalina/localhost/transactionsApp.xml (Permiso denegado)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.apache.catalina.manager.ManagerServlet.copyInternal(ManagerServlet.java:1607)
    at org.apache.catalina.manager.ManagerServlet.copy(ManagerServlet.java:1570)
    at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:867)
    at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:335)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:618)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

The problem is that user runs netbeans does not have permissions to write to /usr/share/tomcat8/conf/Catalina/localhost so I tried to run netbeans from console: sudo /usr/local/netbeans/8.0.2/bin/netbeans and then the deploy works fine!

There is another way to do the deploys with netbeans and tomcat? I don't want to run netbeans always from console with sudo.

5
  • 2
    Move your tomcat installation to a path where your current user has enough privileges. Commented Aug 12, 2015 at 15:08
  • What do you mean with "Move your tomcat installation"? Should I cut and paste /usr/share/tomcat8 to, lets say, my home folder? Commented Aug 12, 2015 at 15:13
  • Exactly. Makes your life easier. Commented Aug 12, 2015 at 15:15
  • That is great! When I moving the folder, should I re-configure something? Commented Aug 12, 2015 at 15:19
  • 1
    So if you don't want to use sudo (which is good!), then why not give permissions to the specific user or better yet through a group to actually be allowed to write in said log folder? If you use Linux, better learn to use Linux. linux.com/learn/tutorials/… Commented Aug 12, 2015 at 15:49

1 Answer 1

1

Some distributions (e.g. Ubuntu/Debian) have per-user Tomcat packages that symlinks binaries to the /usr/share ones but otherwise allow each user full write access to the config and working directories.

See https://help.ubuntu.com/12.04/serverguide/tomcat.html#tomcat-user

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.