简体   繁体   English

GlassFish 5:错误:HTTP状态404-找不到

[英]GlassFish 5: Error: HTTP Status 404 - Not Found

I am developing an XML based Web Service, but firstly i wanted to see wether a java class would be executed on a server. 我正在开发基于XML的Web服务,但首先,我想看看是否可以在服务器上执行Java类。 The server of my choosing was GlassFish 5. After a ride with all the setting i got it runing, now as you can see i stumbled upon this kind of Error 我选择的服务器是GlassFish5。经过所有设置后,我开始运行它,现在您可以看到我偶然发现了这种错误

在此处输入图片说明

My Code ExampleWs: 我的代码示例

package ws;

import javax.jws.WebService;

@WebService
    public class ExampleWs {

        public String getText() {
            return "Some Text";
        }

    }

Now i want to know what can be done in order to solve this Error. 现在,我想知道可以解决此错误的方法。 I also tried another way of deploying ExampleWs.java -> directly through asadmin with Command Prompt, but there is this error: 我还尝试了另一种直接通过带命令提示符的asadmin部署ExampleWs.java->的方法,但是存在此错误:

在此处输入图片说明

您是否配置了web.xml

To my knowledge you cannot deploy just a class file. 据我所知,您不能仅部署类文件。 You need to create some kind of archive that contains your classes along with some other information (eg deployment descriptor that tells the application server what to do with the contained classes). 您需要创建某种存档,其中包含您的类以及一些其他信息(例如,部署描述符告诉应用程序服务器如何处理所包含的类)。

If you want to create a web application then the kind of archive will most likely be a WAR (web archive). 如果要创建Web应用程序,则存档的类型很可能是WAR(Web存档)。

If you are using Eclipse IDE for JEE Developers you should be able to right-click on your project and from there export it as a WAR. 如果您将Eclipse IDE用于JEE开发人员,则应该能够右键单击您的项目,然后将其导出为WAR。

How to make war file in Eclipse 如何在Eclipse中制作War文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM