Weblogic wrap application exception in javax.ejb.EJBException

爷,独闯天下 提交于 2019-12-22 10:45:38

问题


My ear application was working fine. But suddenly it started to throw javax.ejb.EJBException in some method calls, instead of returning the original Application Exception (annotated with @ApplicationException(rollback=true). Now the original application exception is wrapped in the EJBException. the Currently the other developer who was working in the project is on leave. Therefore I have no idea what he has done to the code for happening this. This application exception and ejb remote interfaces are in a separate jar file which is deployed as a shared library in the weblogic.

I would like to know what can be responsible for throwing this EJBException instead of throwing the application exception. I think may be @ApplicationException annotation is not correctly detected by the weblogic. Could anyone give me a help to resolve this issue?


回答1:


I was able to solve the issue by adding the application exception in the "throw" clause of ejb method signature.

Previously all ejb classes and application exception class was in the same jar file. But later the application exception class and ejb remote interfaces were put to another jar file called "api" jar file and the relevant ejb files were kept in the previous jar file.

It seems it is enough to declare an application exception with @ApplicationException, if we need it to treat as an application excpetion when all classes are in the same jar file. But if the application exception class is in a separate jar file, we need to add this application exception in the "throw" clause of the ejb method signature to interpret it as an application exception by the weblogic server.



来源:https://stackoverflow.com/questions/15387346/weblogic-wrap-application-exception-in-javax-ejb-ejbexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!