2013年10月31日星期四

spring managed bean, whether new objects

dao layer refers to an object
public List getRptHead(String rno)throws Exception {
// TODO Auto-generated method stub
return TableHeade.getHead(rno);
}

In this TableHeade class has a static method : getHead (rno);
Methods

public static List getHead(String rno)
throws Exception
{DBManage db = new DBManage();}

When performing getHead (String rno) method when the error
java.lang.NoClassDefFoundError: com / aaa / bbb / util / DBManage
cn.sundatasoft.util.TableHeade.getHead (TableHeade.java: 27)
cn.sundatasoft.ibatis.dao.rpt.impl.ReportDaoImpl.getRptHead (ReportDaoImpl.java: 14)
cn.sundatasoft.rpt.service.impl.ReportServiceImpl.getRptHead (ReportServiceImpl.java: 17)
sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java: 39)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java: 25)
java.lang.reflect.Method.invoke (Method.java: 324)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection (AopUtils.java: 304)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java: 182)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java: 149)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java: 106)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java: 171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java: 204)
$ Proxy9.getRptHead (Unknown Source)
cn.sundatasoft.rpt.action.ReportAction.execute (ReportAction.java: 30)
org.apache.struts.action.RequestProcessor.processActionPerform (RequestProcessor.java: 431)
org.apache.struts.action.RequestProcessor.process (RequestProcessor.java: 236)
org.apache.struts.action.ActionServlet.process (ActionServlet.java: 1196)
org.apache.struts.action.ActionServlet.doGet (ActionServlet.java: 414)
javax.servlet.http.HttpServlet.service (HttpServlet.java: 689)
javax.servlet.http.HttpServlet.service (HttpServlet.java: 802)
not new to this DBManage do ?
do not want to spring to manage DBManage


------ Solution ------------------------------------ --------
not configured will not be managed as if the class file not found error oh .
------ For reference only -------------------------------------- -
you this DBManage, is DAO do ? , As if spring is under the management of the DAO single yo. . .

DAO, not by spring management, then you are ready to whom manage it

------ For reference only ---------------------------------- -----
you this should be a port, you need the time to write his new implementation class
------ For reference only -------------- -------------------------
agree on the second floor , or should we use spring to manage , to save you a lot of things to consider
- ---- For reference only ---------------------------------------
you call static methods , and do you need spring does not matter.
getHead did not look at you with a return;
------ For reference only -------------------------- -------------

roof , the landlord why so much trouble with a method only for the new object directly in the new one DBManage dao object is not on the line.
------ For reference only -------------------------------------- -
java.lang.NoClassDefFoundError: com / aaa / bbb / util / DBManage
amount , this seems to find DBManage class , your landlord DBManage class is placed com.aaa.bbb.util package under you, and your rewrite this class constructor try Moreover achieve serializable try.
------ For reference only -------------------------------------- -
java.lang.NoClassDefFoundError: com / aaa / bbb / util / DBManage
is the class did not find , spring in a single new instantiate an object , but you should also be able to ... Why not spring injection ?
------ For reference only -------------------------------------- -
should be. Do not let spring manage it !
------ For reference only -------------------------------------- -
not be able to do without
As long as your method of operation is the
are established
To ensure correct logic
------ For reference only ------------------------------ ---------
this class can not be found ? When deployed , the class did not release past.

------ For reference only ---------------------------------- -----
is my jar package to fight the wrong, can new
sometimes not spring to manage
example util class
------ For reference only ------------------------------ ---------
when more than 100 objects of the bean , when , you know to use Spring bean object object Management benefits of

没有评论:

发表评论