February 1st, 2003, 10:34 PM
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
<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
February 2nd, 2003, 11:33 AM
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?
February 3rd, 2003, 04:02 AM
may be server config
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:
and does org.apache.jsp.beanName mean any specific directory?
<%@ 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";
//load mysql driver
//connect to database
and is their away to point to an aboslute path?
February 3rd, 2003, 03:29 PM
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?
February 9th, 2003, 07:02 PM
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.
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.
February 16th, 2003, 04:02 PM
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 = .....%>
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 04:05 PM.