• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3295
  • Last Modified:

eclipse with tomcat issues

My eclipse juno used to work perfect with tomcat 7 server. I ran many servlets and jsps until this afternoon. All of sudden I keep seeing this kind of error now

Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.


Please advise on how to fix this issue. I tried to install jboss 7 but eclipse server set up configuration has until jboss 5 only. I installed jboss 5 when i tried to start it is also giving errors. Please advise. Any links, ideas, resources highly appreciated. Thanks in advance
0
gudii9
Asked:
gudii9
  • 11
  • 6
  • 5
  • +2
3 Solutions
 
gudii9Author Commented:
when i try to start tomcat7 server it keep on giving below error

Jan 28, 2013 5:18:55 PM 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:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files\Roxio\OEM\AudioCore\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\softwares\eclipse juno new\eclipse-jee-juno-SR1-win32\eclipse;;.
Jan 28, 2013 5:18:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ServletProject' did not find a matching property.
Jan 28, 2013 5:18:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 28, 2013 5:18:56 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 28, 2013 5:18:56 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1489 ms
Jan 28, 2013 5:18:56 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 28, 2013 5:18:56 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
Jan 28, 2013 5:18:57 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ServletProject]]
      at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
      at java.util.concurrent.FutureTask.get(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ServletProject]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      ... 7 more
Caused by: java.lang.IllegalArgumentException: The servlets named [com.gp.java.InitParamServlet] and [com.gp.java.ParameterNameReqSessionContext] are both mapped to the url-pattern [/ParameterNameUP] which is not permitted
      at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
      at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2412)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2125)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2080)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)
      at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1300)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
Jan 28, 2013 5:18:57 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
      at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
      at java.util.concurrent.FutureTask.get(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
      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.start(Bootstrap.java:322)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
Jan 28, 2013 5:18:57 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
      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.start(Bootstrap.java:322)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
      at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 11 more
Jan 28, 2013 5:18:57 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1031 ms
0
 
Sathish David Kumar NArchitectCommented:
I think this problem because of servlet.jar, The servlet.jar floating around somewhere in your CLASSPATH, it shouldn't be. This really messes up the classloaders since Tomcat's classloaders don't act quite as normal.

Servlet.jar should only be found only once in $CATALINA_HOME/lib
0
 
Sathish David Kumar NArchitectCommented:
remove other place servlet.jar 's
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
srikoteshCommented:
in some scenarios tomcat didnt start with in 45seconds it requires some more time in that case we need increase timeout if u are running tomcat server inside the eclipse please do the things to increase the server time
goto servers open the server( Tomcat v6.0 Server at localhost.server) double click on it , one window will be opened go to timeout tab increase the time up to 300 secs ans run it
0
 
gudii9Author Commented:
i increased to 120 seconds that did not help. Let me try 300 as well
0
 
ValeriCommented:
it's not because of the timeout setting, there is something wrong with your Tomcat! Did you do anything else before tomcat stoped working?
My advice is to remove tomcat from Eclipse and to setup it again.
Also chek this in order to be sure that there are no problems with servlet api:
http://tech.amikelive.com/node-269/eclipse-quick-tip-resolving-error-the-import-javaxservlet-cannot-be-resolved/
0
 
gudii9Author Commented:
i installed myeclipse trial version. That has built in tomcat server that is working perfect. Please advise
0
 
gudii9Author Commented:
>>Did you do anything else before tomcat stoped working?

i do not remember doing anything wrong.

>> i removed tomcat from eclipse many times and tried to point to new tomcat download still the error exists.

I even changed the eclipse from juno to helios version and freshly configured tomcat then also error coming. I spent many hours with this issue but no solution yet. Please advise
0
 
Sathish David Kumar NArchitectCommented:
>>>>>@gudii9
 
Have you tired my suggestion .

your web application and tomcat both are having servlet.jar  so that only its give the problem .

Try to remove your servlet.jar in your web applicaion it will work .
0
 
ValeriCommented:
another possible reason is the ports used by tomcat to be busy, but the only reason for that is "ports are still in use by tomcat itself", so I know it sounds stupid, but try to restart your PC and then try again...
0
 
gudii9Author Commented:
how to uninstasll tomcat. I just removed tomcat from eclipse server view. Downloaded new tomcat server dump from internet. Configured in eclipse with new tomcat server dump url. Do i need to do something different to uninstall, install tomcat, link with eclipse. please advise
0
 
ValeriCommented:
No. it's not a problem to have two different versions of tomcat installed. it's important which one you have configured in Eclipse.
0
 
Sathish David Kumar NArchitectCommented:
component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ServletProject]]
      at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
      at java.util.concurrent.FutureTask.get(Unknown Source)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

Open in new window


your servlert miss match only 2 servlet are confilt  ...
0
 
gudii9Author Commented:
i searched n servlet.jar on my entire C drive. I found followig entries as in the attachment. I am not able to understand where is the conflict. Please advise
servletJAr.jpg
servletJAr2.jpg
0
 
Sathish David Kumar NArchitectCommented:
it will in that same name other postfix. like servlet-API.jar.

Go to your in lib folder in eclispe. you can find there servelt-api.jar or servelt 3.jar some name like that (servler*.jar) . you can delete that one  thats it .

* is some  postfix .

you can see your screen shot all tomcat have servlet.jar 's (servlet-api.jar) . if web also have same  jar that time tomcat doesnt know which one to load .  so its giving error
0
 
Sharon SethCommented:
I would suggest , just remove your application (war or whatever) from deployments or staging folder and try to start tomcat . I believe the problem is with your app , not with the server.

Is this your class ? com.gp.java.InitParamServlet?
0
 
gudii9Author Commented:
I searched on servlet*.jar. I found followin entries as in attachment. I do not see duplicate servlet jar in web content or web-inf lib directory

I removed the application. then when i start tomcat tomcat is starting fine. when i add the web project and restart the tomcat server then server is not starting with timeour error. Please advise
0
 
gudii9Author Commented:
I have removed all the jars in

C:\Users\ganesha\eclipseJuno_workspace\SimpleWebProject\WebContent\WEB-INF\lib


Now I see errors in the project as in the attachments. Please advise
junkjars.jpg
ErrorAfterRemovingJarsIWebLib.jpg
0
 
Sharon SethCommented:
See , as I said the problem is with your app ,not with the server . You have not yet answered my other question : com.gp.java.InitParamServlet - is this your class?
0
 
gudii9Author Commented:
yes. that is one of the servlet in the SimpleWebProject as attached.Now itisnot getting reference toservlet jars as in the attachment. Ia m attaching the code for that servlet for referece.


package com.gp.java;
 
import java.io.IOException;

import java.io.PrintWriter;
import java.util.Enumeration;
 
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;




 
@WebServlet(description = "ParameterName desc", urlPatterns = { "/ParameterNameUP" }
    //       initParams={@WebInitParam(name="defaultUser", value="g p")}

,initParams = {
            @WebInitParam(name="defaultUser", value="value1")
            }
)


/*
@WebServlet(
name = "WebInitParamExample", urlPatterns = {"/hello"}
,initParams = {
@WebInitParam(name= "Site :", value="http://roseindia.net"),
@WebInitParam(name= "Rose", value= "India"),
}
)*/

public class InitParamServlet extends javax.servlet.http.HttpServlet implements
        javax.servlet.Servlet {
 
    public InitParamServlet() {
        super();
    }
 
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {/*
         
        PrintWriter pw = response.getWriter();
 
                //
                // Let's obtains parameters name here!
                //
        Enumeration enumeration = request.getParameterNames();
        while (enumeration.hasMoreElements()) {
            String parameterName = (String) enumeration.nextElement();
            pw.println("Hello Parameter = " + parameterName);
        }
        pw.close();
    */
          
    response.setContentType("text/html");
    PrintWriter writer=response.getWriter();
    String userName=request.getParameter("name");
    HttpSession session=request.getSession();
   
    ServletContext context= request.getServletContext();
   
    if( userName!="" & userName != null){
          session.setAttribute("savedUserName", userName);
          context.setAttribute("savedUserNamec", userName);
    }
   
    writer.println("Hellllooo request"+userName);
    writer.println("Hellllooo session"+(String)session.getAttribute("savedUserName"));
    writer.println("Hellllooo context"+(String)context.getAttribute("savedUserNamec"));
    writer.println("Hellllooo init param has default value of"+getServletConfig().getInitParameter("defaultuser"));
 //   this.getServletConfig().getInitParameter("defaultuser");
   
   
   
    }
 
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
    }
}

0
 
Sathish David Kumar NArchitectCommented:
commans-logging.jar  is import for web apps .

you need to remove servlet-api.jar only ..

Can you show me

what are all jar avaliable in

C:\Users\ganesha\eclipseJuno_workspace\SimpleWebProject\WebContent\WEB-INF\lib
0
 
Sharon SethCommented:
@gudii9 ,

The problem is very clear from your stack trace . The problem is not with the jars , but with your app . Unless and until you fix this , you won't get out of this .

Caused by: java.lang.IllegalArgumentException: The servlets named [com.gp.java.InitParamServlet] and [com.gp.java.ParameterNameReqSessionContext] are both mapped to the url-pattern [/ParameterNameUP] which is not permitted
0
 
gudii9Author Commented:
ParameterNameReqSessionContext code looks like below

package com.gp.java;
 
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
 
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
 
@WebServlet(description = "ParameterName desc", urlPatterns = { "/ParameterNameUP" })
 //          initParams={@WebInitParam(name="defaultUser",value="g p")}
public class ParameterNameReqSessionContext extends javax.servlet.http.HttpServlet implements
        javax.servlet.Servlet {
 
    public ParameterNameReqSessionContext() {
        super();
    }
 
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {/*
         
        PrintWriter pw = response.getWriter();
 
                //
                // Let's obtains parameters name here!
                //
        Enumeration enumeration = request.getParameterNames();
        while (enumeration.hasMoreElements()) {
            String parameterName = (String) enumeration.nextElement();
            pw.println("Hello Parameter = " + parameterName);
        }
        pw.close();
    */
          
    response.setContentType("text/html");
    PrintWriter writer=response.getWriter();
    String userName=request.getParameter("name");
    HttpSession session=request.getSession();
   
    ServletContext context= request.getServletContext();
   
    if( userName!="" & userName != null){
          session.setAttribute("savedUserName", userName);
          context.setAttribute("savedUserNamec", userName);
    }
   
    writer.println("Hellllooo request"+userName);
    writer.println("Hellllooo session"+(String)session.getAttribute("savedUserName"));
    writer.println("Hellllooo context"+(String)context.getAttribute("savedUserNamec"));
   
   
   
    }
 
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
    }
}


web.xml looks like below
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SimpleWebProject</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>xmlServlet</servlet-name>
    <servlet-class>com.gp.java.XmlServlet</servlet-class>
    <init-param>
      <param-name>default value</param-name>
      <param-value>sai</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>xmlServlet</servlet-name>
    <url-pattern>/xmlServletPath</url-pattern>
  </servlet-mapping>
</web-app>



i wonder what it means

Caused by: java.lang.IllegalArgumentException: The servlets named [com.gp.java.InitParamServlet] and [com.gp.java.ParameterNameReqSessionContext] are both mapped to the url-pattern [/ParameterNameUP] which is not permitte

i removed both the servlets. now it started fine.

I could not understand what went wrong.What fixed the problem after removing both servlets. Please advise
0
 
Sharon SethCommented:
I believe you cannot have two servlets mapping to the same URL pattern . Not sure why you would want that practically . Even if your container allows that , you can't say which servlet  gets the request
0
 
gudii9Author Commented:
oh i  see. init-param is specific to one servlet as per web.xml




<servlet>
    <servlet-name>xmlServlet</servlet-name>
    <servlet-class>com.gp.java.XmlServlet</servlet-class>
    <init-param>
      <param-name>default value</param-name>
      <param-value>sai</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>xmlServlet</servlet-name>
    <url-pattern>/xmlServletPath</url-pattern>
  </servlet-mapping>


But inside my two problematic servlets where i am referring above init-param related code. Please advise
0
 
Sharon SethCommented:
Just do a txt search on your project and you will see it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 11
  • 6
  • 5
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now