我已经从 Netbwans 8 到 Glassfish 4 中部署了一个包含 EJB(RESTFul Web 服务)的 Web 应用程序。这包括一个跨源资源共享过滤器。当我尝试查看 Web 服务的输出(直接从 Web 服务路径,而不是从客户端本身)时,我在浏览器中收到“HTTP 状态 500 - 内部服务器错误”错误。我在论坛中看到,我可能会尝试在 Netbeans 的项目属性中取消选中 Jersey 选项,但我没有看到这样的选项。我在日志中发现的唯一内容是:
Info: WELD-000900 2.0.0 (SP1)
Warning: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
Warning: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
Info: Registering the Jersey servlet application, named com.mycompany.enterprisesample.service.ApplicationConfig, at the servlet mapping /webresources/*, with the Application class of the same name.
Aug 21, 2014 11:31:10 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Aug 21, 2014 11:31:10 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@5c8edb94 in service registry.
最佳答案
添加
<jvm-options>-Djavax.xml.accessExternalSchema=all</jvm-options>
domain.xml
中的代码行文件位于glassfish4\glassfish\domains\domain1\config\domain.xml
文件夹
里面<java-config> </java-config>
标记为:-
<java-config>
.
.
<jvm-options>-Djavax.xml.accessExternalSchema=all</jvm-options>
</java-config>
注意:- 将以上代码行添加到domain.xml 文件的-D..... 代码的最后。在随机位置添加它可能并不能保证这会起作用。
关于java - 如何解决 glassfish 上的 Web 服务应用程序中的 "HTTP Status 500 - Internal Server Error"问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25430395/