集团网厅项目开发测试问题总结 之 后台问题

 集团网厅开发问题

 

 

 

 /***********************后台bug总结**********************************
下面是在工作中常用的一些后台的bug,
目标:总结常用的问题的解决方法,提高开发效率
开始时间:2011-11-10
编写人:happ
参阅书籍:
相关项目:《集团网厅 》

技术:ssh1+oracle+javaScript||jQuery
*/

  


    1.1 在开发线预约订单查询时,由于是多个表的关联就采用hibernate的语句


     String hql = "from TGroupOrderDTO Z left join fetch Z.tbTGroupInfoDTO A left join fetch Z.tbTPackageDTO B ";
  String whereSql=" and B.tbTOperaDTO.operaId in (select C.operaId from B.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ";
     String hql1 = "from TGroupOrderDTO  ";
  String whereSql1=" and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ";
  在查询list集合时可以,但是在查询总记录时 如果是hql+whereSql则 异常为
  org.springframework.orm.hibernate3.HibernateQueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=A,role=null,tableName=T_GROUP_INFO,tableAlias=tgroupinfo1_,origin=T_GROUP_ORDER tgrouporde0_,colums={tgrouporde0_.GROUP_ID ,className=com.sinovatech.model.dto.TGroupInfoDTO}}] [select count(*) from com.sinovatech.model.dto.TGroupOrderDTO Z left join fetch Z.tbTGroupInfoDTO A left join fetch Z.tbTPackageDTO B  where 1=1 ]; nested exception is org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=A,role=null,tableName=T_GROUP_INFO,tableAlias=tgroupinfo1_,origin=T_GROUP_ORDER tgrouporde0_,colums={tgrouporde0_.GROUP_ID ,className=com.sinovatech.model.dto.TGroupInfoDTO}}] [select count(*) from com.sinovatech.model.dto.TGroupOrderDTO Z left join fetch Z.tbTGroupInfoDTO A left join fetch Z.tbTPackageDTO B  where 1=1 ]
     如果是hql1+whereSql1 对应的异常为
     2012-03-01 10:33:00,827 ERROR [com.sinovatech.common.web.action.BaseAction] - org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: operaId of: com.sinovatech.model.dto.TPackageDTO [select count(*)  from com.sinovatech.model.dto.TGroupOrderDTO  Z  where 1=1  and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ]; nested exception is org.hibernate.QueryException: could not resolve property: operaId of: com.sinovatech.model.dto.TPackageDTO [select count(*)  from com.sinovatech.model.dto.TGroupOrderDTO  Z  where 1=1  and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ]
  org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: operaId of: com.sinovatech.model.dto.TPackageDTO [select count(*)  from com.sinovatech.model.dto.TGroupOrderDTO  Z  where 1=1  and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ]; nested exception is org.hibernate.QueryException: could not resolve property: operaId of: com.sinovatech.model.dto.TPackageDTO [select count(*)  from com.sinovatech.model.dto.TGroupOrderDTO  Z  where 1=1  and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ]
  Caused by: org.hibernate.QueryException: could not resolve property: operaId of: com.sinovatech.model.dto.TPackageDTO [select count(*)  from com.sinovatech.model.dto.TGroupOrderDTO  Z  where 1=1  and Z.tbTPackageDTO.tbTOperaDTO.operaId in (select C.operaId from Z.tbTPackageDTO.tbTOperaDTO C where  C.tbTOperaTypeDTO.operaTypeId=1) ]
  at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
  at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
  at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1358)
  at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
  at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:386)
  at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:566)
  at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:241)
  at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:188)
  at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
  at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
  at org.hibernate.hql.ast.tree.DotNode.resolveSelectExpression(DotNode.java:626)
  at org.hibernate.hql.ast.HqlSqlWalker.resolveSelectExpression(HqlSqlWalker.java:739)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:1885)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1825)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1394)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:553)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.collectionFunctionOrSubselect(HqlSqlBaseWalker.java:4253)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.inRhs(HqlSqlBaseWalker.java:4161)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3842)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1690)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
  at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
  at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
  at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
  at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
  at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
  at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
  at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
  at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
  at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
  at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
  at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1202)
  at $Proxy5.createQuery(Unknown Source)
  at com.sinovatech.common.model.dao.DaoSupport$5.doInHibernate(DaoSupport.java:223)
  at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
  at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
  at com.sinovatech.common.model.dao.DaoSupport.countHql(DaoSupport.java:216)
  at com.sinovatech.model.dao.GroupOrderDAO.list(GroupOrderDAO.java:93)
  at com.sinovatech.model.bpo.GroupOrderBPO.list(GroupOrderBPO.java:189)
  at com.sinovatech.model.bpo.GroupOrderBPO$$FastClassByCGLIB$$90abff17.invoke(<generated>)
  at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
  at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
  at com.sinovatech.model.bpo.GroupOrderBPO$$EnhancerByCGLIB$$befdaf73.list(<generated>)
  at com.sinovatech.model.facade.GroupOrderFacade.list(GroupOrderFacade.java:177)
  at com.sinovatech.back.orderManager.action.GroupOrderAction.queryGroupOrder(GroupOrderAction.java:122)
  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.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
  at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
  at org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:166)
  at com.sinovatech.common.web.action.BaseAction.execute(BaseAction.java:91)
  at com.sinovatech.common.web.action.BaseAdmAction.execute(BaseAdmAction.java:83)
  at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
  at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
  at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
  at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
  at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
  at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at com.sinovatech.common.web.filter.EncodeFilter.doFilter(EncodeFilter.java:59)
  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.Http11Processor.process(Http11Processor.java:859)
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
  at java.lang.Thread.run(Thread.java:662)
 2012-03-01 10:33:00,828 WARN [org.apache.struts.action.ActionMapping] - Unable to find 'commonMapping' forward.
     
     1.2 ectable 列表的分页不能使。始终报下边这个错误。 

 

       行: 422
    错误: 'document.forms.GroupOrderExList.GroupOrderExList_p' 为空或不是对象
     原因:虽然解决了,但是还是没有找到原因,不知道是js包的原因,还是form表单嵌套的原因。
  
  1.3 hibernate批量插入功能

 

   思路: 1 将<prop key="hibernate.jdbc.batch_size">50</prop>可高效的插入
       2 执行下边的代码多次save
        for (Entity en : entityList) {
     getHibernateTemplate().save(entity);
    }


  1.4 时间:2012-3-8

 

  bug描述:
   java.lang.ClassNotFoundException: com.sinovatech.bms.adm.model.dto.TBmsDeptDTO
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
   at java.lang.Class.getDeclaredMethods0(Native Method)
   at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
   at java.lang.Class.getMethod0(Class.java:2670)
   at java.lang.Class.getMethod0(Class.java:2679)
   at java.lang.Class.getMethod(Class.java:1603)
   at org.apache.struts.actions.DispatchAction.getMethod(DispatchAction.java:348)
   at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:252)
   at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
   at org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:166)
   at com.sinovatech.common.web.action.BaseAction.execute(BaseAction.java:91)
   at com.sinovatech.common.web.action.BaseAdmAction.execute(BaseAdmAction.java:83)
   at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
   at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
   at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
   at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
   at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at com.sinovatech.common.web.filter.EncodeFilter.doFilter(EncodeFilter.java:59)
   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.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
 
 1.5 错误:在引用ectable控件,点击翻页时报错 

 

  消息: 'document.forms.MemberOrderExList.MemberOrderExList_p' 为空或不是对象
  行: 510
  字符: 1
  代码: 0
  URI: http://10.70.26.196:8080/jtwt/back/groupOrder/handleOrderDetail.do?groupOrderId=2
 
  原因:在ectable控件外边又多了一个form,因为ectable控件本身就会生成form,导致不能翻页(form 表单不能嵌套,这是html的一种规范和定义)
      解决方案:去掉外边的form 就行了
      
   1.6 在做前台的订单查询时【2012-3-13】


         错误:前台首页显示不完全,js报错,没有样式
         原因:在配置文件web.xml中配置了安全包的过滤器进行了拦截
         解决日期:【2012-3-14】
         解决方法:将下边这个配置注释掉
         <filter-mapping>
  <filter-name>securityFilter</filter-name>
  <url-pattern>/front/*</url-pattern>
     </filter-mapping>
  

你可能感兴趣的:(总结)