[EJB 3.0] - Re: Should unchecked, but declared exceptions get wrapped in
by cracru
The spec lead at Sun was kind enough to answer my question. Here's the results:
Of course, the JBoss implementation is operating per design and spec.
This means, all unchecked (and extending RuntimeException) exceptions that are not in the control of the business method developer, should not be included in the throws clause of a business method.
For example, don't do this in the SLSB:
| public void findWidget (Integer widgetId)
| throws javax.persistence.EntityNotFoundException
|
Doing so, makes for a confusing contract with the client. In the example the EntityNotFoundException will be treated as a system exception and wrapped with EJBException before it is passed to the client.
If you own the exception, you can annotate with @ApplicationException. Otherwise, you have two choices:
- catch, wrap, and throw your own exception
- use application-exception deployment descriptor to affect all occurrences of the exception
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038174#4038174
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038174
19 years, 2 months
[Persistence, JBoss/CMP, Hibernate, Database] - bundling datatources with the application
by c_eric_ray
I want to bundle a datasource xml file with my ear. Here's how I have it bundled.
| application.ear
| |
| -- META-INF/
| -- ejbs.jar
| -- webapp.war
| -- my-ds.xml
|
When this deploys it appears jboss is taking the my-ds.xml file and renaming it to jboss-ds.xml and placing into the <server_home>/default/deploy directory.
This is fine for a single application. However, I'm working on more than one application at a time and I need to have separate *-ds.xml files deployed with the individual applications. However, jboss wants to name the all jboss-dx.xml and put them in the same directory. Then of course the datasource is never bound because jboss assumes it's already bound (I guess).
Is there a way to have my individual datasource files deployed so they retain the original name and are NOT renamed to jboss-ds.xml? My main objective is to bundle the datasource files with the ear files and so I don't have to pre-deploy datasource files when I move my ear file to another instance of jboss.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038171#4038171
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038171
19 years, 2 months