#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Vancouver, B.C.
    Posts
    11
    Rep Power
    0

    jsp cant find bean class or jar


    I am having some problems getting my jsp to find my bean classes.
    my direcotry structurethe one froce upon me from the hosting company actually)
    html root->Project Dir->Jsp Dir ->jsp files
    ->WEB-INF->classes->packageName->beanClass

    my code:

    <jsp:useBean id="bean" class="package.BeanName" scope="session"/>

    I get and error can not find paackage.BeanName

    If I try without a package I get: can not find org.apache.jsp.BeanName

    Am i doing something wrong(which is very possible) or could it be the server config which i dont know at all and they will not tell me.

    thanks alot in advance
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    Hmm, with the limited info you have given I would say it is most likely a server configuration problem. Can you post your jsp so we can see it?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Vancouver, B.C.
    Posts
    11
    Rep Power
    0

    may be server config


    Hi,

    Yes it could be the server config, my host is using esim's webppliance, i think it is quite poplular but there is little info besides put class files in web-inf. Here is a bit of my code:
    Code:
    <%@ page import="java.sql.*" %>
    <%@ page import="JarName.*" %>
    
    
    <jsp:useBean id="test" class="beanName" scope="session" />
    
    <% 
    	Connection conn = null;
        ResultSet rs = null;
        Statement stmt = null;
        String dbname = "dbName";
        final String dbUrl= "jdbc:mysql:///" +"dbName";
        
    	try
    	{
    		//load mysql driver
    		Class.forName("org.gjt.mm.mysql.Driver");
    		//connect to database
    		conn=DriverManager.getConnection(dbUrl);
    		stmt=conn.createStatement();
    	}//try
    	catch(Exception e){
    		
    	}//exception
    %>
    and does org.apache.jsp.beanName mean any specific directory?
    and is their away to point to an aboslute path?
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Vancouver, B.C.
    Posts
    11
    Rep Power
    0

    bean that works


    I got a small bean to work so it must be something wrong with the code, but I still can not import jar files any help on that would be great. Does anyone know anything about this webppliance thing?

    Thanks

    NiP
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Los Angeles
    Posts
    1
    Rep Power
    0

    same problem


    Hi

    I believe I have the same problem.

    When trying to access the jsp-file I get
    C:\j2sdkee1.3.1\repository\bigbox\web\currencyconverter\index$jsp.java:5: Package ejb.DataBaseCache not found in import.
    import ejb.DataBaseCache.*;

    The other imports works fine
    CurrencyConverter,CurrencyConverterHome, ejb.DataBaseCache.*, javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException

    Most of them would reside in classes.jar I guess and the two first ones ive written myself (actually editing a tutorial that i have modified). Those two classes are found thanks to them being deployed trhough deploytool I guess.

    ejb.DataBaseCache however i dont want as a sessionbean. I'd like to us it as a singleton/static class (one instance only). Why arent it showing up to work with the import statement?

    Does jsp use another classpath than the one I set through environment variables in windows?
    Do I need to place ejb.DataBaseCache in a jar and place it in a special directory (where?)
    Does it need to be deployed in some way to be able to be found by a jsp? (how?)

    Please help me out with this one.. Have tried lots of things but cant get it to work.

    Best regards.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    6
    Rep Power
    0
    every added new context in web.xml file will only be recognized after restarting Tomcat. Maybe this is the case?
    I also found that you may need to put both:
    <%@ page import = .....%>

    and ...

    <jsp:useBean .....

    for each bean class you use in your jsp file.

    Nipster, there are 2 jdbc connectors for mysql (that I know, maybe more). Ask the admin which one they use, so save your time not trying to load wrong mysql driver.
    Last edited by halimanh; February 16th, 2003 at 05:05 PM.

IMN logo majestic logo threadwatch logo seochat tools logo