将 GWT 部署到 JBoss 时出现 web.xml 问题

发布于 2024-11-08 07:10:08 字数 1503 浏览 0 评论 0原文

我在 GWT 中开发了一个简单的应用程序。之后,我生成 war 文件并将其部署到 JBoss 中。但是,当我这样做时,我收到一条错误消息,例如:

元素类型“web-app”的内容 必须匹配 “(图标?,显示名称?,描述?,可分发?,上下文参数*,过滤器*,过滤器- 映射*、侦听器*、servlet*、servlet 映射*、会话配置?、mime 映射*、欢迎文件列表?、错误页面*、taglib*、资源环境引用*、资源- ref*、安全约束*、登录配置?、安全角色*、env-entry*、ejb-ref*、ejb-local-ref*)"。

另一方面,我的 web.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/resources/spring.xml</param-value>
</context-param>

<!-- Servlets -->
<servlet>
  <servlet-name>greetServlet</servlet-name>
   <servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class>
 </servlet>

<servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
     <url-pattern>/zb_app/greet</url-pattern>
</servlet-mapping>

 <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-    class>
</listener>

 <!-- Default page to serve -->
 <welcome-file-list>
    <welcome-file>ZB_app.html</welcome-file>
 </welcome-file-list>

</web-app>

也就是说,网络应用程序标签包含一些强制标签,我不知道有什么问题,有人可以帮我解决这个问题

I have developed a simple application in GWT. After that, I generate war file and deploy it into JBoss. However, when I do this, I get an error message like:

The content of element type "web-app"
must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-
mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-
ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".

On the other hand, my web.xml is the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/resources/spring.xml</param-value>
</context-param>

<!-- Servlets -->
<servlet>
  <servlet-name>greetServlet</servlet-name>
   <servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class>
 </servlet>

<servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
     <url-pattern>/zb_app/greet</url-pattern>
</servlet-mapping>

 <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-    class>
</listener>

 <!-- Default page to serve -->
 <welcome-file-list>
    <welcome-file>ZB_app.html</welcome-file>
 </welcome-file-list>

</web-app>

It is to say, the web-app tag contains some mandatory tags. I do not what is the problem, could someone help me with the problem?

Thank you in advance!

Regards!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懒的傷心 2024-11-15 07:10:08

尝试将侦听器声明放在 servlet 之前,元素的顺序应该不是问题,但我在某些容器中看到过这种情况(不记得是否是 JBoss)


<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- Servlets -->
<servlet>  
<servlet-name>greetServlet</servlet-name>   
<servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class> </servlet>

<servlet-mapping>    
<servlet-name>greetServlet</servlet-name>     
<url-pattern>/zb_app/greet</url-pattern>
</servlet-mapping> 

Try to put the listener declaration before the servlets, the order of the elements shouldn't be a problem but I've seen this in some container (don't remeber if it was JBoss)


<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- Servlets -->
<servlet>  
<servlet-name>greetServlet</servlet-name>   
<servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class> </servlet>

<servlet-mapping>    
<servlet-name>greetServlet</servlet-name>     
<url-pattern>/zb_app/greet</url-pattern>
</servlet-mapping> 
呆萌少年 2024-11-15 07:10:08

序列应该是 context-param -listener -servlet ,这里是

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/resources/spring.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/zb_app/greet</url-pattern>
    </servlet-mapping>
   <welcome-file-list>
        <welcome-file>ZB_app.html</welcome-file>
    </welcome-file-list>

</web-app>

The sequence should be context-param - listener - servlet and here it is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/resources/spring.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>greetServlet</servlet-name>
        <servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>greetServlet</servlet-name>
        <url-pattern>/zb_app/greet</url-pattern>
    </servlet-mapping>
   <welcome-file-list>
        <welcome-file>ZB_app.html</welcome-file>
    </welcome-file-list>

</web-app>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文