Cant deploy artifact in Tomcat 7
Hello.
I'm using IDEA 12 and I'm working on the most basic project setup possible. I'm having 2 classes in my project and a simple artifact setup (exploded web app) which seems to work when I copy it to the webapps directory in the Tomcat installation.
The problem is that when I try to deploy the same artifact through a run configuration in IDEA, it doesnt work. The log console states that the deployment was succesfull but the artifact never moves to the tomcat directory.
Also, the connection to Tomcat seems to be working as expected.
Any ideas on what I'm doing wrong?
Please sign in to leave a comment.
It's by design, artifacts are deployed directly from the output directory saving the extra copy operation to Tomcat webapps, see http://stackoverflow.com/a/13862350/104891 for details.
Ok that sounds reasonable.
I still cant access my application through the tomcat url though. (for example http://localhost:8000/appname).
Did you specify /appname as the context in the Run configuration deployment tab?
Tomcat log should contain something like this:
INFO: Server startup in 30 ms
Connected to server
[2012-12-14 06:51:52,601] Artifact Tomcat:war exploded: Artifact is being deployed, please wait...
[2012-12-14 06:51:52,809] Artifact Tomcat:war exploded: Artifact is deployed successfully
Tried both (having the context as root and as the app's name) but I still get a 404.
One thing I'm doing different is that I'm not having a war as an artifact target. I use the exploded app. But copying that to the webapps folder of tomcat works great.
My sample also uses exploded configuration and works just fine. Can you try it? Make sure you are using default Tomcat installation and do not override CATALINA_BASE: https://dl.dropbox.com/u/2752840/ShareXmod/2012-12/tomcat-sample.zip.
I didnt get what you're saying about CATALINA_BASE so apologies if thats the problem. any more info on this?
your project doesnt work either. I'm pasting what the log contains.
14 Δεκ 2012 3:13:32 μμ org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Windows\SysWOW64;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\bin\..\.\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Java6\jre\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;c:\program files (x86)\jetbrains\intellij idea 12.0\jre\jre\bin;.
14 Δεκ 2012 3:13:33 μμ org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8000"]
14 Δεκ 2012 3:13:33 μμ org.apache.coyote.AbstractProtocol init
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8000"]
java.net.BindException: Address already in use: JVM_Bind <null>:8000
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:406)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:610)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:429)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
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 org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:393)
... 17 more
14 Δεκ 2012 3:13:33 μμ org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8000]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8000]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:983)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 12 more
Caused by: java.net.BindException: Address already in use: JVM_Bind <null>:8000
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:406)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:610)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:429)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
... 13 more
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 org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:393)
... 17 more
14 Δεκ 2012 3:13:33 μμ org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-65032"]
14 Δεκ 2012 3:13:33 μμ org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1217 ms
14 Δεκ 2012 3:13:33 μμ org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
14 Δεκ 2012 3:13:33 μμ org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.34
14 Δεκ 2012 3:13:33 μμ org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-65032"]
14 Δεκ 2012 3:13:33 μμ org.apache.catalina.startup.Catalina start
INFO: Server startup in 73 ms
Connected to server
[2012-12-14 03:13:33,685] Artifact Tomcat:war exploded: Artifact is being deployed, please wait...
[2012-12-14 03:13:34,249] Artifact Tomcat:war exploded: Artifact is deployed successfully
14 Δεκ 2012 3:13:43 μμ org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory E:\Development\ApacheTomcat\webapps\manager
Your Tomcat is configured to run on port 8000 that is already taken by some other process, use TcpView to verify or change the port in conf/server.xml.
hmmmm... tcpview shows no process bound to 8000 but I tried changing the configuration anyway. still doesnt work. :S
Your firewall may block binding to port 8000.
ok I found whats wrong. The service was manually started and I had no clue that IDEA trys to start it so it must be stopped.
thanks for the help.
I have encountered the same problem as you were when I am using Intellij idea 13.1.4 on a Mac. Solution could be found on http://stackoverflow.com/questions/24088924/solution-to-java-net-bindexception-address-already-in-use-error. I try that solution and solve the problem. The message on the output window "artifacts have been successfully deployed" is really confusing. It drives me mad finding problems elewhere instead of focusing on the error message "Address already in use".
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use: JVM_Bind <null>:8080
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
error occurs when running the Tomcat service, if the service is stopped all work, checked by the example https://dl.dropbox.com/u/2752840/ShareXmod/2012-12/tomcat-sample.zip.Interesting to know why?