Glassfish: Storing Java classes in the docroot folder?
I'm very new to using Glassfish 开发者_JAVA百科or JSP.
I have this working in NetBeans (which has Glassfish bundled) but when I try to put it on my server which is running Glassfish Server, I really don't know what I'm doing.
I can place a JSP file in "domains/domain1/docroot/index.jsp" and it will work when I visit my site, but I can't, for some reason, get Java classes to work.
I copied the files in "/build/web/" from the NetBeans project to the docroot folder on my server.
The errors I get when I visit the site are:
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6199: Generated servlet error:
string:///index_jsp.java:7: package test does not exist
PWC6197: An error occurred at line: 5 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:///index_jsp.java:52: cannot find symbol
symbol : class TestClass
location: class org.apache.jsp.index_jsp
PWC6197: An error occurred at line: 5 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
string:///index_jsp.java:52: cannot find symbol
symbol : class TestClass
location: class org.apache.jsp.index_jsp
The actual Java class is in "WEB-INF/classes/test/TestClass.class" (it is pre-compiled).
I really have no idea what I'm doing wrong so any help is greatly appreciated. Thanks!
'Cause you're doing it wrong - you need to make a web archive first (war). You should probably start with this, really:
http://download.oracle.com/javaee/5/tutorial/doc/bnadp.html
And for a quick start refer to figure 3-5 here:
http://download.oracle.com/javaee/5/tutorial/doc/bnadx.html
Please do not use the docroot folder. That might work for static contents like html, but even that is not a good idea.
The simplest way is to create a new folder called myapp.war and copy your target folder (from netbeans to this folder.Obviously I am over simplifying and but I am trying to get my point across )
Also you should be able to create a web app in netbeans deploy in place to glassfish.
精彩评论