這幾天在deploy EJB3 project到oc4j時,遇到了奇怪的問題
deploy時都正常,並無錯誤訊息
但client在呼叫時,卻又無法成功呼叫,產生以下error


Client端得到的error
2007/11/19 下午 06:11:19 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
警告: Exception returned by remote server: {0}
javax.ejb.EJBException: java.lang.ArrayIndexOutOfBoundsException: 10221; nested exception is:
java.lang.ArrayIndexOutOfBoundsException: 10221; nested exception is: oracle.oc4j.rmi.OracleRemoteException: java.lang.ArrayIndexOutOfBoundsException: 10221; nested exception is:
java.lang.ArrayIndexOutOfBoundsException: 10221
oracle.oc4j.rmi.OracleRemoteException: java.lang.ArrayIndexOutOfBoundsException: 10221
at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:346)




Server端得到的error
[TopLink Warning]: 2007.11.19 06:11:19.583--java.lang.ArrayIndexOutOfBoundsException: 10221 was thro
wn on attempt of PersistenceLoadProcessor to load class com.pchome.nas.persistence.entity.NasApplyda
ta. The class is ignored.




找了半天,才發現好像是gen entity時,entity有錯
我用的工具是
MyEclipse Enterprise Workbench
Version: 5.5.1 GA
利用
MyEclipse Database Explorer
EJB3 Reverse Engineering
一路採用default產生entity


entity裡的annotation會自動產生
@Entity
@Table(name = "NAS_APPLYDATA", schema = "ECADMOR", uniqueConstraints = {})


就是這個uniqueConstraints = {}在作怪


後來請同事用另一個版本的MyEclipse gen entity
比對之下少了uniqueConstraints = {}


再重新deploy之後,client就可正常呼叫了


p.s.阿史卡道音的叮嚀
提醒大家,寫ejb 的 entity的時候,
@Temporal(TemporalType.DATE)
請換成
@Temporal(TemporalType.TIMESTAMP)
否則用oracle application server的時候,時分秒會被忽略掉。


arrow
arrow
    全站熱搜

    babyincar 發表在 痞客邦 留言(0) 人氣()