Servlet + Tomcat NoClassDefFoundError

Hi,
I am developing a servlet which takes data from Amazon's Web services (in XML format) and then outputs a RSS feed. I use xerces for parsing the XML and then use Rome to output the RSS feed. When I run the servlet then I get the following error.
However when I run the same code over the commandline, it runs fine, however running it as a servlet, it shows the NoClassDefFoundError . I am also sending the code , it contains the commented out System.out statements which I use when I am running it over the command line
Thanks
Gaurav
javax.servlet.ServletException: Invoker service() exception
     at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:524)
     at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
     at java.lang.Thread.run(Thread.java:536)
root cause
java.lang.NoClassDefFoundError
     at form_input.doPost(form_input.java:84)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:466)
     at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
     at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
     at java.lang.Thread.run(Thread.java:536)
The Code:
//JAXP 1.1
import org.w3c.dom.*;
import org.w3c.dom.Document;
import javax.xml.parsers.*;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.DOMImplementationImpl;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.util.Vector;
import org.apache.xerces.jaxp.*;
import org.apache.xerces.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.parsers.*;
//import org.apache.xml.serialize.*;
import org.xml.sax.*;
import com.sun.syndication.feed.synd.*;
import com.sun.syndication.io.SyndFeedOutput;
import com.sun.syndication.io.FeedException;
import java.io.IOException;
import java.text.ParseException;
import java.io.FileWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class form_input extends HttpServlet
private static final DateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd");
     public void doGet(HttpServletRequest request, HttpServletResponse response)
                         throws IOException, ServletException
          doPost(request,response);
     public void doPost(HttpServletRequest request, HttpServletResponse response)
                         throws IOException, ServletException
response.setContentType("text/xml");
          PrintWriter out = response.getWriter();
          URL data = new URL("http://xml.amazon.com/onca/xml3?t=myWebsite-20&dev-t=1RX5WFR818MJJAEN8A02&KeywordSearch=dogs&mode=books&type=lite&page=1&f=xml");
          URLConnection connection = data.openConnection();
          connection.setUseCaches(false);
Document doc= null;
          NodeList DetailList = null;
          NodeList DetailChildren = null;
          Node Detail = null;
          Node DetailChild = null;
          Node ChildValue = null;
          DOMParser dparsers = new DOMParser();
          List entries = new ArrayList();
          SyndFeed feed = new SyndFeedImpl();
          SyndEntry entry;
          SyndContent description;
          SyndFeedOutput output = new SyndFeedOutput();
          try
               feed.setFeedType("rss_1.0");
               feed.setTitle("Amazon search for dog");
feed.setLink("http://www.amazon.com");
feed.setDescription("Amazon search results for dogs");
               dparsers.parse(new InputSource(connection.getInputStream()));
               doc = dparsers.getDocument();
               DetailList = doc.getElementsByTagName("Details");
               for( int i=0; i<DetailList.getLength(); i++)
                    Detail = DetailList.item(i);
                    DetailChildren = Detail.getChildNodes();
                    entry = new SyndEntryImpl();
                    for( int j=0; j<DetailChildren.getLength(); j++)
                         //Iterate through each of the children and start filling out the RSS thingie
                         //Gotta extract Asin, ProductName, ReleaseDate, Manufacturer, Authors -> Author
                         DetailChild = DetailChildren.item(j);
                         if(DetailChild.getNodeName().equals("Asin"))
                              //if(DetailChild.hasChildNodes())
                              //     System.out.println(DetailChild.getNodeName() + " has child nodes");
                              ChildValue = DetailChild.getFirstChild();
                              //System.out.println(DetailChild.getNodeName()+ " type = "+DetailChild.getNodeType()+" value="+ChildValue.getNodeValue());
                              entry.setLink("http://www.amazon.com/exec/obidos/ASIN/"+ChildValue.getNodeValue());
                              //System.out.println("Match found for Asin");
                         else if(DetailChild.getNodeName().equals("ProductName"))
                              ChildValue = DetailChild.getFirstChild();
                              //System.out.println(DetailChild.getNodeName()+ " type = "+DetailChild.getNodeType()+" value="+ChildValue.getNodeValue().length());
                              if(ChildValue.getNodeValue().length() > 100 )
                                   entry.setTitle(ChildValue.getNodeValue().substring(0,100));
                              else
                                   entry.setTitle(ChildValue.getNodeValue());
                              //System.out.println("Match found for ProductName");
                         else if(DetailChild.getNodeName().equals("ReleaseDate"))
                              ChildValue = DetailChild.getFirstChild();
                              //System.out.println(DetailChild.getNodeName()+ " type = "+DetailChild.getNodeType()+" value="+ChildValue.getNodeValue());
                              //System.out.println("ReleaseDate: "+DetailChild.getNodeValue());
                              //entry.setPublishedDate(DATE_PARSER.parse(DetailChild.getNodeValue()));
                              entry.setPublishedDate(DATE_PARSER.parse("2004-07-07"));
                              //System.out.println("Match found for ReleaseDate");
                         else if(DetailChild.getNodeName().equals("Manufacturer"))
                              ChildValue = DetailChild.getFirstChild();
                              //System.out.println(DetailChild.getNodeName()+ " type = "+DetailChild.getNodeType()+" value="+ChildValue.getNodeValue());
                              description = new SyndContentImpl();
                              description.setType("text/plain");
                              description.setValue("Initial release of Rome");
                              entry.setDescription(description);
                    entries.add(entry);
               feed.setEntries(entries);
               String fxml = output.outputString(feed);
               out.println(fxml);
          catch (ParseException ex) {
// IT CANNOT HAPPEN WITH THIS SAMPLE
ex.printStackTrace();
out.println("ERROR: "+ex.getMessage());
          catch( SAXException se)
               se.printStackTrace();
out.println("ERROR: "+se.getMessage());
          catch (Exception ex) {
ex.printStackTrace();
out.println("ERROR: "+ex.getMessage());

Hi,
I am building the servlet for now in
$TOMCAT_HOME/webapps/examples/WEB-INF/classes ,
however there is no 'lib' directory in
$TOMCAT_HOME/webapps/examples/WEB-INF . I created one
and put the jar files there, but still I get the same
error. Infact when I start the server, I do not see
the jar file in CLASSPATH
Thanks
GauravYou shouldn't be putting your app in the examples directory.
You should create a directory under TOMCAT_HOME/webapps for YOUR individual apps. Each one should have a WEB-INF directory under that, and /classes and /lib under that. Your web.xml belongs in the WEB-INF directory. Your .class files, and their package directories, belong under WEB-INF/classes. 3rd party JARs, like JDBC drivers, belong in WEB-INF/lib.
The problem is that you don't know how to deploy a Web app properly on Tomcat.

Similar Messages

  • Servlet tomcat

    I create a subfolder of webapps named ANDREA and three subfolders of this with suorces files. down WEB-INF I put the folder class with other subfolders with the .class files, and the web.xml. I put a tag context into server.xml:
    I start file index.jsp and all is ok when I call my servlet HelloWorld.class , the result is
    Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Error allocating a servlet instance
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:659)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 214)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    a t org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:102 7)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125) at java.lang.Thread.run(Thread.java:479)
    root cause
    java.lang.NoClassDefFoundError: servlet/IndexServlet (wrong name: IndexServlet)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoade r.java:1643)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:9 37)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1 372)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1 254)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:867)& lt; BR> at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 214)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    a t org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:102 7)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125) at java.lang.Thread.run(Thread.java:479)
    help me please
    sorry for my english but i'm Italian......Forza Roma

    there is a conflict here, 404 is an HTTP error , and should be returned to the user when the resource(request url) is not found on the server , this is not related to Java or any server technology , just HTTP.
    In java servers , any error occures during processing (inside JVM) , an internal server error is returned .
    a servlet class doesnot correpsond to a url

  • JSP useBean and Tomcat NoClassDefFoundError

    Hi,
    I have a webapp on tomcat whose structure is like this
    /tomcat
    --/webapps
    ----/mywebappname
    ------/WEB-INF
    --------/classes
    ----------MyBean.java
    When I use useBean class="MyBean" I get a NoClassDefFoundError for this particular class.
    I suspect this is some kind of classpath issue but do not know how to fix it. Help appreciated.

    place u'r class file in <tomcat-root>/classes folder.
    if there's no such folder ,u'll have to create it.

  • Error (Unsupported major.minor version 49.0) in Servlet - Tomcat 5.0.19

    Hello,
    I am completely new to developing java web applications and I dealing with some very strange behavior. I am simply trying to run tomcat through a tomcat plugin for debugging purposes. When I start tomcat via the command line my application runs fine. When I start tomcat via the eclipse plugin, the server starts without any errors, however when I try to access certain pages via web browser I receive the error
    javax.servlet.ServletException: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
         org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
         org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
         java.lang.ClassLoader.defineClass0(Native Method)
         java.lang.ClassLoader.defineClass(Unknown Source)
         java.security.SecureClassLoader.defineClass(Unknown Source)
         java.net.URLClassLoader.defineClass(Unknown Source)
         java.net.URLClassLoader.access$100(Unknown Source)
         java.net.URLClassLoader$1.run(Unknown Source)
         java.security.AccessController.doPrivileged(Native Method)
         java.net.URLClassLoader.findClass(Unknown Source)
         org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoader.java:520)
         org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:857)
         org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:756)
         java.lang.ClassLoader.loadClassInternal(Unknown Source)
         java.lang.Class.forName0(Native Method)
         java.lang.Class.forName(Unknown Source)
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.doesModernCompilerExist(CompilerAdapterFactory.java:174)
         org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:132)
         org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:969)
         org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:799)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:390)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
         org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:254)
         org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:309)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    I realize this is occurring due to java version issues however I cannot understand why simply running tomcat via the eclipse plugin causes this since the jvm settings all appear to be correct

    I'm seeing exactly the same thing with Tomcat 4.1 ---also new to Java, no idea how to go about fixing this.
    However, since you posted this in August and nobody has responded, it's not clear that this forum is going to be much use.
    Sigh

  • Problem with instaling servlet -Tomcat 4.01 -Win98

    Problem is in web.xml fajl
    I use
    <servlet>
    <servlet-name>name</servlet-name>
    <servlet-class>package.name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>name</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    Fajl are in webapps/xxx folder Then I start aplication it's work but there is no pictures. (I put them in webapps/xxx/pictures folder, and call them in servlet with img src=\"/xxx/pictures/picture1.gif"\)
    Thanks

    Hi,
    if I understand, you generate img tag from your servlet.
    But the img tag is evaluate by client (navigator), so the path must be relative to the servlet root :
    img src="pictures/xxx.jpg"
    if don't work, try ./pictures/xxx.jpg, but I think it work for Websphere, the first path should work under tomCat.
    Regards.

  • JSTL, Tomcat & NoClassDefFoundError

    Hi,
    I am having a little problem with JSTL on my web hosting companies server.
    My code works fine, until I put it on their server. I have copied their set up, ie. same version of java & tomcat onto my computer, and it still works fine here.
    The only difference is that they are using Linux.
    The error happens as soon as I insert a JSTL tag into a jsp page. ie:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html>
    <body>
      <c:out value="Hello" />
    </body>
    </html>The first time I get a VerifyError:
    java.lang.VerifyError: (class: org/apache/taglibs/standard/lang/jstl/JSTLVariableResolver, method: resolveVariable signature: (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;) Incompatible object argument for function call
    And on subsequent refreshes (until Tomcat is restarted) I get a NoClassDefFoundError:
    java.lang.NoClassDefFoundError:org/apache/taglibs/standard/lang/jstl/Evaluator
    Heres what I have done to attempt to resovle this so far:
    - Use the Java SDK not JRE
    - Put all the JSTL JARs into %TOMCAT_HOME%/common/lib
    - Edit my classpath to include the current dir (.) and JSTL's standard.jar
    - Then I added tools.jar & rt.jar to my classpath
    Well i'm still getting the errors, and I can't figure out why. From what over people have said on the forums, it might be a classpath error... but I can't see how, as i've added the stuff i'm sure it needs to the classpath!
    Any sugesstions will be greatly appriciated, I'm tearing my hair out!
    My set up:
    Tomcat v4.1.24
    Java SDK 1.3.1_06
    Linux on web hosting companies server, win2k on my machine
    Thank you!
    Mel

    Hi,
    I tried putting all the JSTL libraries in the WEB-INF/lib file, but it caused Tomcat to throw up loads of errors (in all set ups I tried) when it started. So by putting the JARs in common/lib I can avoid this. I did try your suggestion and just put the jstl.jar in WEB-INF/lib. It caused no errors on Tomcat startup, but didn't fix the problem either!
    The JSTL tld's are definetely in WEB-INF/tlds and the web.xml file has the correct entries in it.
    I suspect that it is a classpath error... or path.. or some kind of configuration like permissions or something.
    Confused!

  • Servlet, Tomcat 3.3, IIS virtual directory access denied

    Hello people,
    I've set up Tomcat to run as a service with a domain log on usr/pswd. IIS works fine redirecting servlet requests to Tomcat via ISAPI redirector. All on Windows 2000 Server.
    The problem:
    The java application creates and reads files from a location which corresponds to an IIS virtual directory and is also a local directory with respect to the Tomcat and IIS installation. The application is denied access to this directory when submitting a network path (\\server/drive/directory/) where to store and read files, but is happy when a local path is given instead (E:/) Why? The domain user should have complete access to this. Is it Tomcat, IIS, or java restrictions?
    I appreciate any suggestion on this
    Thanks

    The problem would be with the logon that you have Tomcat running under. Writing to a file accessed by network share (\\server\share) is not a problem under Java as long as the logon has appropriate privileges. If you are writing to something of the form \\server\c$\directory, as it sounds like you might be, the logon may need administrator access to the box (in order to see \\server\c$).

  • Servlet/Tomcat using HTTPsUrlConnection error

    Hello all,
    I am fairly new to java/tomcat and am attempting to develop an SSO connection. When I get to the following line of code in my servlet
    HttpsURLConnection httpConn = (HttpsURLConnection)sso.openConnection();
    I receive the following error:
    SingleSignOn threw exception
    java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
    Any help is much appreciated.
    Regards,
    --Omar
    Edited by: user7041419 on Nov 17, 2010 3:26 PM

    Yes that is one of the issues I have. Thanks for the assistance.

  • Running HelloWorld Servlet--Tomcat 4.1

    Dear Sir,
    With most humble submission I would like to inform you that I have recently downloaded Tomcat 4.1 from http://jakarta.apache.org/ and installed it on Windows 98. I am using jdk1.3
    I am an amateur for Java Servlets. I am following the instructions given in the book "Java Servlet Programming" by O'reilly and according to this book I have to store my class files(I tried with HelloWorld.class) in the dir server_root/webapps/root/web-inf/classes dir. but when i called it from microsoft internet explorer 5.0(the browser i am using currently) using the URL http://localhost:8080/servlet/HelloWorld
    I get the 404 error.
    I also tried to call a static file (.html) by storing it in the dir server_root/webapps/root(according to the book) and i get the proper output but not in case of .class file. Even the example codes provided with the server do not run.
    Please help me to fix out my problem.
    Thanking you in anticipation,
    Yours sincerely
    roopesh

    Hi:
    1)You need set classpath
    2) do you open your Tomcat?
    Thank

  • Initiating servlet Tomcat 4.0

    Hi,
    I have servlet that worked fine when I was
    using tomcat 3.2.2 and 3.2.3 but now when
    I upgraded to tomcat 4.0 the entire server crashes
    while initiating my servlet.
    The servlet throws an exception when I call
    getServletConfig or getServletContext.
    Anybody had similar problems ?
    I am runninng Tomcat 4.0 on Windows 2000 with java 1.3.
    /guha

    Correction, the server does not crash, but the servlet throws an exception
    while executing the init section of the servlet. the error message from
    this exception is null. My init looks like this,
    the exception is thrown while executing the first two lines
    in the init method
    try
    props = new ServletProperties(getServletConfig());
    ServletContext context = this.getServletContext();
    errorHandler = new ErrorHandler(context,props);
    dbConn = new DBStateHolder(errorHandler,props);
    dbConn.createConnectionCache();
    catch (Exception ex)
    System.err.print("Error initiating servlet: " + ex.getMessage());

  • Error (Unsupported major.minor version 49.0)  in Servlet - Tomcat 4.1

    Hello,
    I have got below error when i have run web application with JSP,Servlet,beans:
    I have used Tomacat 4.1, 5.0 and 5.9.No change ???
    I am using j2sdk1.4.2_03 and j2re1.4.2_03.
    This is the complete project i want to run in my PC
    when i extract .war file and run on my PC it's generate below error :
    This is urgent For me . PLEASE HELP
    ERROR :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Error allocating a servlet instance
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:672)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.UnsupportedClassVersionError: com/innovapark/soar/jsp/index_jsp (Unsupported major.minor version 49.0)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1679)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:968)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1409)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:885)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:536)
    Apache Tomcat/4.1.30
    Thank You
    Neon

    Solved
    Just do these things.... If you initially complied your classes in jdk1.5 and if u r trying to run the same in 1.4.2 or other.. The already compiled classes will be expecting jdk 1.5 JRE for their runtime execution. So what u have to do is......
    1.stop ur sever
    2.delete the work directory in tomcat
    3.Delete the work directory in your projects web-app Folder
    4.Now cleann the project... Build... and Run Again ... . It should work...
    if still it dont , i prefer use only jdk1.4.2 on system.. set enviorment variebles for it...Reinstall tomcat .. and do above mentioned steps ,,, This should solve the problem...
    Message was edited by:
    sunildm4u

  • Jsp   /   servlet   /   tomcat

    hi,
    I am using tomcat server. The servlet uses Process class of java.
    i.e.
    Runtime.getRuntime.exec...
    Now what happens is that, when many clients are using the system at the same time the output they receive gets mixed up.
    e.g.
    user1: print - "this is user one" , receive - "this is user two"
    user2: print - "this is user two" , receive - "this is user one"
    Since tomcat takes care of multi-threading and so there should not be any overlap. Is it possible that it is the that the process created may be causing such a mixup?
    I am really confused about this please help.

    thank you for the reply
    "You need to do copying the output and timing out on separate threads. I would probably farm out the copying process to a thread."
    any idea how to do that?
    This program was handed down to me by someone.... there are many errors in it... and the cause of some which has been mysterious to me so far.
    I have started doing the unit testing... and the first problem i have found where the system outs seem to repeat (i.e. the userids repeat) is the compilation part... i dont know how to solve it
    //servlet
                if(lang.equals("C") || lang.equals("P")){
                    C_Interpreter c_interpreter = new C_Interpreter();
                    c_interpreter.JudgeEngine(lang, countFileUploaded, inputUserInfo.getModfBy(), submInfo.getCourCode(), submInfo.getProbNum(), probInfo.getNumTCTesting(), Integer.parseInt(probInfo.getExpRunTime()), "T");
    //c_interpreter
        public void JudgeEngine(String lang, int intNFU, String CurrentUserID, String CourCode, String ProbNum, int testcase, int expRunTime, String testingMode){
            String compileError = Compilation(lang, intNFU, CurrentUserID, CourCode, ProbNum, testcase, expRunTime, testingMode);
        public String Compilation(String lang, int intNFU, String CurrentUserID, String CourCode, String ProbNum, int testcase, int expRunTime, String testingMode){
            try{
                Runtime rt = Runtime.getRuntime();
                Config config1 = new Config();
                String tempProgStore = "";
                String sampleOutputStore = config1.readKeyValue("online.storagepath")  + "\\" + CourCode + "\\" + ProbNum;
                if(testingMode.equals("T")){ //T is the testing mode being used
                    tempProgStore = sampleOutputStore + "\\" + CurrentUserID + "\\temp";
                }else if(testingMode.equals("S")){
                    tempProgStore = sampleOutputStore + "\\" + CurrentUserID;
                File dir = new File(tempProgStore + "\\");
                String compPath = config1.readKeyValue("onlinejudge.cppCompPath");  //Java Compile Path --- nmake
                Process rd_mak = null;
                Process compileProcess = null;
                rd_mak = rt.exec("cmd /c dir /b " + tempProgStore + "\\*.mak > " + tempProgStore + "\\makname.txt");
                fo.WaitOper(rd_mak);
                LinkedList fileNameList_mak = fo.createFileList(tempProgStore + "\\makname.txt");
                String mak_file = "";
                    for(int i=0; i<fileNameList_mak.size(); i++){
                        mak_file = fileNameList_mak.get(i).toString();
                   compileProcess = rt.exec("cmd /c " + compPath + " " + mak_file + " > error_message.txt ", null, dir);
                   fo.WaitOper(compileProcess);
            }catch(Exception e){System.out.println("Error : "+e.getMessage());
            // i have done modifications here because after this part its just file reading and writing
    --------------------

  • Midlet & Servlet(Tomcat) Connection

    I have built up a midlet that need to connect to the servlet which is hosted using Tomcat ...
    When i click the submit button in the mobile emulator ... i received the following message in the console of Java Wireless ToolKit .... What is the problem actually ? .... Can anyone give me some guides ?
    Any Helps will be appreciated
    "<html><head><title>Apache Tomcat/5.0.12 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - Servlet RequestServlet is not available</h1><HR size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> <u>Servlet RequestServlet is not available</u></p><p><b>description</b> <u>The requested resource (Servlet RequestServlet is not available) is not available.</u></p><HR size="1" noshade><h3>Apache Tomcat/5.0.12</h3></body></html>"
    The following is my midlet :
    public class SecondMidletServlet extends MIDlet implements CommandListener, Runnable {
    Display display = null;
    List menu = null;
    TextBox input = null;
    String user = null;
    String url = "http://pup.no-ip.net:8001/Servlet/RequestServlet";
    static final Command backCommand = new Command("Back", Command.BACK, 0);
    static final Command submitCommand = new Command("Submit", Command.OK, 2);
    static final Command exitCommand = new Command("Exit", Command.STOP, 3);
         StringBuffer b = new StringBuffer();
    String currentMenu = null;
         Thread thread;
    public SecondMidletServlet() {
    public void startApp() throws MIDletStateChangeException {
    display = Display.getDisplay(this);
    menu = new List("Invoke Servlet", Choice.IMPLICIT);
    menu.append("Add a user", null);
    menu.addCommand(exitCommand);
    menu.setCommandListener(this);
    mainMenu();
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    notifyDestroyed();
    void mainMenu() {
    display.setCurrent(menu);
    public void addName() {
    input = new TextBox("Enter first name:", "", 5, TextField.ANY);
    input.addCommand(submitCommand);
    input.addCommand(backCommand);
    input.setCommandListener(this);
    input.setString("");
    display.setCurrent(input);
    void invokeServlet(String url) throws IOException {
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    //StringBuffer b = new StringBuffer();
    TextBox t = null;
    try {
    c = (HttpConnection)Connector.open(url);
                   if(c == null)
                        System.out.println("PKPK");
                   else
                        System.out.println("PSPS");
    c.setRequestMethod(HttpConnection.POST);
    c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
    c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
    c.setRequestProperty("Content-Language", "en-CA");
    os = c.openOutputStream();
    String str = "name="+user;
    byte postmsg[] = str.getBytes();
    System.out.println("Length: "+str.getBytes());
    for(int i=0;i<postmsg.length;i++) {
    os.write(postmsg);
    // or you can easily do:
    // os.write(("name="+user).getBytes());
    os.flush();
    is = c.openDataInputStream();
    int ch;
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    System.out.print((char)ch);
    } finally {
    if(is!= null) {
    is.close();
    if(os != null) {
    os.close();
    if(c != null) {
    c.close();
    //display.setCurrent(t);
         public void run()
              try
                   invokeServlet(url);
                   TextBox t = new TextBox("Second Servlet", b.toString(), 1024, 0);
                   t.addCommand(backCommand);
                   t.setCommandListener(this);
                   display.setCurrent(t);
              catch(Exception ex){}     
         public void refreshScreen(StringBuffer b)
              TextBox t = new TextBox("Second Servlet", b.toString(), 1024, 0);
              t.addCommand(backCommand);
              t.setCommandListener(this);
              display.setCurrent(t);
    public void commandAction(Command c, Displayable d)
    String label = c.getLabel();
    if (label.equals("Exit")) {
    destroyApp(true);
         else if (label.equals("Back")) {
    mainMenu();
         else if (label.equals("Submit"))
    user = input.getString();
    // try {
    //invokeServlet(url);
              thread = new Thread(this);
              thread.start();
              // catch(IOException e) {}
         else {
    addName();
    //Servlet side
    public class RequestServlet extends HttpServlet {
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    BufferedReader br = request.getReader();
    String buf = br.readLine();
              System.out.println("LSLS");
    out.print("Rec: "+buf);

    Hi,
    Since you use POST Method for the request, you have to implement the doPost(...) Method in the servlet, right? Do a simple implementation of the doGet(...) Method and call the Servlet using a browser. So you can easily check, whether the Servlet is available or not. You got the Error 404 which means, that the Servlet cant be found on the Tomcat. Make sure, that it is deployed correctly and your URL in the MIDlet is also correct.
    hth
    Kay

  • Why my servlet receives NoClassDefFoundError : javax/servlet/http/HttpSession

    I developed an application which has one servlet.
    The war context-root that has the servlet is 'workflowclient'.
    When invoking the servlet with URL "http://localhost/workflowclient/WfAgentManagerSRMIServlet, an exception with NoClassDefFoundException is raised.
    Why ?
    The fortune example operates well.
    Please let me know how to solve this problem.

    Hi,
    I would like to go through your code, if it isn't properietry, please send me the codes so that I can have a look and test at my end to provide you results.
    Thanks & Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • How to configure applet/servlet in Tomcat?

    I'm building a web application which is going to be deployed in Tomcat. I have an applet(called MYAPPLET here) which "calls" a servlet(called MYSERVLET here). I cannot figure out how to configure the whole thing.
    /test is my docbase. In /test I made a directory "applet classes" and a directory "servlet". The applet tag I use in the HTML file looks like this:
    <applet
    code="MYAPPLET.class"
    codebase="http://localhost:8080/test/applet classes/"
    <!-- Tell the applet where its peer is located -->
    <param
    name="servlet"
    value="http://localhost:8080/test/servlet/MYSERVLET" />
    </applet>
    Now, when opening the page, the applet can be found but Tomcat gives an error 404 saying that it can not find the servlet. On the other hand, If I make an entry in my web.xml (with url mapping
    <url-pattern>/test </url-pattern> or <url-pattern>/test/servlet </url-pattern>, depending on where I put MYSERVLET)
    for the servlet mentioned above and I put the MYSERVLET in either the WEB-INF/classes directory or in /test/servlet Tomcat gives an error 403. It refuses to connect to the servlet!
    Please can anyone help me. THanx in advance
    debeumers

    You are configuring Tomcat and if you have further questions then post new questions in the forum "Java Servlet Technology".
    Given that your servlet url is "localhost:8080/test/servlet/MyServlet"
    This assumes -
    1) You have created a web application called "test". You have a directory called "test" under- $CATALINA_HOME/webapps
    2) Your html files, jsp files, and subdirectory "applet-classes" (Note - do Not use spaces when naming directories) exist in this top level directory of your web app. If you choose to place your applet classes in this subdir then the codebase can be "applet-classes" - omitting the "/" means this directory is located relative to the current directory of the html file. (No jar files? No archive param then..)
    3) You have a class file called "MyServlet" located - $CATALINA_HOME/webapps/test/WEB-INF/classes
    Some versions of Tomcat require you to uncomment out the area of the Mapping for the Invoker Servlet element in $CAT_HOME/conf/web.xml.
    <servlet-name>invoker</servlet-name>
    <url-mapping>/servlet/*</url-mapping>
    Once this is done, you need not create a directory called "servlet" anywhere in your structure. It is the url mapping.
    You will want to apply url-patterns and mappings to your application specific web.xml (This is located in - $C_H/webapps/test/WEB-INF) when it comes time to deploy the app, but that is not required for testing and development. You need not make changes to the app specific web.xml at this time just to get the servlet to run.
    And finally I suggest you read a book on this subject...

Maybe you are looking for

  • Internal Order Down Payment settle to Asset

    Hi, I have a requirement related to Down Payment shows in Order. User want that if there is any down payment against purchase order & purchase order contain real order, they want that FBL1N/FAGLL03 report show Order Number in reports. So that down pa

  • How can I highlight a particular person in a video clip?

    I'm working on a project in iMovie that involves video clips of baseball games. There's a particular player that I'd like to highlight somehow; like place an arrow to point him out, or place a circle around him, etc. Does anyone know of a way to do t

  • Apple macbook 13.3" replace speakers cost?

    I need to replace the inbuilt speakers of my 13.3" macbook.It is out of warranty period. Can sum1 tell me how much shall I hav 2 pay for this???

  • Routing-Sequences Error in co11n

    Dear all, Can any one please share the screen shots how to process the sequences in routing I have tried by using help portal but i dint get any differences on that. While confirming in co11n,that particular sequences also not get displayed in sequen

  • Failed to update please check your internet connection and try again later

    every time I try to run a program that I have downloaded (like Trend Micro) or update my Comodo Internet security I get an error message failed to update please check your internet connection and try again later and I am connected to the internet I'v