這是控制臺報錯:
org.apache.coyote.http11.Http11AprProtocol start
資訊: Starting Coyote HTTP/1.1 on http-8080
org.apache.coyote.ajp.AjpAprProtocol start
資訊: Starting Coyote AJP/1.3 on ajp-8009
org.apache.catalina.startup.Catalina start
資訊: Server startup in 2919
[http-8080-2]DEBUG[com.opensymphony.xwork2.config.ConfigurationManager]-Checking ConfigurationProviders for reload.
[http-8080-2]DEBUG[com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler]-Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@3987f9f1], property=org]
[http-8080-2]DEBUG[com.opensymphony.xwork2.config.ConfigurationManager]-Checking ConfigurationProviders for reload.
[http-8080-2]DEBUG[com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler]-Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@3987f9f1], property=struts]
[http-8080-2]DEBUG[com.opensymphony.xwork2.config.ConfigurationManager]-Checking ConfigurationProviders for reload.
[http-8080-2]DEBUG[com.opensymphony.xwork2.DefaultActionProxy]-Creating an DefaultActionProxy for namespace / and action name login
[http-8080-2]DEBUG[com.opensymphony.xwork2.config.ConfigurationManager]-Checking ConfigurationProviders for reload.
[http-8080-2]DEBUG[freemarker.cache]-Could not find template in cache, creating new one; id=[org/apache/struts2/dispatcher/error.ftl[zh_CN,utf-8,parsed] ]
[http-8080-2]DEBUG[freemarker.cache]-Compiling FreeMarker template org/apache/struts2/dispatcher/error.ftl[zh_CN,utf-8,parsed] from jar:file:/D:/apache-tomcat-8.5.57-windows-x64/tomcat6.0.45_x64/apache-tomcat-6.0.45/webapps/task/WEB-INF/lib/struts2-core-2.3.1.2.jar!/org/apache/struts2/dispatcher/error.ftl
[http-8080-2]DEBUG[freemarker.beans]-Key 'location' was not found on instance of java.lang.ClassNotFoundException. Introspection information for the class is: {getClass=public final native java.lang.Class java.lang.Object.getClass(), localizedMessage=java.beans.PropertyDescriptor@6a0cdda6, java.lang.Object@4e6d670a=freemarker.ext.beans.MethodMap@743bce70, cause=java.beans.PropertyDescriptor@5bb814ee, getCause=public java.lang.Throwable java.lang.ClassNotFoundException.getCause(), getMessage=public java.lang.String java.lang.Throwable.getMessage(), equals=public boolean java.lang.Object.equals(java.lang.Object), exception=java.beans.PropertyDescriptor@96417f50, hashCode=public native int java.lang.Object.hashCode(), class=java.beans.PropertyDescriptor@5cbec62c, wait=freemarker.ext.beans.MethodMap@26e56ae, fillInStackTrace=public synchronized native java.lang.Throwable java.lang.Throwable.fillInStackTrace(), stackTrace=java.beans.PropertyDescriptor@e6f48cbd, message=java.beans.PropertyDescriptor@d1227e9f, getStackTrace=public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace(), setStackTrace=public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]), notify=public final native void java.lang.Object.notify(), toString=public java.lang.String java.lang.Throwable.toString(), java.lang.Object@32162f16={public void java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])=[Ljava.lang.Class;@19fcbac1, public boolean java.lang.Object.equals(java.lang.Object)=[Ljava.lang.Class;@1f48e23b, public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()=[Ljava.lang.Class;@69fc9f88, public final native java.lang.Class java.lang.Object.getClass()=[Ljava.lang.Class;@484dd014, public java.lang.Throwable java.lang.ClassNotFoundException.getException()=[Ljava.lang.Class;@6c97f621, public java.lang.String java.lang.Throwable.getLocalizedMessage()=[Ljava.lang.Class;@6ca02839, public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable)=[Ljava.lang.Class;@6b0ede6, public native int java.lang.Object.hashCode()=[Ljava.lang.Class;@49d29a78, public java.lang.String java.lang.Throwable.toString()=[Ljava.lang.Class;@219b6225, public java.lang.String java.lang.Throwable.getMessage()=[Ljava.lang.Class;@60487c5f, public final native void java.lang.Object.notify()=[Ljava.lang.Class;@36dd725b, public synchronized native java.lang.Throwable java.lang.Throwable.fillInStackTrace()=[Ljava.lang.Class;@47ed081, public java.lang.Throwable java.lang.ClassNotFoundException.getCause()=[Ljava.lang.Class;@21aac775, public final native void java.lang.Object.notifyAll()=[Ljava.lang.Class;@530ce397}, getException=public java.lang.Throwable java.lang.ClassNotFoundException.getException(), initCause=public synchronized java.lang.Throwable java.lang.Throwable.initCause(java.lang.Throwable), printStackTrace=freemarker.ext.beans.MethodMap@7331f919, notifyAll=public final native void java.lang.Object.notifyAll(), getLocalizedMessage=public java.lang.String java.lang.Throwable.getLocalizedMessage()}
這是瀏覽器上顯示的錯誤:

我在applicationContext.xml中是這么配置的:
<bean id="baseDAO" class="com.framework.dao.hibernate.BaseDAOImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="userDao" class="com.js.task.dao.impl.UserDaoImpl" >
<property name="baseDAO" ref="baseDAO"></property>
</bean>
<bean id="userService" class="com.js.task.service.impl.UserServiceImpl">
<property name="userDao" ref="userDao"></property>
</bean>
<bean id="userAction" class="com.js.task.web.action.UserAction" scope="prototype">
<property name="userService" ref="userService"></property>
</bean>
struts中這樣配置的:
<constant name="struts.objectFactory" value="https://bbs.csdn.net/topics/spring"></constant>
<action name="login" class="userAction" method="login">
<result name="success">/main.jsp</result>
<result name="input">/index.jsp</result>
<result name="login">/login.jsp</result>
</action>
jar包里也匯入了struts2-spring-plugin-2.3.1.2。
并且再UserAction中有這樣的配置:
//提供userService物件的注入物件;
private UserService userService;
public void setUserService(UserService userService) {
this.userService = userService;
}
當把struts.xml檔案里的配置useraction的class換成spring里的beanID時提示無法實體化login中定義的userAction;
當我把struts.xml里得得配置useraction的class換成完整的包名+類名時,會提示空指標例外。并且列印在控制臺的userService的值為null;
當我手動new一個userserviceimpl物體的時候,則程式可以繼續往下走到DAO層。
現在問題查看了晚上的所有有關的問題的解決方案都沒有可以解決的,很困惑。
希望有大神可以為我指點一二,非常感謝。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/65049.html
標籤:Java EE
上一篇:深度解密Go語言之 pprof
下一篇:初學者求教登錄密碼問題
