[webbeans-issues] [JBoss JIRA] Created: (WBRI-275) Enterprise WebBeans w/ PersistenceContext throw incorrect exception when failing
by John Ament (JIRA)
Enterprise WebBeans w/ PersistenceContext throw incorrect exception when failing
--------------------------------------------------------------------------------
Key: WBRI-275
URL: https://jira.jboss.org/jira/browse/WBRI-275
Project: Web Beans
Issue Type: Bug
Affects Versions: 1.0.0.PREVIEW1
Environment: Suse 11.1 and SLES 10.2
Java 6 64 Bit JDK
JBoss AS 5.1
Reporter: John Ament
Priority: Minor
If you create an enterprise web bean with a logical error, i.e. attempting to play with the transaction from within a method or attempt to access a table that does not exist, you get a stack trace that only mentions:
java.lang.IllegalArgumentException: enterpriseBeanInstance.setDestroyed() called with non-boolean argument
This is incorrect, or at least undesirable, because there's no clear indication where the error actually lies.
Examples of the poor programming:
Referencing an entity bean that has @Table("some_non_existent_table")
Starting a transaction:
entityManager.getTransaction().begin();
Query q = entityManager.createQuery("select i from Image i where i.skuAssociated = :sku").setParameter("sku", sku);
List<Image> results = q.getResultList();
entityManager.getTransaction().commit();
return results;
Essentially, anything that can cause a RuntimeException (or child of) to be thrown from within the methods of a Stateful EJB.
To test:
Create a standard EJB w/ a similar programming problem and see that it does not throw this exception.
Create an enterprise web bean w/out this programming problem and see that it does not throw this exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months
[webbeans-issues] [JBoss JIRA] Created: (WBRI-253) provide informative exception when attempt is made to invoke EJB from test in standalone mode
by Dan Allen (JIRA)
provide informative exception when attempt is made to invoke EJB from test in standalone mode
---------------------------------------------------------------------------------------------
Key: WBRI-253
URL: https://jira.jboss.org/jira/browse/WBRI-253
Project: Web Beans
Issue Type: Feature Request
Components: Enterprise Beans
Affects Versions: 1.0.0.PREVIEW1
Environment: test-harness in standalone mode
Reporter: Dan Allen
Priority: Minor
Fix For: 1.0.0.CR1
My understanding is that I cannot invoke a method on an EJB session bean unless I am using incontainer mode (@IntegrationTest). Otherwise I get the following exception, assuming a method signature of HotelSearch#isPreviousPageAvailable().
java.lang.reflect.InvocationTargetException
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.jboss.webbeans.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:97)
at org.jboss.seam.examples.booking.action.HotelSearch_$$_javassist_1.isPreviousPageAvailable(HotelSearch_$$_javassist_1.java)
at org.jboss.seam.examples.booking.action.FooTest.testCallMethodOnSessionBean(FooTest.java:20)
Caused by: java.lang.NullPointerException
at org.jboss.webbeans.util.Reflections.lookupMethod(Reflections.java:514)
at org.jboss.webbeans.util.Reflections.lookupMethod(Reflections.java:496)
at org.jboss.webbeans.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:136)
at org.jboss.seam.examples.booking.action.HotelSearch_$$_javassist_0.isPreviousPageAvailable(HotelSearch_$$_javassist_0.java)
... 43 more
It might helpful to turn this NullPointerException into an IllegalStateException to make it clear that it's not possible to do such a call in standalone mode.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 9 months