2013年11月19日星期二

White distress DAO problem

ICustomerDAO.getaa ()
DAO method inside a short sale with a pointer to the next configuration file check did not find anything wrong Mongolia laps
Here is all the code


CustCustomerAction.java

import java.io.Serializable;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.hibernate.criterion.Restrictions;

import com.javalines.hibernate.dao.base.IBaseDAO;
import com.javalines.hibernate.dao.cust.ITbCustCustomerDAO;
import com.javalines.hibernate.page.EntityView;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;
import com.javalines.struts2.action.base.BaseAction;
import com.javalines.util.AjaxUtils;

public class CustCustomerAction extends BaseAction<TbCustCustomer> implements
ServletRequestAware, ServletResponseAware, SessionAware,
ApplicationAware {
public final static String ID_LIST_PARAM = "idList";
public final static String PAGE_NUM_PARAM = "nowPage";
// request
protected HttpServletRequest request;
// response
protected HttpServletResponse response;
// HTTP session
protected Map<String, Object> session;
// application
protected Map<String, Object> application;
private ITbCustCustomerDAO ICustomerDAO;

public ITbCustCustomerDAO getICustomerDAO() {
return ICustomerDAO;
}

public void setICustomerDAO(ITbCustCustomerDAO customerDAO) {
ICustomerDAO = customerDAO;
}

public void setApplication(Map<String, Object> arg0) {
this.application = arg0;
}

public void setSession(Map<String, Object> arg0) {
this.session = arg0;
}

public void setServletResponse(HttpServletResponse arg0) {
this.response = arg0;
}

public void setServletRequest(HttpServletRequest arg0) {
this.request = arg0;
}


public IBaseDAO<TbCustCustomer, Serializable> getEntityDAO() {
// TODO Auto-generated method stub
return null;
}

public void checkLoginName(){
try{
String username = request.getParameter("username");
System.out.println(ICustomerDAO.getaa());

AjaxUtils.renderJson(json);
}catch(Exception e){
e.printStackTrace();
}


}




struts_mall.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="mallPkg" extends="struts-default" namespace="">
<interceptors>
<!-- 定义拦截堆栈 -->
<interceptor-stack name="myDefault">
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<!-- 定义预定义堆栈 -->
<default-interceptor-ref name="myDefault"></default-interceptor-ref>
<!-- 定义全局结果集 -->
<global-results>
<result name="login">../mall/buyerLogin.jsp</result>
<result name="error">/base/500.jsp</result>
<result name="vcellException">/base/vcellException.jsp</result>
<result name="vcell.invalid.token">/base/duplicateSubmit.jsp</result>
</global-results>
<!-- 配置拦截器完成 -->
<!-- 配置全局异映射 -->
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.NullPointerException"></exception-mapping>
<exception-mapping result="error" exception="java.lang.ArithmeticException"></exception-mapping>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
<exception-mapping result="vcellException" exception="com.javalines.system.VCellException"></exception-mapping>
</global-exception-mappings>

<action name="CustCustomerAction" class="com.javalines.struts2.action.cust.CustCustomerAction">
<result name="success">/result.jsp</result>
</action>

</package>
</struts>




ITbCustCustomerDAO.java


import java.io.Serializable;

import com.javalines.hibernate.dao.base.IBaseDAO;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;
public interface ITbCustCustomerDAO extends IBaseDAO<TbCustCustomer,Serializable> {
public String getaa();
}




TbCustCustomerDAOImpl.java


import java.io.Serializable;

import com.javalines.hibernate.dao.base.BaseDAO;
import com.javalines.hibernate.pojo.cust.TbCustCustomer;

public class TbCustCustomerDAOImpl extends BaseDAO<TbCustCustomer,Serializable> implements
ITbCustCustomerDAO {

@Override
public Class<TbCustCustomer> getEntityClass() {
return TbCustCustomer.class;
}

public String generateCodeForApp(String type) {
// TODO Auto-generated method stub
return null;
}

public String generateCodeForCoupon(String type) {
// TODO Auto-generated method stub
return null;
}

public String generateCodeForCouponPurse(String couponNum, String type) {
// TODO Auto-generated method stub
return null;
}

public String generateNumForCoupon(String type) {
// TODO Auto-generated method stub
return null;
}

public String getaa(){
return "bb";
}
}






applicationContext_mall.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="CustCustomerAction" scope="session" class="com.javalines.struts2.action.cust.CustCustomerAction">
    <property name="ICustomerDAO" ref="TbCustCustomerDAOImpl"></property>
    </bean>
   <bean id="TbCustCustomerDAOImpl" class="com.javalines.hibernate.dao.cust.TbCustCustomerDAOImpl">
<property name="hibernateTemplate" ref="ht"></property>
</bean>
</beans>

------ Solution ------------------------------------- -------
given problem may be the size of the
private ITbCustCustomerDAO ICustomerDAO;
changed
private ITbCustCustomerDAO i CustomerDAO;
try
------ Solution ---------------------------------- ----------
System.out.println (ICustomerDAO.getaa ());
exception phrase it.
ICustomerDAO certainly not object instantiation .
ICustomerDAO is where the injected ?
------ Solution ---------------------------------------- ----
landlord ah you simply can not give spring action management course, not injected . You struts.xml inside
/ result.jsp

This action is generated by the object factory struts2 not use spring object factory that generates course not injected , struts.xml plus
then CustCustomerAction ">
/ result.jsp

Here's class , you can use that action spring configuration inside the beanId the
------ For reference only ------------------- --------------------
reported abnormal hair also look under the
------ For reference only ------- --------------------------------
mediated one is no exception in the try catch ; catch exceptions ... see

java.lang.NullPointerException
at com.javalines.struts2.action.cust.CustCustomerAction.checkLoginName (CustCustomerAction.java: 72)
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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction (DefaultActionInvocation.java: 440)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly (DefaultActionInvocation.java: 279)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 242)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept (DefaultWorkflowInterceptor.java: 163)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept (ValidationInterceptor.java: 249)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept (AnnotationValidationInterceptor.java: 68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept (ConversionErrorInterceptor.java: 122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept (ParametersInterceptor.java: 195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept (StaticParametersInterceptor.java: 148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept (CheckboxInterceptor.java: 93)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept (FileUploadInterceptor.java: 235)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept (ModelDrivenInterceptor.java: 89)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept (ScopedModelDrivenInterceptor.java: 128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept (ProfilingActivationInterceptor.java: 104)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept (DebuggingInterceptor.java: 267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept (ChainingInterceptor.java: 126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept (PrepareInterceptor.java: 138)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept (MethodFilterInterceptor.java: 87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept (I18nInterceptor.java: 148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept (ServletConfigInterceptor.java: 164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept (AliasInterceptor.java: 128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept (ExceptionMappingInterceptor.java: 176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java: 236)
at org.apache.struts2.impl.StrutsActionProxy.execute (StrutsActionProxy.java: 52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java: 468)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java: 395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at net.bull.javamelody.MonitoringFilter.doFilter (MonitoringFilter.java: 381)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 298)
at org.apache.coyote.http11.Http11AprProcessor.process (Http11AprProcessor.java: 859)
at org.apache.coyote.http11.Http11AprProtocol $ Http11ConnectionHandler.process (Http11AprProtocol.java: 579)
at org.apache.tomcat.util.net.AprEndpoint $ Worker.run (AprEndpoint.java: 1555)
at java.lang.Thread.run (Thread.java: 619)
------ For reference only ------------------ ---------------------

xml inject instantiation seems to be right from the factory to instantiate white confused ah
------ For reference only ---------------------------------------


really big thank god

没有评论:

发表评论