Cant find bean class from jsp page using Tomcat 4

Hi
I have searched numerpus forums and seen many posts from people who seem to have the same problem however none of the solutions seem to work for me.
I have a jsp page which is trying to call a bean method however I get an error
saying that the class for the bean cannot be found. I have :
1. put the class in a package called kolaBean under
C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\begjsp-ch01\WEB-INF\classes\kolaPackage
2. included the package statement in the java file for the bean
3. included an empty constructor in the java file for the bean
4. I have declared the above constructor as public (is this necessary?)
5. used the full package name:
kolaPackage.kolaBean bakedBean = new kolaPackage.kolaBean();
6. imported import java.beans.*; (is this necessary ?)
7. still got the same error...
Any pointers really really appreciated
Thanks
Kola

in reply to David Rons email:
Is this a fresh install of tomcat? If so, it could be a configuration
problem.Yes it is
Is the class public in the package (I forget that all the time)?Yes it is. I have also declared the constructor to be public is this
necessary?
What's the error message?here is the error message:
An error occurred between lines: 11 and 14 in the jsp file:
/begjsp-ch01/kolaBean.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat
4.0\work\localhost\_\begjsp-ch01\kolaBean$jsp.java:59: Class
kolaPackage.kolaBean not found.
     kolaPackage.kolaBean bakedBean = new
kolaPackage.kolaBean();
     ^
2 errors
Thanks in advance
Kola

Similar Messages

  • Calling a class in JSP page using Tomcat 5.5

    Hi,
    I want to call a java class in a JSP page but getting error.
    I am trying to deploy JSP through a WAR file so for that I have created folder structure as per requirement and in WEB-INF folder, I kept web.xml file.
    What entry exactly I have to make in web.xml file as I am using Tomcat 5.5 webserver. When the same code I put in JSP then it works.
    my web.xml entry is
    <servlet>
    <servlet-name>TBS</servlet-name>
    <servlet-class>pack1.GetData</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>TBS</servlet-name>
    <url-pattern>/JSP/TBS_main</url-pattern>
    </servlet-mapping>
    Do I need to change in it or we have to make some more entries in different XML files.
    Please help me to resolve this issue.
    Thanks
    Mukesh

    you dont have to specify the class file in the web.xml just import it on your jsp then instatiate the class on the scriplet and you can call the methods on it.

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • How to load java class from jsp page?

    hi all!
    Does anyone know how to load java class from jsp page?
    I try to load java class from jsp page.
    Is it possible to load java class fom jsp page?
    thanks and have a good day!

    What I mean is How to load/open java class file from jsp page?
    I think we can open Applet from jsp page by using
    <applet code=helloApplet.class width=100 height=100>
    </applet>
    but, how to open java class which is an application made by Frame?
    thanks and have a good day

  • Calling my Java class from JSP page

    Hello, I am trying to call my Java class from my JSP page passing parameters to it and getting back a collection of result sets. Can someone tell me what I might be doing wrong:
    JSP code to call Java class:
    <%
    String strEssUser = "test";
    String strProcessingMonth = "JUL";
    String strProcessingYear = "2002";
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    %>
    I get this error when I try to run this JSP page using tomcat:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:77: Class org.apache.jsp.ListReturn not found.
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    I'm not sure if this problem is the way I am calling the Java class, or if I have a problem in the Java code itself. Can anyone help?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Calling java class from jsp page

    Dear Friends.
    I wrote jsp page and java class.
    Am calling java class from jsp page. after processing result,
    I have to refresh jsp page from java class.
    processing time may take 5 minutes or 1 minute etc. that depends on user.
    Can It be possible ? if possible , How ?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Can not call bean class from JSp/Tomcat 5.5

    hello everyone...
    i m using one bean class Parser which is called by discussion.jsp page. i put class file in webapps/grid/WEB-INF/classes and JSP page is in webapps/grid/. The whole combination is working fine for tomcat 3.3.2 but not working properly in tomcat 5.5.
    Error is as follow...
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 38 in the jsp file: /discussion.jsp
    Generated servlet error:
    Parser cannot be resolved or is not a typeplease help me....
    Thank in Advance

    You still need to import the class from the default package. As a word of advice you should put the class in a package. The later versions of Tomcat do not play well with bean classes that are not in packages.

  • Unable get complete filepath from jsp page using request.getParameter()

    Hey all,
    i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
    Output :
    FILE NAME : TEST
    FILE PATH : test.txt
    Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at com.test.TestServlet.processRequest(TestServlet.java:39)
    at com.test.TestServlet.doPost(TestServlet.java:75)
    JSP CODE:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>DEMO SERVLET</title>
    </script>
    </head>
    <body>
    <h2>Hello World!</h2>
    <form name="myform" action="TestServlet" method="POST"
    FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
    FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
    <input type="submit" value="Submit" name="submit" />
    </form>
    </body>
    </html>
    Servlet Code :
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException, FileNotFoundException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    String filename = request.getParameter("filename");
    out.println(filename);
    String filepath = request.getParameter("myfile");
    out.println(filepath);
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet TestServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
    if (filepath != null) {
    File f = new File(filepath);
    BufferedReader br = new BufferedReader(new FileReader(f));
    String strLine;
    String[] tokens;
    while ((strLine = br.readLine()) != null) {
    tokens = strLine.split(",");
    for (int i = 0; i < tokens.length; i++) {
    out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
    out.println("----------------");
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    Needed Output :
    FILE NAME : TEST
    FILE PATH : C:\\Temp\\test.txt
    Any suggestions Plz??

    As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
    You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html].

  • Using java class from JSP page

    I have a class that connects to the database and return the result in form of array of objects, now I wrote a tester and I was able to print the result on the console but when it came to JSP how can I use this class I am a bit confused, how can I declare an array of objects and save the result that comes from the class method
    note: my class is not a bean it is a service class that contain methods to retreive different information from the database.
    I would apritiate any help but please make it in sequence for example declaring an array to hold the result then call the method that returns the array of objects..etc
    please help, I am really confused and don't know what to write
    thank you

    You can access a class in the same way as a bean, after all a bean is just a class that follows a set of rules.
    You need to put your classes in packages to access them.
    I have 2 packages, params and DTO. I set the class that returns the Data Transfer Object, or array of objects up as I would a bean
    <jsp:useBean id="DTO" scope="request" class="params.DTO" />
    I think you skip the above declaration and access it directly in code using
    params.DTO();
    but setting it up as I would a bean allows me to simply use
    DTO();
    DTO is the class that passes back the array of objects.
    Objects themselves I have in a seperate package, also called DTO (sorry if this is confusing, made sense at the time :-) ) You dont need them in seperate packages, just helped me keep DTO objects seperate from business logic classes......
    Now before I use params.DTO() I declare a variable of the Object type DTO() returns
    <%! DTO.workSheet[] ws; %>
    So, ws is the object type that will be returned by params.DTO()
    Then to get my array of objects back from params.DTO() :-
    ws = DTO.workSheet(day);
    or if you dont like the bean declaration
    ws = params.DTO.workSheet(day);
    You need to put your packages under WEB-INF/Classes when using Tomcat
    So I have
    Tomcat 5.0\webapps\myApplication\WEB-INF\classes\params
    Tomcat 5.0\webapps\myApplication\WEB-INF\classes\DTO
    Under which reside the classes

  • Calling Classes From JSP pages

    I am importing an application specific class in a JSP page and calling it
              (Win NT). It compiles the servlet successfully but cannot appear to find the
              class during execution.
              I have tried placing the class file / jar file containing the class in
              CLASSPATH environment / weblogic JAVAPATH variable / weblogic ServletClasses
              directory .. so far without any luck.
              I would appreciate any suggestions.
              Regards,
              Pradeep
              

    Put it in WEBLOGICCLASSPATH variable. And make sure it is only in
              WEBLOGICCLASSPATH , nowhere else.
              Cheers - Wei
              John Brown <[email protected]> wrote in message
              news:39693f9e$[email protected]..
              > I am importing an application specific class in a JSP page and calling it
              > (Win NT). It compiles the servlet successfully but cannot appear to find
              the
              > class during execution.
              > I have tried placing the class file / jar file containing the class in
              > CLASSPATH environment / weblogic JAVAPATH variable / weblogic
              ServletClasses
              > directory .. so far without any luck.
              > I would appreciate any suggestions.
              >
              > Regards,
              >
              > Pradeep
              >
              >
              >
              

  • Cant find tag libraries from included pages

    Hello,
    I have many jsp pages that reference a "header" jsp page. This "header" includes all the taglibs I want to use on every page.
    How can I get workshop to notice them on the pages that include the header file, not just the header files themselves?
    I am attaching screenshots of my environment so you can see the issue:
    Tags found:
    http://img173.imageshack.us/img173/4954/tagsfound3bw.gif
    Tags not found:
    http://img340.imageshack.us/img340/1452/tagsnotfound5nc.gif

    I don't know what I did but this issue has resolved itself somehow :(

  • IllegalAccessError trying to instantiate public class from JSP page

    I have a public class called UrlHolderClient located in both
    WEB-INF/classes/UrlHolderClient.class and
    WEB-INF/lib/urlholder.jar.
    This client class is used as a wrapper class around a simple ejb which holds urls. I have a JSP which tries to create an instance of UrlHolderClient in jspInit(), but the call to the constructor throws a java.lang.IllegalAccessError. I have no idea what the problem is here. I import the classes using the page directive.
    Any suggestions?

    Is this tomcat you are deploying on or some other App Server?
    Also, you reference JspInit(), have you tried instanting in
    Scriplet Code <% UrlHolderClient urlHolderClient = new UrlHolderClient() %>
    Does that not work either?

  • How to call Servlet from jsp page and how to run this app using tomcat..?

    Hi ,
    I wanted to call servlet from jsp action i.e. on submit button of JSP call LoginServlet.Java file.
    Please tell me how to do this into jsp page..?
    Also i wanted to execute this application using tomcat.
    Please tell me how to do this...? what setting are required for this...? what will be url ..??
    Thanks.

    well....my problem is as follows:
    whenever i type...... http://localhost:8080/appName/
    i am getting 404 error.....it is not calling to login.jsp (default jsp)
    but when i type......http://localhost:8080/appName/login.do........it executes servlet properly.
    Basically this 'login.do' is form action (form action='/login.do').....and i wanted to execute this from login jsp only.(from submit button)
    In short can anyone please tell me how to diaplay jsp page using tomcat 5.5
    plz help me.

  • Calling Beans from JSP page

    hi,
    I tried to my best to call java beans from JSP page but it generate error that "unable to load class....", please help me that in which directory jsp file and bean *.class file reside, currently my setting are as follows.
    Note: I am using tomcat server and my jsp and servlet files are running seccessfuly, there is any special change in classpath for java beans? if any please tell
    My jsp file is in tomcat-->webapps-->jsp--><my file>
    My bean (*.class) file-->webapps-->Root-->web-inf-->classes--><my file>
    Pleae help me for the above problem.
    Mubashar ([email protected])

    According to J2EE standards:
    The web appl directory structure should be:
    WebAppRootDirectory
    |
    |---html, jsp, images etc
    |
    |---WEB-INF---
    |---classes--
    |---lib
    |
    |
    1) Make sure WEB-INF is in capital letters
    2) Place all ur beans in classes dir or sub-directory in
    classes
    3) In Tomcat place WebAppRootDirectory in webapps
    directory
    [email protected]

  • Send message from JSP page to Java message driven bean

    Hi all
    I'm using Jdev903.
    I need to send a message from JSP page (Web Application) to Java Message Driven Bean.
    * I created Message Driven Bean that named: MyMessageDrivenEJBBean
    * I have configed jms.xml:
    <topic-connection-factory name="ChatTopicConnectionFactory" location="jms/theTopicConnectionFactory"/>
    <topic name="ChatTopic" location="jms/theTopic"/>
    * In JSP page, my code is:
    final Context ctx = new InitialContext();
    // 1: Lookup ConnectionFactory via JNDI
    TopicConnectionFactory factory =(TopicConnectionFactory)ctx.lookup("jms/theTopicConnectionFactory");
    But trouble occurs is:
    javax.naming.NameNotFoundException: jms/theTopicConnectionFactory not found
    please help me!
    thank a lot.

    Welcome to the Sun forums.
    1. Please post your code using code tags, this formats it so that it is easier for people to read and understand it. Click on 'CODE' above the text area when posting.
    2. As far as possible, please post an SSCCE
    What have learnt about JSPs and servlets till now? Because reading the values submitted in a form is pretty much the base of all operations. I suggest you Google for [servlet tutorials|http://www.google.com/search?q=servlet+tutorial] and [JSP tutorials|http://www.google.com/search?q=jsp+tutorial] and go through them thoroughly. After you understand what is to be done and what options are available to you, if you still face problems, please feel free to post your queries here. But this isn't exactly a site for tutorials, especially since there are so many good ones already out there, that explain all this stuff in detail. There's no point in re-inventing the wheel.
    Hints: [ServletRequest#getParameter()|http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getParameter(java.lang.String)] and [RequestDispatcher#forward|http://java.sun.com/javaee/5/docs/api/javax/servlet/RequestDispatcher.html]

Maybe you are looking for

  • Iweb publishing to mobileme

    When I create a website in iweb '09 (3.0.1) and publish to mobileme, is there a way to have the website be hppt://mywebsitename.com or does it need to be http://web.me.com/mymobilemeaccountname/iweb/mywebsitename??

  • How do i stop my i phone 4s deleting my contacts when i set up e-mail?

    Hi, I have recently upgraded to the i phone 4S.  I have restored from my back up on my Macbook.  When I put in all my details to set up my e-mail exchange account all the contacts are deleted.  I have tried a few times and ensured that the box's next

  • Changed password, now neither one works

    just changed my admin password and after I changed it a popup appeared that I exited out of without reading, saying I needed to do something in order for my new password to work; Now I can't use my old or new password to access things, I'm at college

  • Issue is wms related

    hi Here material is qm relavent when doing the GR then lt06--qa32  th material is post in the bin when we do another GR -LT06--QA32  the material is  placing in  different bin and the quant is same is there anybody  to answer  what is the process or

  • HP Pavilion g6-2006tx Webcam

    Hi, I am using HP Pavilion g6-2006tx. Whenever I am using skype or whenever I open youcam, it gives the warning message, No webcam detected, try plugging in a webcam into your computer now. I am using integrated camera. Please help me with this probl