本地tomcat运行正常,挂上sae就报错

时间:2021-08-11 15:59:27
Problem accessing /user.do. Reason:

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.androidpn.server.console.controller.UserController]: Constructor threw exception; nested exception is java.lang.NullPointerException
Caused by:

org.eclipse.jetty.servlet.ServletHolder$1: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.androidpn.server.console.controller.UserController]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.eclipse.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:408)
at com.sina.sae.servlet.SaeServletHolder.initServlet(SaeServletHolder.java:56)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:260)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:765)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:245)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1208)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:586)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:449)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:180)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:482)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
at com.sina.sae.deploy.providers.SaeWebAppProvider.fileAdded(SaeWebAppProvider.java:113)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:50)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:601)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:531)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:394)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:329)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:114)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:543)
at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:218)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:41)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:50)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
at org.eclipse.jetty.server.Server.doStart(Server.java:258)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1197)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1120)
at com.sina.sae.logv2.SaeUserInfoParser.main(SaeUserInfoParser.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:624)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:469)
at org.eclipse.jetty.start.Main.start(Main.java:612)
at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:265)
at org.eclipse.jetty.start.Main.main(Main.java:79)

4 个解决方案

#1


错误标题是  HTTP ERROR 503 其实后面还有一大堆报错信息,但是看着差不多就只复制了前面一段

库里的 standard.jar和xml-apis.jar已经删了,没用到servlet-api.jar,不知道还有没有其他冲突的jar包

本地运行正常,用到了mysql数据库,然后挂到SAE上之后就用了新浪的mysql,jdbc配置应该没问题,毕竟看到mysql里的表在程序运行后已经创建了。

求高手们赐教~~不胜感激

#2


附上dispatcher-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/user_api.do=userapiController
/notification_api.do=notificationapiController
/index.do=filenameController
/user.do=userController
/session.do=sessionController
/notification.do=notificationController
</value>
</property>
<property name="order" value="1" />
</bean>

<bean id="userapiController" class="org.androidpn.server.console.api.UserApiController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="notificationapiController" class="org.androidpn.server.console.api.NotificationApiController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="filenameController"
class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />

<bean id="userController" class="org.androidpn.server.console.controller.UserController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="sessionController"
class="org.androidpn.server.console.controller.SessionController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="notificationController"
class="org.androidpn.server.console.controller.NotificationController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="paramResolver"
class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
<property name="paramName" value="action" />
<property name="defaultMethodName" value="list" />
</bean>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="requestContextAttribute" value="rc" />
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>

<!--
<bean id="exceptionResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings"> <props> <prop
key="java.lang.Exception">error</prop> </props> </property> </bean>
-->

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
<property name="useCodeAsDefaultMessage" value="true" />
</bean>

</beans>

#3


看看配置吧
userController
好像是说,实例化urlMapping 的时候,发现 userController 这个是空指。。报空指针异常。。

查下代码,是否因为没有配置好。

#4


引用 3 楼 wrong1111 的回复:
看看配置吧
userController
好像是说,实例化urlMapping 的时候,发现 userController 这个是空指。。报空指针异常。。

查下代码,是否因为没有配置好。
我看看,不过本地运行正常啊。。。

#1


错误标题是  HTTP ERROR 503 其实后面还有一大堆报错信息,但是看着差不多就只复制了前面一段

库里的 standard.jar和xml-apis.jar已经删了,没用到servlet-api.jar,不知道还有没有其他冲突的jar包

本地运行正常,用到了mysql数据库,然后挂到SAE上之后就用了新浪的mysql,jdbc配置应该没问题,毕竟看到mysql里的表在程序运行后已经创建了。

求高手们赐教~~不胜感激

#2


附上dispatcher-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/user_api.do=userapiController
/notification_api.do=notificationapiController
/index.do=filenameController
/user.do=userController
/session.do=sessionController
/notification.do=notificationController
</value>
</property>
<property name="order" value="1" />
</bean>

<bean id="userapiController" class="org.androidpn.server.console.api.UserApiController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="notificationapiController" class="org.androidpn.server.console.api.NotificationApiController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="filenameController"
class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />

<bean id="userController" class="org.androidpn.server.console.controller.UserController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="sessionController"
class="org.androidpn.server.console.controller.SessionController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="notificationController"
class="org.androidpn.server.console.controller.NotificationController">
<property name="methodNameResolver" ref="paramResolver" />
</bean>

<bean id="paramResolver"
class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver">
<property name="paramName" value="action" />
<property name="defaultMethodName" value="list" />
</bean>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="requestContextAttribute" value="rc" />
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".jsp" />
</bean>

<!--
<bean id="exceptionResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings"> <props> <prop
key="java.lang.Exception">error</prop> </props> </property> </bean>
-->

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
<property name="useCodeAsDefaultMessage" value="true" />
</bean>

</beans>

#3


看看配置吧
userController
好像是说,实例化urlMapping 的时候,发现 userController 这个是空指。。报空指针异常。。

查下代码,是否因为没有配置好。

#4


引用 3 楼 wrong1111 的回复:
看看配置吧
userController
好像是说,实例化urlMapping 的时候,发现 userController 这个是空指。。报空指针异常。。

查下代码,是否因为没有配置好。
我看看,不过本地运行正常啊。。。