[EJB 3.0] - Deployment dependencies...
by jactor
I am having trouble deploying a session bean and three entity beans.
I use jboss-4.0.4.GA.
This is part of another issue (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=91339) which troubles me. I get this is my log:
anonymous wrote : --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3
| State: NOTYETINSTALLED
| I Depend On:
| persistence.units:unitName=proof
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: persistence.units:unitName=proof
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3
This is the persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
| <persistence>
| <persistence-unit name="proof">
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop" />
| </properties>
| </persistence-unit>
| </persistence>
This is the declaration of the entity manager in my session bean:
@PersistenceContext(unitName = "proof")
| protected EntityManager manager = null;
|
What might be causing that the persistence unit is not getting deployed?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974475#3974475
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974475
19 years, 7 months
[EJB 3.0] - Re: Exception recieving problem
by apwalker
You should be able to catch the exception type thrown by the Session Bean and you will need to include the exception classes in the client. Have to tried calling the EJB from a plain java client. Do you get the same result.
What JBoss Server and EJB 3 versions are you using
I put together a test and am able to catch the Exception
I'm using JBoss 4.0.4.GA with version of EJB3 bundled with the installer I think it's RC8
Stateless Session Bean Code
| import javax.ejb.ApplicationException;
| import javax.ejb.Stateless;
|
|
| @Stateless
| @ApplicationException(rollback=false)
| public class MyStatelessSessionBean implements MyStatelessSessionRemote
| {
| public void throwsException() throws MyClientSideException
| {
| System.out.println("about to throw remote exception");
| throw new MyClientSideException("Server Side Exception thrown to the client");
| }
| }
|
Remote Interface
| import javax.ejb.ApplicationException;
| import javax.ejb.Remote;
|
| @Remote
| public interface MyStatelessSessionRemote
| {
| public void throwsException() throws MyClientSideException;
|
| }
|
Client code
| import javax.naming.InitialContext;
| import junit.framework.TestCase;
|
| public class ClientTestCase extends TestCase
| {
| public void testThrowException()
| {
| try
| {
| InitialContext ctx = new InitialContext();
| MyStatelessSessionRemote slsb = (MyStatelessSessionRemote)ctx.lookup("/MyStatelessSessionBean/remote");
|
| slsb.throwsException();
| fail("shouldn't get here");
| }
| catch(Exception ex)
| {
| ex.printStackTrace();
| assertTrue((ex instanceof MyClientSideException));
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974472#3974472
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974472
19 years, 7 months