Results 1 to 15 of 15

Thread: JSB Beans and Tomcat problem

  1. #1

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Resolved JSB Beans and Tomcat problem

    I'm trying to use a Bean in my JSP page(running on tomcat), but everytime I try to run it says the package doesn't exist, I've placed my package in web-inf/classes/packageName and my class inside of that... The error I get is:

    C:\Programmer\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\index_jsp.java:47: package m does not exist
    m.Person person = null;
    ^

    Does anyone have any idea what might be wrong? I've been googling for 30 minutes now without luck - and I've tried reinstalling tomcat... my JSP code for calling the bean is:

    <jsp:useBean id="person" class="m.Person" scope="session" />
    <jsp:setProperty name="person" property="*" />


    <Moderator added green checkmark in the first thread>
    Last edited by NoteMe; Feb 17th, 2005 at 07:16 AM.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  2. #2

  3. #3

  4. #4
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: JSB Beans and Tomcat problem

    tomcat keeps telling me "The value for the useBean class attribute is invalid."

    No matter if the bean is stored in directly within the classes directory itself C:\Jakarta\jakarta-tomcat-5.0.28\webapps\ora\WEB-INF\classes and i use
    <jsp:useBean id = "Test" class = "TestBean"/>

    or another directory off of the classes dir.
    C:\Jakarta\jakarta-tomcat-5.0.28\webapps\ora\WEB-INF\classes\com\MyCompany\Beans
    <jsp:useBean id = "Test" class = "com.MyCompany.Beans.TestBean"/>

    But what i noticed was that the web container was not compiling my .java file because there was no .class file being generated. It was only when i took the bean out of it's directory and put it into the C:\ dir and compiled it using javac and saw i didnt add in (import java.io* and some other stuff then moved it back into the C:\Jakarta\jakarta-tomcat-5.0.28\webapps\ora\WEB-INF\classes\com\MyCompany\Beans
    that everything worked fine.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JSB Beans and Tomcat problem

    Didn't we have an extremely similar problem in the past?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: JSB Beans and Tomcat problem

    Quote Originally Posted by CornedBee
    Didn't we have an extremely similar problem in the past?
    I wouldn't know .

    So, you're saying I should try compiling my classes with javac before moving them to the class directory?
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JSB Beans and Tomcat problem

    In fact, I would move only the .class files to the classes directory.

    My current setup is like this:

    Code:
    <appdir>
      -> WEB-INF
        -> src
          -> backend -> at/getdesigned/sciencemapper/*.java
          -> webservice -> at/getdesigned/sciencemapper/ws/*.java
          -> tests ...
        -> classes -> at/getdesigned/.../*.class
        -> build.xml
    And I simply type
    ant
    in the WEB-INF directory. The build.xml is written so that it correctly locates and compiles all files to the classes directory.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: JSB Beans and Tomcat problem

    Ant? I'm not using ant... I mean... I don't even know what ant is, besides the insect... What does it do? And do I have to run it before tomcat's capable of finding my beans ?
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JSB Beans and Tomcat problem

    http://ant.apache.org/

    It's the build tool for all things Java.

    In other words, it's a far more comfortable way of compiling everything than calling javac manually.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  10. #10

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: JSB Beans and Tomcat problem

    Quote Originally Posted by CornedBee
    http://ant.apache.org/

    It's the build tool for all things Java.

    In other words, it's a far more comfortable way of compiling everything than calling javac manually.
    Okay then Thanks!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  11. #11
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: JSB Beans and Tomcat problem

    CornedBee the .xml that you showed where would i find it at? Im looking at a build.xml file generated by NetBeans and it's structure isn't the same.

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JSB Beans and Tomcat problem

    I wrote it myself.

    Here's mine:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="ScienceMapper" default="all">
    	<description>
    		ScienceMapper is a literature organizing system.
    	</description>
    
    	<property name="path.rootsrc" location="src"/>
    	<property name="path.dest" location="classes"/>
    
    	<property name="build.version" value="1.4"/>
    	<property name="build.debug" value="true"/>
    
    	<property name="project.version" value="0.0"/>
    
    	<!-- Apparently 1.5.x doesn't support condition. -->
    	<!--
    	<condition property="build.optimize">
    		<isfalse value="${build.debug}"/>
    	</condition>
    	-->
    	<property name="build.debug" value="true"/>
    
    	<target name="all" depends="webservice,backend,tests">
    	</target>
    
    	<target name="backend" depends="utils">
    		<javac srcdir="${path.rootsrc}/backend" destdir="${path.dest}"
    			encoding="UTF-8" debug="${build.debug}" deprecation="on"
    			optimize="${build.optimize}" target="${build.version}"
    			source="${build.version}">
    
    		</javac>
    	</target>
    
    	<target name="webservice" depends="backend">
    		<javac srcdir="${path.rootsrc}/webservice" destdir="${path.dest}"
    			encoding="UTF-8" debug="${build.debug}" deprecation="on"
    			optimize="${build.optimize}" target="${build.version}"
    			source="${build.version}">
    
    		</javac>
    	</target>
    
    	<target name="tests" depends="backend,webservice,utils">
    		<javac srcdir="${path.rootsrc}/tests" destdir="${path.dest}"
    			encoding="UTF-8" debug="${build.debug}" deprecation="on"
    			optimize="${build.optimize}" target="${build.version}"
    			source="${build.version}">
    
    		</javac>
    	</target>
    
    	<target name="utils">
    		<javac srcdir="${path.rootsrc}/utils" destdir="${path.dest}"
    			encoding="UTF-8" debug="${build.debug}" deprecation="on"
    			optimize="${build.optimize}" target="${build.version}"
    			source="${build.version}">
    
    		</javac>
    	</target>
    
    </project>
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13

  14. #14
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: JSB Beans and Tomcat problem

    You'd mainly have to read the Ant documentation.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  15. #15
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: JSB Beans and Tomcat problem

    With JSP, JSF, SQL, then all of the other crap i have to take at uni i think ill just wait.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width