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

时间:2015-05-28 09:03:27

标签: java-ee servlets jboss jboss-eap-6

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

  

无法确定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$000(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$1.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>

1 个答案:

答案 0 :(得分:1)

Failed to determine servlet:如果环境设置正确web.xml

,问题就不会出现

在Web容器(.war)所需的给定方案datasource中,不提供Web存档。这意味着它被不知情的评论,因为intialContext.lookup()失败,这是从过滤类调用的,基本上在Filter

中配置为web.xml(AuthFilter.java)

所以取消评论以下几行解决了问题,这可以启动网络生命周期,因此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

错误
  

引起:java.sql.SQLException:ORA-28001:密码已过期

这表示您设置的数据库密码已过期。转到并重置密码。就我而言,它是Oracle。我的JBoss服务器配置中明确提到了密码 - stanalone.xml。所以我已登录并在SQL Plus命令行实用程序中重置它。

执行此操作时,请确保删除JBoss tmp foler缓存数据,因为Web容器已缓存并且密码存储为容器内的某个状态。