Compiling a Servlet that uses JavaBean

I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
--------------------Configuration: JDK version 1.3 <Default>--------------------
Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
symbol : class SimpleBean
location: class MyPackage.SimpleBean
     SimpleBean simpleBean = (SimpleBean) session.getAttribute
^
("simpleBean");
C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
symbol : class SimpleBean
location: class MyPackage.SimpleBean
     SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
^
2 errors
Process completed.
Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

Looks like an import Problem.
The Compiler is not able to "see" the SimpleBean Class.
Take care of the Classpath and your imports.
Happy Coding. :-)

Similar Messages

  • Example Servlets that use JAXM?

    OK, maybe I missed a chapter in the JWSDP tutorial but I'm trying to develop a servlet that uses JAXM to process a soap request, and I can't find any examples of how to do this. There are a number of client code examples, but nothing for the server side. There is no source code for the "ReceivingServlet.class", which I believe does what I am loooking for.
    BTW, I know that I can do it easily using JAX-RPC, but I specifically want to do it using JAXM.
    Any ideas or suggestions?
    Thanks,
    Frank

    Example Sending Servlet with out messaging provider
    /* The following program is a servlet, which when run in the browser, constructs a soap message
    and sends the soap message to receiving end, i.e ReceivingServlet in this case*/
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import javax.xml.soap.*;
    import javax.activation.*;
    import javax.naming.*;
    public class SendingServlet extends HttpServlet {
    String to = null;
    String data = null;
    ServletContext servletContext;
    // Connection to send messages.
    private SOAPConnection con;
    public void init(ServletConfig servletConfig) throws ServletException {
    super.init( servletConfig );
    servletContext = servletConfig.getServletContext();
    try {
         SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
    con = scf.createConnection();
    } catch(Exception e) {
              System.out.println("Error in init(): ");
    e.printStackTrace();
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException {
    String retval ="<html> <H4>";
    try {
    // Create a message factory.
    MessageFactory mf = MessageFactory.newInstance();
    // Create a message from the message factory.
    SOAPMessage msg = mf.createMessage();
    // Message creation takes care of creating the SOAPPart - a
    // required part of the message as per the SOAP 1.1
    // specification.
    SOAPPart sp = msg.getSOAPPart();
    // Retrieve the envelope from the soap part to start building
    // the soap message.
    SOAPEnvelope envelope = sp.getEnvelope();
    // Create a soap header from the envelope.
    SOAPHeader hdr = envelope.getHeader();
    // Create a soap body from the envelope.
    SOAPBody bdy = envelope.getBody();
    // Add a soap body element to the soap body
    SOAPBodyElement gltp
    = bdy.addBodyElement(envelope.createName("GetLastTradePrice",
    "ztrade",
    "http://wombat.ztrade.com"));
    gltp.addChildElement(envelope.createName("symbol","ztrade",
    "http://wombat.ztrade.com")).addTextNode("SUNW");
    URL urlEndpoint = new URL("http://localhost:8080/servlet/ReceivingServlet");
    retval += " Sent message (check \"sent.msg\") and ";
    FileOutputStream sentFile = new FileOutputStream("sent.msg");
    msg.writeTo(sentFile);
    sentFile.close();
    // Send the message to the provider using the connection.
    SOAPMessage reply = con.call(msg, urlEndpoint);
    if (reply != null) {
    FileOutputStream replyFile = new FileOutputStream("reply.msg");
    reply.writeTo(replyFile);
    replyFile.close();
    System.err.println("Reply logged in \"reply.msg\"");
    retval += " received reply (check \"reply.msg\"). </H4> </html>";
    } else {
    System.err.println("No reply");
    retval += " no reply was received. </H4> </html>";
    } catch(Throwable e) {
    e.printStackTrace();
    retval += " There was an error " +
    "in constructing or sending message. </H4> </html>"+ e.toString();
    try {
    OutputStream os = resp.getOutputStream();
    os.write(retval.getBytes());
    os.flush();
    os.close();
    } catch (IOException e) {
    e.printStackTrace();
    Example Receiving Servlet without messaging provider
    /* The following code is a servlet which receives the message sent by client servlet,i.e SendingServlet in this case,
    and constructs a response soap message and sends the response message back to the SendingServlet */
    import javax.xml.soap.*;
    import javax.xml.messaging.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.*;
    import javax.naming.*;
    public class ReceivingServlet
    extends JAXMServlet
    implements ReqRespListener
    static MessageFactory fac = null;
    static {
    try {
    fac = MessageFactory.newInstance();
    } catch (Exception ex) {
    ex.printStackTrace();
    public void init(ServletConfig servletConfig) throws ServletException {
    super.init(servletConfig);
    // Not much there to do here.
    // This is the application code for handling the message.. Once the
    // message is received the application can retrieve the soap part, the
    // attachment part if there are any, or any other information from the
    // message.
    public SOAPMessage onMessage(SOAPMessage message) {
    try {
    message.writeTo(System.out);
    SOAPMessage msg = fac.createMessage();
    SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
    env.getBody()
    .addChildElement(env.createName("Response"))
    .addTextNode("This is a response");
    return msg;
    } catch(Exception e) {
    return null;
    /* How to compile: javac ReceivingServlet.java
    How to run: simply place the ReceivingServlet.class in WEB-INF/classes directory, and
    run "http://localhost:8080/servlet/SendingServlet" in the browser. the ReceivingServlet
    constructs a file reply.msg in the tomcat/bin directory */
    Hope these examples help you

  • Compile a project that uses Spark modules (SDK 4.5) with FB4.1?

    Is it possible to compile a project that uses Spark modules with Flash Builder 4.1?
    I've added SDK 4.5 to FB and selected it in the project properties (no problems here).
    But how about the 'Flex modules' tab in the project properties window, will it be able to add Spark modules to the application?

    Yes, you will be able to use s:Module with FB 4. You'll have to do a new MXML component, then go to Flex Modules and click on the add button. (The new module wizard there won't support the spark module)
    However, please note that this is unsupported in the sense that we haven't tried that out at our end. (But I personally have and it works )
    -Anirudh

  • Deploying Servlet that uses SQLJ

    I have a servlet that is an sqlj file where I set up the database context. I have another sqlj file AcctUser that the servlet calls where I pass in the connection context and it does the sql query. When I deploy the application in a jar file it creates the .ser file for the servlet but doesn't create the .ser file for the AcctUser sqlj file and I get the following error
    java.sql.SQLException: profile AcctUser_SJProfile0 not found: java.lang.ClassNotFoundException: AcctUser_SJProfile0 [AcctUser_SJProfile0]
    Has anyone run into this problem?

    We are running into the same issue. JDev 3.2.2 servlet that utilizes SQLJ. They all compile correctly, they all create the SJProfile0.class (set to class instead of ser in SQLJ preferences). However, on any method of distribution (right now we are using single archive file) some of the profiles are included and some are not. We have recreated the files that don't, utilized the same references in the ones that work - all with no success. Right now our choice is to manually edit the deployment profile and add the files (which JDev takes out after deploying) or to add them to the JAR file manually (since it's a simple archive, loadjava isn't going to help here).
    Apparently from the posts, this IS a problem in JDeveloper 3.2 - what a pain.

  • Problems while compiling a project that uses Database Adapter

    Hi,
    I am working on a small WebService that uses the Database Adapter to connect with the Oracle-Lite database. The process is a synchronous process which has client and DatabaseService as the partner link. The goal of this project is to get two inputs from the user and send it over to the DatabaseService for it to select the rows from the table based on the inputs sent. The process activity has an invoke function which had two varibles Invoke_1_inputVarible and Invoke_1_outputVarible. I have included the *.xds that contains the database schema. When I compile the project i get the following error
    Error(38): [Error ORABPEL-10035]: wrong messageType [Description]: in line 38 of "D:\OraBPELPM_2\integration\jdev\jdev\mywork\Workspace1\Login\Login.bpel", messageType "{http://xmlns.oracle.com/pcbpel/adapter/db/ds/}EmployeeRole_msg" of variable "Invoke_1_dsSelect_InputVariable" does not match the expected messageType "{http://xmlns.oracle.com/pcbpel/adapter/db/ds/}dsSelect_inparameters" in <invoke>. [Potential fix]: make sure the correct variable is used in invoke.
    My question is how do I assign correct messageType for the variables.
    XSD File:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/Login" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/Login" elementFormDefault="unqualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="EmployeeRoleCollection" type="EmployeeRoleCollection"/>
    <xs:element name="EmployeeRole" type="EmployeeRole"/>
    <xs:complexType name="EmployeeRoleCollection">
    <xs:sequence>
    <xs:element name="EmployeeRole" type="EmployeeRole" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="EmployeeRole">
    <xs:sequence>
    <xs:element name="empid" type="xs:decimal" minOccurs="0" nillable="true"/>
    <xs:element name="password" type="xs:string" minOccurs="0" nillable="true"/>
    <xs:element name="role" type="xs:string" minOccurs="0" nillable="true"/>
    <xs:element name="uid" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="findAllInputParameters" type="findAll"/>
    <xs:complexType name="findAll">
    <xs:sequence/>
    </xs:complexType>
    <xs:element name="dsSelectInputParameters" type="dsSelect"/>
    <xs:complexType name="dsSelect">
    <xs:sequence/>
    </xs:complexType>
    </xs:schema>
    DatabaseService.wsdl
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions
    >
    <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/Login"
    schemaLocation="EmployeeRole_table.xsd"/>
    </schema>
    </types>
    <message name="EmployeeRoleCollection_msg">
    <part name="EmployeeRoleCollection" element="top:EmployeeRoleCollection"/>
    </message>
    <message name="dsSelect_inparameters">
    <part name="dsSelect_inparameters" element="top:dsSelectInputParameters"/>
    </message>
    <message name="EmployeeRole_msg">
    <part name="EmployeeRole" element="top:EmployeeRole"/>
    </message>
    <portType name="ds_ptt">
    <operation name="dsSelect">
    <input message="tns:dsSelect_inparameters"/>
    <output message="tns:EmployeeRoleCollection_msg"/>
    </operation>
    <operation name="queryByExample">
    <input message="tns:EmployeeRole_msg"/>
    <output message="tns:EmployeeRoleCollection_msg"/>
    </operation>
    </portType>
    <binding name="ds_binding" type="tns:ds_ptt">
    </binding>
    <service name="ds">
    <port name="ds_pt" binding="tns:ds_binding">
    <jca:address location="eis/DB/BPELSamples"
    />
    </port>
    </service>
    </definitions>
    <b>Login.bpel</b>
    <process name="Login" targetNamespace="http://xmlns.oracle.com/Login" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/ds/" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xmlns.oracle.com/pcbpel/adapter/db/top/Login" xmlns:client="http://xmlns.oracle.com/Login" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="client:Login" myRole="LoginProvider"/>
    <partnerLink name="PartnerLink_1" partnerRole="ds_role" partnerLinkType="ns1:ds_plt"/>
    </partnerLinks>
    <variables>
    <variable name="inputVariable" messageType="client:LoginRequestMessage"/>
    <variable name="outputVariable" messageType="client:LoginResponseMessage"/>
    <variable name="Invoke_1_dsSelect_InputVariable" messageType="ns1:EmployeeRole_msg"/>
    <variable name="Invoke_1_dsSelect_OutputVariable" messageType="ns1:EmployeeRoleCollection_msg"/>
    </variables>
    <sequence name="main">
    <receive name="receiveInput" partnerLink="client" portType="client:Login" operation="process" variable="inputVariable" createInstance="yes"/>
    <assign name="Assign_1">
    <copy>
    <from variable="inputVariable" part="payload"/>
    <to variable="Invoke_1_dsSelect_InputVariable" query="/ns2:EmployeeRole"/>
    </copy>
    </assign>
    <invoke name="Invoke_1" partnerLink="PartnerLink_1" portType="ns1:ds_ptt" operation="dsSelect" inputVariable="Invoke_1_dsSelect_InputVariable" outputVariable="Invoke_1_dsSelect_OutputVariable"/>
    <assign name="Assign_2">
    <copy>
    <from variable="Invoke_1_dsSelect_OutputVariable" part="EmployeeRoleCollection"/>
    <to variable="outputVariable" part="payload"/>
    </copy>
    </assign>
    <reply name="replyOutput" partnerLink="client" portType="client:Login" operation="process" variable="outputVariable"/>
    </sequence>
    </process>
    Thanks,
    Niv

    Help! SOS....
    Niv

  • I can't access able to compile the servlet that access EJB methods

    Hello,
    i have written i servlet (TestServlet.java) to access the ejb(SignOn) method(validateUser(userId,Password)) but i can't compile this servlet.it shows this type error.can anybody help me to do it complete.i have written the ejb & servlet in (d:\ejb\src\demo).
    D:\riazejb\src\demo>javac TestServlet.java
    TestServlet.java:15: cannot find symbol
    symbol : class SignOnHome
    location: class demo.TestServlet
    SignOnHome signOnHome;
    ^
    TestServlet.java:16: cannot find symbol
    symbol : class SignOn
    location: class demo.TestServlet
    SignOn signOn;
    ^
    TestServlet.java:23: cannot find symbol
    symbol : class SignOnHome
    location: class demo.TestServlet
    signOnHome = (SignOnHome)PortableRemoteObject.narrow(objref,SignOnHome.c
    lass);
    My servlet code is
    package demo;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import javax.naming.*;
    import javax.ejb.*;
    import demo.*;
    import javax.rmi.PortableRemoteObject;
    public class TestServlet extends HttpServlet {
    SignOnHome signOnHome;
    SignOn signOn;
    public void init(ServletConfig config) throws ServletException {
    //Look up home interface
    try {
    InitialContext ctx = new InitialContext();
    Object objref = ctx.lookup("demo/SignOn");
    signOnHome = (SignOnHome)PortableRemoteObject.narrow(objref,SignOnHome.class);
    } catch (Exception NamingException) {
    NamingException.printStackTrace();
    public void doGet (HttpServletRequest request,HttpServletResponse response)
    throws ServletException, IOException
    PrintWriter out;
    response.setContentType("text/html");
    String title = "EJB Example";
    out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Hello World Servlet!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\">Servlet Calling Session Bean</font></p>");
    try{
    // MyTestSession beanRemote;
    SignOn signOn;
    signOn = (SignOn)signOnHome.create();
    out.println("<p align=\"center\"> Message from Session Bean is: <b>" + signOn.validateUser(student,password) + "</b></p>");
    signOn.remove();
    }catch(Exception CreateException){
    CreateException.printStackTrace();
    out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home</a></p>");
    out.println("</body>");
    out.println("</html>");
    out.close();
    public void destroy() {
    System.out.println("Destroy");
    Thanks in advance.
    Riaz

    Have you added the EJB client JAR to classpath for compilation?
    java -classpath "%CLASSPATH%;<<EJBCLient JAR path>> *.java

  • Compiling a servlet with utility class

    Hello,
    I am having trouble compiling a servlet that uses a utility class.
    The compiler doesn't seem to recognize the utility class for some reason.
    my classpath is set to:
    .;C:\ServletDevel;C:\Program Files\Apache Software Foundation\common\lib\servlet-api.jar
    the error:
    Cannot find symbol: ServletUtilities
    the servlet code:
    package coreservlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** test the use of packages and utilities on the server */
    public class helloservlet3 extends HttpServlet {
    public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
                   throws ServletException, IOException {
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         String title = "Hello (3)";
         out.println(ServletUtilities.headWithTitle(title) +
              "<body bgcolor=\"#FDF5E6\">\n" +
              "<h1>" + title + "</h1>\n" +
              "</body></html>");
    the utility class:
    package coreservlets;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** time saving static methods */
    public class ServletUtilities {
         public final static String docType =
         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
         "Transitional//EN\">";
    public static String headWithTitle(String title){
    return (docType + "\n" + "<html>\n" +
              "<head><title>" + title + "</title></head>\n");
    any help wouldbe greatly appreciated.

    Nope still getting an error
    helloservlet3.java:17:cannot find symbol
    symbol : class ServletUtilities
    location: package coreservlets
    out.println(coreservlets.ServletUtilities.headWithTitle(title) +
    thanks for the help, i'll keep on trying to figure it out.

  • Compiling Servlet problem that uses a JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Hi,
    The problem is it is not finding the Bean. Put it in the classpath.
    The simplest way is put the class in /WEB-INF/classes/MyPackage folder.

  • Compiling Java Servlet with Depricated Methods

    I have a problem of compiling Java servlets that contain depricated methods. If you compile against modern version of servlet.jar I see depricated methods error messages and if I use a very old servlet.jar it cannot find newer methods. What is is the best solution in this case?
    Thank you,
    Boris.

    The best thing to do would be compile your code with the -depreciated option to find which methods have been depreciated and the refactor your code to remove them.
    The next best thing is to ignore the messages (they are warnings not errors) and your code should still work

  • Trouble compiling a servlet

    This may be a dumb question, but is there any way to compile a servlet without using ant?

    nevermind, I got it...

  • Using javabean in tomcat(unable to compile class)

    Hello, I am using jakarta-tomcat-5.0.28, OS:WinXP
    I am getting the following error when i use javabean in tomcat (the example is executed just fine in another web server:Blazix)
    I am very new to this (JSP, Servlets and tomcat) so any help would be greatly appreciate.
    THE ERROR IS:
    ==============================================================
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Programs\internet\jakarta-tomcat-5.0.28\work\Catalina\localhost\JSPSession\org\apache\jsp\SaveName_jsp.java:42: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    UserData user = null;
    ^
    An error occurred at line: 1 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Programs\internet\jakarta-tomcat-5.0.28\work\Catalina\localhost\JSPSession\org\apache\jsp\SaveName_jsp.java:44: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
    ^
    An error occurred at line: 1 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Programs\internet\jakarta-tomcat-5.0.28\work\Catalina\localhost\JSPSession\org\apache\jsp\SaveName_jsp.java:46: cannot resolve symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = new UserData();
    ^
    3 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
    ===============================================================
    ERROR END
    I use the folowing files:
    GetName.html
    SaveName.jsp
    NextPage.jsp
    UserData.java
    My Dir Structure is:
    /JSPSession
        GetName.html
         SaveName.jsp
         NextPage.jsp
       /WEB-INF
          /classes
             UserData.java
             UserData.class
       /libThe Code for the files is:
    GetName.html
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>---------------------------------------------------------------------------------------------------
    SaveName.jsp
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
    <A HREF="NextPage.jsp">Continue</A>
    </BODY>
    </HTML>-----------------------------------------------------------------------------------------------------
    NextPage.jsp
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <HTML>
    <BODY>
    You entered<BR>
    Name: <%= user.getUsername() %><BR>
    Email: <%= user.getEmail() %><BR>
    Age: <%= user.getAge() %><BR>
    </BODY>
    </HTML>------------------------------------------------------------------------------------------------------------
    UserData.java
    public class UserData {
        String username;
        String email;
        int age;
        public void setUsername( String value ) {
            username = value;
        public void setEmail( String value ) {
            email = value;
        public void setAge( int value ) {
            age = value;
        public String getUsername() { return username; }
        public String getEmail() { return email; }
        public int getAge() { return age; }
    }

    A very common question. Tomcat dislikes classes which are not packaged. So, add a package statement in your UserBean.java
    package beans; // or something like thatand then place the compiled class file UserBean.class into WEB-INF/classes/beans.
    Put the import statement into the JSP accordingly and try again.
    ***Annie***

  • Problem in compiling servlet class - using Tomcat

    Hi,
    I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
    and my deployment descriptor in D:\servlet_wrk\project1\etc
    my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
    and
    my PATH var is set to C:\Sun\AppServer\bin.
    When I compile my servlet class Ch1Servlet.java in the command line from the directory
    D:\servlet_wrk\project1 using the command
    javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
    it says error:cannot read: src/Ch1Servlet.java
    Can somebody help me to solve this problem and help me to compile my servlet class.
    Thanks.

    Thanks...as u said I tried putting dir & found that
    my file was saved as Ch1Servlet.java.txt instead for
    Ch1Servlet.java......So that was a problem.Now I'm
    able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
    But on compiling I'm getting the following error
    package java.servlet.* does not exist
    package java.servlet.http.* does not exist
    package java.io.* does not exist
    Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

  • Not able to compile servlet pgm - using Tomcat

    Hi,
    I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
    and my deployment descriptor in D:\servlet_wrk\project1\etc
    my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
    and
    my PATH var is set to C:\Sun\AppServer\bin.
    When I compile my servlet class Ch1Servlet.java in the command line from the directory
    D:\servlet_wrk\project1 using the command
    javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
    it says error:cannot read: src/Ch1Servlet.java
    Can somebody help me to solve this problem and help me to compile my servlet class.
    Thanks.

    **MAJOR SPAMMING SCUM BAG ALERT**
    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are a scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Using javabeans in servlets

    Hi,
              I am trying to write a simple web application where I have an entity bean
              that encapsulates a database table, a servlet that queries the table and
              sends back entity ejbs. I want to display the query results in a user
              friendly way. I am planning to write a JavaBean that contains a JTable and
              use that JavaBean in the servlet.
              Will using a swing component have any impact on the performance of the
              servlet?
              I am just wondering if there is a better way?
              Thanks
              Shalini
              

    Will using a swing component have any impact on the performance of the          > servlet?
              Unless I misunderstand, the JTable is on the client (Java app or browser
              applet) and the database table is being accessed by the servlet on the
              server, so the JTable will not affect the performance of the Servlet, since
              they are on different machines and working in a rather unrelated manner.
              Cameron Purdy
              [email protected]
              http://www.tangosol.com
              WebLogic Consulting Available
              "beaservlets" <[email protected]> wrote in message
              news:39c811b3$[email protected]..
              > Hi,
              > I am trying to write a simple web application where I have an entity bean
              > that encapsulates a database table, a servlet that queries the table and
              > sends back entity ejbs. I want to display the query results in a user
              > friendly way. I am planning to write a JavaBean that contains a JTable and
              > use that JavaBean in the servlet.
              >
              > Will using a swing component have any impact on the performance of the
              > servlet?
              >
              > I am just wondering if there is a better way?
              >
              > Thanks
              > Shalini
              >
              >
              

  • Using a class or servlet that implements Serializable

    Hello everyone,
    Can someone please help me. I need to make a program that uses a class or servlet that implements Serializable and then use the values of the variables in servlets.
    The first is using it to validate login. then changing the color of the background, header and footer of each servlet.
    the variables in the Serialized file are all Strings for color, username, password, header text and footer text.
    I tried using the applet tag to run the class in the servlet but it is not working.

    It's not working because you seem to be making random guesses what servlets, serialization and files are

Maybe you are looking for

  • Problem with Adobe Reader (GUI)

    Hi, I´ve got a problem with my Adobe Reader (v. 11.0.10). Everytime when I open some document, I´m getting graphical problems: Menu is hidden When I move by mouse over the menu, it dissappears. And when I maximize the window.. Thanks for your help.

  • Sneak Peek #1 of Photoshop CS6 & ACR7

    Bryan O'Neil Hughes lifts the curtain on some new features of Photoshop CS6 and Camera Raw 7 :

  • Ipad shows a black screen

    I can hear my ipad turns on and off but it shows a black screen?

  • Mail message font

    Mail 8.0 Mail application will not allow me to compose an email in Nitti Light 16.0 even though I've set the 'message font' and 'fixed width font' preferences to this font. Instead, when composing an email, Nitti Normal 16.0 is automatically used. By

  • Ethernet not connecting when resuming from sleep/hibernate

    I use my mac (Win7) in clamshell mode quite often, and I leave the cables connected (ethernet, power, display, etc). I have noticed since installing the 3.0 Boot Camp drivers that the ethernet connection is not recognized after resuming from sleep/hi