개발 등/SPRING

Springframework 에러문 종류

darkhorizon 2009. 4. 13. 22:52
728x90
반응형
public class StudentActionBD {
 private static StudentActionBD instance;
 private Connection conn;
 private StudentDAO stuDAO;
 
 public static StudentActionBD getInstance(){
  if(instance==null)
   return new StudentActionBD();
  return instance;
 }
 
 public Dataset getStudentList(String grade, String aclass) throws Exception {
  conn=DBConnection.getConnection();
  return stuDAO.getStudentList(conn, grade, aclass);
 }
}

===========================================================================
<bean name="studentAction" class="org.neis.action.StudentAction">
 <property name="bd" ref="studentBd"/>
</bean>
<bean name="studentBd" class="org.neis.bd.StudentActionBD"
 factory-method="getInstance">
 <property name="stuDAO">
  <ref bean="studentDAO"/>
 </property>
</bean> 
<bean name="studentDAO" class="org.neis.dao.StudentDAO"
 factory-method="getInstance"/>

===============================================================================
심각: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'studentBd' while setting bean property 'bd'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentBd' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'stuDAO' of bean class [org.neis.bd.StudentActionBD]: No property 'stuDAO' found

=======================================================================================================
원인 : 프라퍼티 DI 설정은 해 두었지만, 대상 클래스에 프라퍼티에 대한 setter 메서드가 정의되어 있지 않아서 발생한 에러.

해결 : 해당 프라퍼티의 setter 메서드를 추가한다
public void setStuDAO(StudentDAO stuDAO){
  this.stuDAO=stuDAO;
 }


 

심각: Exception starting filter struts2
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.alwaysRespect'] in public org.apache.struts2.spring.StrutsSpringObjectFactory(java.lang.String,java.lang.String,java.lang.String,javax.servlet.ServletContext).
 at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290)
 at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:117)
 at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:115)
 at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542)
 at com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:114)
 at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:145)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

==============================================================================================
원인 : struts2-spring-plugin-x.x.x.jar 파일의 버전 문제로 보인다.
현재(2009.04) 최신버전인 struts2-spring-plugin-2.1.6.jar을 설치했을 때 발생했다.

해결 : struts2-spring-plugin-2.0.9.jar 을 설치하니, 아무런 문제가 발생하지 않는다.


 

728x90