`
bibiye
  • 浏览: 168485 次
社区版块
存档分类
最新评论

XFire异常:Could not get property {http://lang.java} classes

阅读更多
程序分为dao、Service、XFire层,不用XFire层时程序测试通过,加上XFire后,出现如下异常,疑为XFire不支持类的泛型。
 
异常 代码
  1. Exception in thread "Thread-2" org.codehaus.xfire.XFireRuntimeException: Couldn't write stream.. Nested exception is org.codehaus.xfire.XFireRuntimeException: Couldn't get property {http://lang.java}classes from bean class cn.cetelem.accounting.model.CsiAcctPmtHistory. Nested exception is java.lang.reflect.InvocationTargetException: null   
  2. org.codehaus.xfire.XFireRuntimeException: Couldn't get property {http://lang.java}classes from bean class cn.cetelem.accounting.model.CsiAcctPmtHistory. Nested exception is java.lang.reflect.InvocationTargetException: null   
  3. java.lang.reflect.InvocationTargetException   
  4.     at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)   
  5.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   
  6.     at java.lang.reflect.Method.invoke(Unknown Source)   
  7.     at org.codehaus.xfire.aegis.type.basic.BeanType.readProperty(BeanType.java:467)   
  8.   
  9. ……   
  10. ……   
  11.   
  12. Caused by: java.lang.StackOverflowError   
  13.     at java.security.AccessController.doPrivileged(Native Method)   
  14.     at java.lang.Class.getClasses(Unknown Source)   
  15.     at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)   
  16.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   
  17.     at java.lang.reflect.Method.invoke(Unknown Source)   
  18.     at org.codehaus.xfire.aegis.type.basic.BeanType.readProperty(BeanType.java:467)   
  19.     at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:402)   
  20.     at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:417)   
  21. …………   
  22. …………   
  23.     at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:417)   
  24. 2007-10-15 21:31:14,953 ERROR [org.codehaus.xfire.service.binding.PostInvocationHandler] - 
  25. 2007-10-15 21:31:14,953 ERROR [org.codehaus.xfire.handler.DefaultFaultHandler] -    
  26. org.codehaus.xfire.XFireRuntimeException: Couldn't read stream.. Nested exception is com.ctc.wstx.exc.WstxIOException: Write end dead   
  27. com.ctc.wstx.exc.WstxIOException: Write end dead   
  28.     at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:650)   
  29.     at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1071)   
  30.     at org.codehaus.xfire.transport.local.LocalChannel.sendViaNewChannel(LocalChannel.java:175)   
  31.     at org.codehaus.xfire.transport.local.LocalChannel.send(LocalChannel.java:75)   
  32.     at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)   
  33. …………   
  34. …………  

 

关键问题出在Page对象。

java 代码
  1.   
  2. public class Page<T><t></t><t></t> implements Serializable {   
  3.     private Class<T><t></t><t></t> entityClass;   
  4.   
  5.     /**  
  6.      * long:serialVersionUID  
  7.      */  
  8.     private static final long serialVersionUID = -5732135470845307885L;   
  9.   
  10.     public static int DEFAULT_PAGE_SIZE = 10;   
  11.   
  12.     private int pageSize = DEFAULT_PAGE_SIZE; // records per page   
  13.   
  14.     private int start; // the location of the first record of list in curren   
  15.   
  16.   
  17.     private List<T><t></t><t></t> list; // records in current page   
  18.   
  19.     private int totalCount; // total records   
  20.   
  21.     private int currentPageNo;   
  22.        
  23.     private int totalPageCount;   
  24.   
  25.   
  26.     /**  
  27.      * @return Returns the entityClass.  
  28.      */  
  29.     public Class<T><t></t><t></t> getEntityClass() {   
  30.         return this.entityClass;   
  31.     }   
  32.   
  33.     /**  
  34.      * @param entityClass  
  35.      *            The entityClass to set.  
  36.      */  
  37.     public void setEntityClass(Class<T><t></t><t></t> entityClass) {   
  38.         this.entityClass = entityClass;   
  39.     }   
  40.   
  41.   
  42.     /**  
  43.      * construct method by default.  
  44.      *   
  45.      * @param start  
  46.      *            the location of the first record of list in current page ,  
  47.      *            starting form 0.  
  48.      * @param totalSize  
  49.      *            total pages  
  50.      * @param pageSize  
  51.      *            records per page  
  52.      * @param list  
  53.      *            records in current page  
  54.      */  
  55.     public Page(int start, int totalSize, int pageSize, List<T><t></t><t></t> list,   
  56.             Class<T><t></t><t></t> entityClass) {   
  57.          this.entityClass = entityClass;   
  58.         System.out.println("Page.getEntityClass()=" + entityClass.getName());   
  59.         this.pageSize = pageSize;   
  60.         this.start = start;   
  61.         this.totalCount = totalSize;   
  62.         this.list = list;   
  63.     }   
  64.   
  65.     /**  
  66.      * Get total records.  
  67.      */  
  68.     public int getTotalCount() {   
  69.         return this.totalCount;   
  70.     }   
  71.   
  72.     /**  
  73.      * Get total pages.  
  74.      */  
  75.     public int getTotalPageCount() {   
  76.         if (totalCount % pageSize == 0)   
  77.             totalPageCount = totalCount / pageSize;   
  78.         else  
  79.             totalPageCount = totalCount / pageSize + 1;   
  80.         return totalPageCount;   
  81.     }   
  82.   
  83.     /**  
  84.      * Get records per page.  
  85.      */  
  86.     public int getPageSize() {   
  87.         return pageSize;   
  88.     }   
  89.   
  90.     /**  
  91.      * Get records in current page.  
  92.      */  
  93.     public List<T><t></t><t></t> getList() {   
  94.         return list;   
  95.     }   
  96.   
  97.     /**  
  98.      * Get current page number,starting from 1.  
  99.      */  
  100.     public int getCurrentPageNo() {   
  101.         currentPageNo = start / pageSize + 1;   
  102.         return currentPageNo;   
  103.     }   
  104.   
  105.     /**  
  106.      * Judge whether there is next page.  
  107.      */  
  108.     public boolean hasNextPage() {   
  109.         return this.getCurrentPageNo() < this.getTotalPageCount() - 1;   
  110.     }   
  111.   
  112.     /**  
  113.      * Judge whether there is pre page.  
  114.      */  
  115.     public boolean hasPreviousPage() {   
  116.         return this.getCurrentPageNo() > 1;   
  117.     }   
  118.   
  119.     /**  
  120.      * Get the location of the first record of list in any page. It use default  
  121.      * value of records per page.  
  122.      *   
  123.      * @see #getStartOfPage(int,int)  
  124.      */  
  125.     protected static int getStartOfPage(int pageNo) {   
  126.         return getStartOfPage(pageNo, DEFAULT_PAGE_SIZE);   
  127.     }   
  128.   
  129.     /**  
  130.      * Get the location of the first record of list in any page.  
  131.      *   
  132.      * @param pageNo  
  133.      *            starting from 1.  
  134.      * @param pageSize  
  135.      *            records per pages.  
  136.      * @return the first record in the page.  
  137.      */  
  138.     public static int getStartOfPage(int pageNo, int pageSize) {   
  139.         return (pageNo - 1) * pageSize;   
  140.     }   
  141.   
  142.     /**  
  143.      * @return Returns the start.  
  144.      */  
  145.     public int getStart() {   
  146.         return this.start;   
  147.     }   
  148.   
  149.     /**  
  150.      * @param start  
  151.      *            The start to set.  
  152.      */  
  153.     public void setStart(int start) {   
  154.         this.start = start;   
  155.     }   
  156.   
  157.     /**  
  158.      * @param pageSize  
  159.      *            The pageSize to set.  
  160.      */  
  161.     public void setPageSize(int pageSize) {   
  162.         this.pageSize = pageSize;   
  163.     }   
  164.   
  165.     /**  
  166.      * @param list  
  167.      *            The list to set.  
  168.      */  
  169.     public void setList(List<T><t></t><t></t> list) {   
  170.         this.list = list;   
  171.     }   
  172.   
  173.     /**  
  174.      * @param totalCount  
  175.      *            The totalCount to set.  
  176.      */  
  177.     public void setTotalCount(int totalCount) {   
  178.         this.totalCount = totalCount;   
  179.     }   
  180.   
  181.     /**  
  182.      * @param currentPageNo  
  183.      *            The currentPageNo to set.  
  184.      */  
  185.     public void setCurrentPageNo(int currentPageNo) {   
  186.         this.currentPageNo = currentPageNo;   
  187.     }   
  188.   
  189.     /**  
  190.      * @param totalPageCount The totalPageCount to set.  
  191.      */  
  192.     public void setTotalPageCount(int totalPageCount) {   
  193.         this.totalPageCount = totalPageCount;   
  194.     }   
  195. }  

如果为Page对象加上aegis则程序正常运行。

Page.aegis.xml
  1. <!---->xml version="1.0" encoding="UTF-8"?>  
  2. <mappings xmlns:my="http://my.bjvsp.tongtech.com">  
  3.     <mapping name="my:User">  
  4.         <property name="list"  
  5.             componentType="cn.cetelem.accounting.model.CsiAcctPmtHistory" />  
  6.     mapping>  
  7. mappings>  

XFire的版本,我试过1.2.2和1.2.6。 搞了一天,还没找到答案

PS --  在codehaus上也找到类似的: jira.codehaus.org/browse/XFIRE-1002

分享到:
评论
3 楼 小笨熊 2008-01-18  
建议先做一个简单的例子,我用的范型是支持的,你再好好找找!
2 楼 peigen 2008-01-16  
1.2以上支持泛型

我仍用了aegis配置文件
1 楼 bibiye 2007-10-16  
目前貌似无法解决!
只好:
1.加配置文件;
2.Page构造放到client端。

希望能听到不同的声音

相关推荐

Global site tag (gtag.js) - Google Analytics