无法确定 servlet:java.lang.NullPointerException 在 org.jboss.as.web.deployment.JBossContextConfig.beforeLoadOnStartup

Failed to determine servlet: java.lang.NullPointerException at org.jboss.as.web.deployment.JBossContextConfig.beforeLoadOnStartup

我正在将 WebSphere 应用程序迁移到 JBoss EAP 6.4。在部署期间,我收到以下错误:

Failed to determine servlet: java.lang.NullPointerException

使用此堆栈跟踪:

12:48:06,194 DEBUG [org.jboss.as.security] (MSC service thread 1-2) Qualified url patterns: {/=PatternInfo[pattern=/,type=3,isOverridden=false,qualifiers=[]]}
12:48:06,194 FINE  [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 132) ConfigureListener.contextInitialized(/scWeb)
12:48:06,224 DEBUG [org.jboss.as.web.security] (ServerService Thread Pool -- 96) Failed to determine servlet: java.lang.NullPointerException
    at org.jboss.as.web.deployment.JBossContextConfig.beforeLoadOnStartup(JBossContextConfig.java:666) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:178) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.jboss.as.web.deployment.JBossContextConfig.lifecycleEvent(JBossContextConfig.java:260) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3592) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3802) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
    at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.web.deployment.WebDeploymentService.access[=12=]0(WebDeploymentService.java:61) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.web.deployment.WebDeploymentService.run(WebDeploymentService.java:96) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.FutureTask.run(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_45]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_45]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

12:48:43,934 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name inbaghpc00516
12:52:40,593 ERROR [org.jboss.as.controller.management-operation] (HttpManagementService-threads - 1) JBAS013412: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "PCB-5.3.ear")]'

这是怎么引起的,我该如何解决?

这是我对 scweb 的配置...

web.xml.....

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_1234567890" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Shortcode Management Web</display-name>
    <distributable />

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext-*.xml</param-value>
    </context-param>

    <filter>
        <filter-name>authenticationFilter</filter-name>
        <filter-class>
            com.singtel.pcb.scweb.filter.AuthenticationFilter
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>authenticationFilter</filter-name>
        <url-pattern>*.do</url-pattern>
    </filter-mapping>

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

    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>
            org.apache.struts.action.ActionServlet
        </servlet-class>        
        <init-param>
            <param-name>config</param-name>
            <param-value>
                /WEB-INF/struts-config.xml
            </param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>2</param-value>
        </init-param>
        <init-param>
            <param-name>detail</param-name>
            <param-value>2</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

        <!-- Struts Action Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

<!--    
    <resource-ref id="ResourceRef_12345678909">
        <res-ref-name>jdbc/pcbDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
 -->    
    <error-page>
        <error-code>404</error-code>
        <location>/404.html</location>
    </error-page>
</web-app>

struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>

    <!-- Form Beans -->

    <form-beans>
        <form-bean name="LoginForm"  type="com.singtel.pcb.scweb.forms.LoginActionFormBean" />
        <!--many like this-->
        </form-beans>

    <global-forwards>
        <!-- Default forward to "Welcome" action -->
        <!-- Demonstrates using index.jsp to forward -->
        <forward name="failure" path="/Error.jsp" />
        <forward name="response" path="/Response.jsp" />
        <forward name="Error" path="/Error.jsp" />
    </global-forwards>    

    <action-mappings>
        <action 
            name="LoginForm"
            attribute="LoginForm"
            type="com.singtel.pcb.scweb.action.LoginAction"
            path="/pages/login" 
            input="/pages/login.jsp"
            scope="request" 
            validate="true">
                <forward name="ShortcodeHome" path="/pages/lumlum.jsp" />
                <forward name="NumberLevelHome" path="/pages/sumnum.jsp" />
                <forward name="Failure" path="/pages/login.jsp" />
        </action>
        <!--many like this-->
    </action-mappings>

    <controller locale="false" maxFileSize="500K" nocache="true" processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />                  

    <message-resources parameter="com.singtel.pcb.scweb.resource.ApplicationResources"/>

    <plug-in
        className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation"
            value="/WEB-INF/actions-*.xml" />
    </plug-in>

    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames"
            value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
    </plug-in>

</struts-config>

applicationContext-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
    "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>

    <bean id="userRoleService" class="com.singtel.pcb.sam.dto.UserRoleService">
        <property name="dataSource" ref="dataSource"></property>
    </bean>

    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>
                    classpath:com/singtel/pcb/scweb/resource/scweb.properties
                </value>
            </list>
        </property>
    </bean>

    <bean id="dataSource" 
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
        <value>${database.connection.datasource}</value>
        </property>
    </bean>

</beans>

Failed to determine servlet: 如果 web.xml.

的环境设置正确,问题就不会出现

在给定场景 datasource 中,未提供 Web 容器 (.war) 所需的 Web 存档。这意味着它由 unawareness 评论,因为 intialContext.lookup() 失败,它是从过滤器 类 调用的,过滤器 类 基本上配置为 Filter (AuthFilter.java) 在 web.xml

所以取消注释以下行解决了问题,可以启动网络生命周期,所以Failed to determine servlet问题解决了....

<resource-ref id="ResourceRef_12345678909">
    <res-ref-name>jdbc/pcbDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

除了查找此错误之外,它还可能会引发我们在此处针对 web container

讨论的相同错误

Caused by: java.sql.SQLException: ORA-28001: the password has expired

说明您设置的数据库密码已过期。去重设密码。就我而言,它是甲骨文。我的 JBoss 服务器配置中明确提到了密码,- stanalone.xml。所以我已经登录并在 SQL Plus Command Line Utility 中重置它。

执行此操作时还要确保删除 JBoss tmp foler 缓存数据,因为 Web 容器已被缓存并且密码作为状态存储在容器中的某处。