Malachi,
the tutorial you are referring to seems to rely on JSP 1.2.
Notice that GlassFish implements the soon-to-be-released JSP 2.1 spec.
The minimum JDK requirement for the previous JSP 2.0 has been JDK 1.4,
which is why this restriction was added:
JSP.11.2:
As of JSP 2.0, it is illegal to refer to any classes from the unnamed
(a.k.a. default) package. This may result in a translation error on
some containers, specifically those that run in a JDK 1.4 or greater
environment. It is unfortunate, but unavoidable, that this will break
compatibility with some older JSP applications. However, as of JDK 1.4,
importing classes from the unnamed package is not valid (see
http://java.sun.com/j2se/1.4/compatibility.html#source for
details).[...] This restriction also applies for all other cases where
classes are referenced [...].
In your case, the restriction applies to the code generated from this action
in your JSP:
<jsp:useBean id="user" class="UserData" scope="session"/>
where the "UserData" class resides in the unnamed package.
You should try to modify the tutorial by placing "UserData" into a package.
Let me know if you still run into any problems.
Jan
Malachi de Ælfweald wrote On 04/10/06 21:18,:
> I believe these are the pertinent lines from server.log:
>
> (you'll notice C:\Java\glassfish\domains\domain1\docroot\jspTest\jsp3\
> in the following)
>
> shared classpath jars : [, C:\Java\glassfish\lib\javaee.jar,
> C:/Java/jdk1.6.0/jre/../lib/tools.jar,
> C:\Java\glassfish\lib\install/applications/jmsra/imqjmsra.jar,
> C:\Java\glassfish\lib\commons-launcher.jar,
> C:/Java/glassfish/imq/lib/jaxm- api.jar,
> C:/Java/glassfish/imq/lib/fscontext.jar,
> C:/Java/glassfish/imq/lib/imqbroker.jar,
> C:/Java/glassfish/imq/lib/imqjmx.jar,
> C:/Java/glassfish/lib/ant/lib/ant.jar,
> C:\Java\glassfish\lib\appserv-ws.jar, C:\Java\glassfish\lib\mail.jar,
> C:\Java\glassfish\lib\jsf- api.jar,
> C:\Java\glassfish\lib\jsf-impl.jar,
> C:\Java\glassfish\lib\appserv-jstl.jar,
> C:\Java\glassfish\lib\appserv-env.jar,
> C:\Java\glassfish\lib\jmxremote_optional.jar,
> C:/Java/glassfish/lib/SUNWjdmk/5.1/lib/jdmkrt.jar,
> C:\Java\glassfish\lib\commons- logging.jar,
> C:\Java\glassfish\lib\activation.jar,
> C:\Java\glassfish\lib\appserv-rt.jar,
> C:\Java\glassfish\lib\appserv-admin.jar,
> C:\Java\glassfish\lib\appserv-cmp.jar,
> C:\Java\glassfish\domains\domain1\docroot\jspTest\jsp3\,
> C:\Java\glassfish\lib\admin- cli.jar, C:\Java\glassfish\lib\antlr.jar,
> C:\Java\glassfish\lib\appserv-deployment-client.jar,
> C:\Java\glassfish\lib\appserv-ext.jar,
> C:\Java\glassfish\lib\appserv-jwsacc-signed.jar,
> C:\Java\glassfish\lib\appserv-jwsacc.jar ,
> C:\Java\glassfish\lib\appserv-launch.jar,
> C:\Java\glassfish\lib\appserv-tags.jar,
> C:\Java\glassfish\lib\appserv-upgrade.jar,
> C:\Java\glassfish\lib\asm-attrs.jar, C:\Java\glassfish\lib\asm.jar,
> C:\Java\glassfish\lib\dbschema.jar,
> C:\Java\glassfish\lib\framework.jar, C:\Java\glassfish\lib\j2ee-
> svc.jar, C:\Java\glassfish\lib\jhall.jar,
> C:\Java\glassfish\lib\sun-appserv-ant.jar,
> C:\Java\glassfish\lib\toplink-essentials-agent.jar,
> C:\Java\glassfish\lib\toplink-essentials.jar]
>
> And referencing the .class file that was in that directory:
>
>
> [#|2006-04-10T10:26:19.629-0700|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=13;_ThreadName=httpWorkerThread-8080-2;|StandardWrapperValve[jsp]:
> Servlet.service() for servlet jsp threw exception
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> [javac]
> C:\Java\glassfish\domains\domain1\generated\jsp\j2ee-modules\__default-web-module-server\org\apache\jsp\jspTest\jsp3\SaveName_jsp.java:43:
> cannot find symbol
> [javac] symbol : class UserData
> [javac] location: class org.apache.jsp.jspTest.jsp3.SaveName_jsp
> [javac] UserData user = null;
> [javac] ^
>
>
> Generated servlet error:
> [javac]
> C:\Java\glassfish\domains\domain1\generated\jsp\j2ee-modules\__default-web-module-server\org\apache\jsp\jspTest\jsp3\SaveName_jsp.java:45:
> cannot find symbol
> [javac] symbol : class UserData
> [javac] location: class org.apache.jsp.jspTest.jsp3.SaveName_jsp
> [javac] user = (UserData)
> _jspx_page_context.getAttribute("user", PageContext.SESSION_SCOPE);
> [javac] ^
>
>
> Generated servlet error:
> [javac]
> C:\Java\glassfish\domains\domain1\generated\jsp\j2ee-modules\__default-web-module-server\org\apache\jsp\jspTest\jsp3\SaveName_jsp.java:47:
> cannot find symbol
> [javac] symbol : class UserData
> [javac] location: class org.apache.jsp.jspTest.jsp3.SaveName_jsp
> [javac] user = new UserData();
> [javac] ^
> [javac] 3 errors
>
>
>
>
>
> Thanks,
> Malachi
>
>
>
> On 4/10/06, *Jan Luehe* <Jan.Luehe_at_sun.com <mailto:Jan.Luehe_at_sun.com>>
> wrote:
>
> Hi Malachi,
>
> Carla Mott wrote On 04/10/06 13:12,:
>
> > Hi Malachi,
> >
> > I'm posting this on the users alias as that is more appropriate for
> > this type of question.
> >
> > Carla
> >
> >
> > Malachi de Ælfweald wrote:
> >
> >> I was trying the tutorial here: http://www.jsptut.com/Forms.jsp
> <http://www.jsptut.com/Forms.jsp>
> >>
> >> When it failed due to being unable to locate the UserData.class (in
> >> same directory as the .jsp files), I went into the admin
> console and
> >> added that directory to the classpath suffix, and restarted the
> server.
> >>
> >> Checking java.class.path from within a JSP shows that the directory
> >> is in fact listed, but it is not able to be located. Best guess is
> >> that glassfish is unable to load .class files from the
> classpath and
> >> is only loading jars.
> >>
> >> After about 2 hours trying to get this resolved, I have to move on
> >> and just assume that Glassfish is incapable of doing it.
> >
> sorry about that!
>
> Can you send us the detailed error message (which includes the JSP
> compilation classpath)
> from your logs?
>
> Thanks,
>
> Jan
>
> >>
> >>
> >> Malachi
> >
> >
> >
>
>