Glassfish:将 Java 类存储在 docroot 文件夹中?
我对使用 Glassfish 或 JSP 很陌生。
我在 NetBeans(捆绑了 Glassfish)中使用了此功能,但是当我尝试将其放在运行 Glassfish Server 的服务器上时,我真的不知道自己在做什么。
我可以在“domains/domain1/docroot/index.jsp”中放置一个 JSP 文件,当我访问我的站点时它就会工作,但由于某种原因我无法让 Java 类工作。
我将“/build/web/”中的文件从 NetBeans 项目复制到服务器上的 docroot 文件夹中。
当我访问该站点时出现的错误是:
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
实际的 Java 类位于“WEB-INF/classes/test/TestClass.class”中(它是预编译的)。
我真的不知道我做错了什么,所以非常感谢任何帮助。谢谢!
I'm very new to using Glassfish 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为你做错了 - 你需要先创建一个网络存档(战争)。您可能应该从这个开始,真的:
http://download.oracle。 com/javaee/5/tutorial/doc/bnadp.html
要快速入门,请参阅此处的图 3-5:
http://download.oracle.com/javaee/5/tutorial/doc/bnadx.html
'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
请不要使用 docroot 文件夹。这可能适用于像 html 这样的静态内容,但即使这样也不是一个好主意。
最简单的方法是创建一个名为 myapp.war 的新文件夹并复制目标文件夹(从 netbeans 到此文件夹。显然我过度简化了,但我试图阐明我的观点)
此外,您应该能够创建一个 web Netbeans 中的应用程序部署到 glassfish。
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.