Exception in ContainerManaged EJB

Hai everybody,
I have written a ContaianerManagedEntity Bean. Iam trying to insert data into Oracle8i Database using J2EE server.
There is no problem with database. It is calling ejbCreate() method and it is executing till the last statement of ejbCreate() method.But after ejbCreate() it is not executing ejbPostCreate() method.
The Exception Iam getting is:
at com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
     at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
     at com.sun.enterprise.iiop.POAProtocolMgr.createReference(POAProtocolMgr.java:313)
     at com.sun.ejb.containers.EntityContainer.internalGetEJBObject(EntityContainer.java:796)
     at com.sun.ejb.containers.EntityContainer.getEJBObject(EntityContainer.java:167)
The complete Exception is about 7000(seven thousand) lines. The above are only first 3 lines.
I could not able to trace where the exact problem is. somebody please help me..
This is my ejbCreate and ejbPostCreate() code:
public void ejbCreate(String companyID,String name,String city,String state,String pin,String address)
          throws CreateException {
          System.out.println("ejbCreate2 Called");
          if(companyID==null) {
               throw new CreateException("Product id is requiered");
          this.companyID=companyID;
          this.name=name;
          this.city=city;
          this.state=state;
          this.pin=pin;
          this.address=address;
          System.out.println("record inserted successfully");
//          return null;
public void ejbPostCreate(String companyID,String name,String city,String state,String pin,String address)
          throws RemoteException
          {System.out.println("ejbPostCreate2 Called");  }
Iam using PrimaryKey Class.
primary key field :companyID
Thank you,
Raghu

ok...check ur client whether it has the following code.....if its a class cast exception then,may be this is the problem...
objref = initial.lookup("path...");
YourHome yourHome =
(YourHome)PortableRemoteObject.narrow(objref,
YourHome.class);
are u casting the object returned from the PortableRemoteObject to your home object ?????

Similar Messages

  • Exception Outside Of EJB Code

    Hello,
    I have a BMP EJB module that is talking with a SYBASE database using the jconn2 driver on the J2EE AS (Sun Java App Server 8). I deployed the module using the deploytool. I also have a stand-alone application that has been compiled with the client jar file.
    When I call any of my findBy* methods I recieve an object as I would expect. However, when I try to use the object in any way (for example, call getX() on it) I receive the following error in the server.log file:
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'primary_key'
    Where primary_key is my primary key value. I have placed print lines in my findBy methods and I see the values I'm receiving are correct and the exception is happening AFTER control leaves my findBy method.
    Has anyone seen anything like this? I've scoured the web for two days with no luck.
    I'm not sure if I need to configure my module differently, use an Application vice a module, configure the database different, or if I'm missing something with my client. I'm very new to EJBs/Web development...

    Here is the stack trace that I am getting. After some more investigation, I see that the following exception is being thrown after leaving ejbLoad. I have a printout as the last thing I do in ejbLoad and I am seeing that, but this exception is being thrown!
    It seems to indicate that there is a problem with my SQL, but I have copied and pasted all of my SQL statements into isql and they all work.
    I have also print out the other attributes in ejbLoad() that I get from the database and they are all correct. I have no idea what the problem is...
    [#|2004-12-13T12:12:40.940-0500|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.ejb|_ThreadID=51;|EJB5071: Some remote or transactional roll back exception occurred
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'port_id'.
    javax.ejb.EJBException: nested exception is: com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'port_id'.
    com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'port_id'.
    at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
    at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
    at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
    at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1615)
    at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1598)
    at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:89)
    at wsm.ejb.PortEntityBean.ejbStore(PortEntityBean.java:266)
    at com.sun.ejb.containers.EntityContainer.callEJBStore(EntityContainer.java:2248)
    at com.sun.ejb.containers.EntityContainer.enlistResourcesAndStore(EntityContainer.java:1369)
    at com.sun.ejb.containers.EntityContainer.beforeCompletion(EntityContainer.java:1349)
    at com.sun.ejb.containers.ContainerSynchronization.beforeCompletion(ContainerSynchronization.java:103)
    at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:246)
    at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:333)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:2622)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:2411)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:763)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:137)
    at $Proxy95.getPortID(Unknown Source)
    at wsm.ejb.PortSessionBean.getPortAt(PortSessionBean.java:46)
    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:324)
    at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:930)
    at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
    at $Proxy93.getPortAt(Unknown Source)
    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:324)
    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:651)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:190)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1653)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1513)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:895)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:172)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:668)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:375)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:284)
    at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)

  • Null Pointer exception in accessing EJB in 9.0.3

    Hi
    The application is working fine with 9.0.2, but when I deployed in 9.0.3 it is giving Null Pointer Exception, throwing the error message in Stack Trace.
    ==========================================================
    java.lang.NullPointerException
         at com.evermind.server.ejb.EJBUtils.cloneOneObjectInstance(EJBUtils.java:416)
         at com.evermind.server.ejb.EJBUtils.cloneArrayList(EJBUtils.java:599)
         at com.evermind.server.ejb.EJBUtils.cloneObject(EJBUtils.java:357)
         at ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.getHouseChargesPrefs(ETOperationUtilitiesSession_StatelessSessionBeanWrapper136.java:5965)
         at ETAHouseDocumentController.doPost(ETAHouseDocumentController.java:615)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermi[i]Long postings are being truncated to ~1 kB at this time.

    Hi
    The Problem which I posted earlier seems to be like..
    If a EJB (Remote) has a method that returns an ArrayList, and one of the entries of the ArrayList is null, we get a NullPointerException, when clonnning the ArrayList .
    This looks same as the one posted in relation EJB-Remote returning HashMap has null values.

  • How can one prevent passing exceptions over an EJB-Webservice?

    Hello,
    I would appreciate if someone could give me some advice on the following. I tried to google it/use the search function, however, it was quite hard finding a precise search term.
    Let me try to explain the setting conceptionally without much code first.
    Three stateless session beans - let's call them BeanA, BeanB and BeanC - perform some specific tasks. Especially, they are using JPA to create and manipulate persistent entities. Clients like graphical user interfaces access these beans. I call them internal clients because they belong the same company like BeanA, BeanB and BeanC. Internal clients can know how to handle exceptions which are thrown in the beans.
    However, the functionality of these beans is also relevant to external clients, for example another company. A webservice (WebserviceBean) combines the functionality of the three beans and communicates with the external client. The latter one must not receive any exceptions thrown in my EJB application as this could leak implementation details but they must be informed, that the task could not be performed (some kind of "Please try again later"). As far as I understood (also tested it), JAX-WS takes exceptions and turns them into SOAP-Faults.
    My first (naive) approach was to do something like this
    Webmethod of the WebserviceBean (
    public ReturnType doWebserviceFunctionality(ParameterType parameter) {
       try {
          beanAinstance.doWork();
          beanBinstance.doMoreWork();
          beanCinstance.doFinalWork();
       catch(SpecificException se) {
       // Map specific exception to ReturnType.specificError
       } catch(Exception e) {  // Bad practice, I know
       // Map general exception to ReturnType.encounteredInternalError
    }In every bean's method as well as in the webservice, I am using Container Managed Transactions (default setting REQUIRED).
    The problem is, that doMoreWork() uses an entity with a versioning attribute (@version) in order to support optimistic locking. This works quite well, however, whenever an OptimisticLockException is thrown, it does not get caught in WebserviceBean and is passed on to the client. I think this is because the complete transaction is commited at the end of doWebserviceFunctionality. I am aware that I could use EntityManager's flush method in bean B in order to catch the OptimisticLockException. However, I am trying not to interfere with transaction commiting as far as possible and furthermore, I am not quite sure, if there could be other exceptions (for example JPA exceptions) which could get thrown in a similar way and are passed on to the client.
    Does anybody know a possibility to solve this problem? Do I have to use bean managed transactions? Or mark doWebserviceFunctionality as not part of an transaction and put the bean method calls in a seperate method which commits at the end and allows me to handle exceptions? Or is there a completely different approach necessary?
    Any help is appreciated, thanks in advance,
    BKelso

    Hello to all,
    thanks again for your suggestions which proved to be valueable hints!
    I'll tell you so far the lessons I've learned.
    1) Using interceptors (suggested by malrawi)
    This would have been a very nice solution, however, it turns out that the problem remains - the exception thrown by the container after the commit is not caught. Here is the code I used
        @AroundInvoke
        public Object convertException(InvocationContext ctx) throws InternalErrorException {
          try {
             return ctx.proceed();
          } catch(Exception e) {
             // just tried to throw another exception here in order to see if it works
             throw new InternalErrorException("Internal Error occured. Please try again later.");
        }2) Using bean managed transcations (suggested by zsom)
    This worked out as I thought it would. The webservice starts and commits the transactions, beanA, B and C can still keep the default CMT Attribute. However, when ut.rollback() is called, an IllegalStateException is always thrown. Don't know why so far, the transaction seems to be set back anyways.
    @Resource SessionContext ctx;
    public ReturnType doWebserviceFunctionality(ParameterType parameter) {
    UserTransaction ut = null;
          ut = ctx.getUserTransaction();
          try {
             ut.begin();
             ut.commit();
         } catch (Exception e) {
             try {
                ut.rollback();
                // map exception...
             } catch (Exception rollbackException) {
                // also map exception to return type
    }3) Upon the suggestion by malrawi using NotSupported transaction attribute in order to force a commit, I came up with the following: The webservice method uses this transaction attribute while simply calling another local stateless session bean (beanZ), which does the actual work (calling beans A, B, C). It uses the default transaction attribute (Required). This works out perfectly at the cost of an additional bean. But maybe you see some other downsides? Essentially it's the same as the idea with the internalMethod made public and using another transaction attribute.
    // web service class
    public ReturnType doWebserviceFunctionality(ParameterType parameter) {
       try {
            beanZinstance.doActualWork();
       catch(Exception e) {  // Map exceptions here
    // bean Z class
    public ReturnType doActualWork(ParameterType parameter) {
           beanAinstance.doWork();
          beanBinstance.doMoreWork();
          beanCinstance.doFinalWork();
    }4) Using soaphandler (suggested by zsom)
    This seems like a good idea but it is also the most complicated and a bit more low-level. But I will check it out in more detail, I think.
    Thanks again for your efforts and I still appreciate any feedback!
    BobKelso

  • ClassCastException exception while running EJB Client

    Folks,
    I am getting following exception while running the EJB Client.. I am
    using WLS 5.1
    Exception in thread "main" java.lang.ClassCastException
    at
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:319)
    at FirstStatelessEJBClient.Client.lookupHome(Client.java:149)
    at FirstStatelessEJBClient.Client.<init>(Client.java:44)
    at FirstStatelessEJBClient.Client.main(Client.java:82)
    Can anybody throw a light on this.
    Thanks
    Ashish

    Hi Eduardo,
    Below is my classpath. The stubs are in first_statlessSession.jar file.
    CLASSPATH=C:\weblogic\myserver\first_statelessSession.jar;
    C:\jdk1.2.2\lib\tools.jar;C:\weblogic\license;C:\weblogic\classes;C:\weblogi
    c\lib\weblogicaux.jar;
    C:\weblogic\myserver\clientclasses;C:\weblogic\myserver\serverclasses
    Also, I am just compiling and deploying the
    C:\weblogic\examples\ejb\basic\statelessSession myself and testing it. I
    am
    using the build.cmd files to compile and deploy the above EJB. If I use the
    jars provided by weblogic it works fine with same above classpath.
    I don't know what to do next. I have invested the whole day to solve this
    problem and couldn't.
    Please let me know if I am doing anything wrong.
    Appreciate your help.
    Thanks,
    Ashish
    Eduardo Ceballos wrote:
    Try putting the stubs into the client class path.
    "Ashish N. Shah" wrote:
    Folks,
    I am getting following exception while running the EJB Client.. I am
    using WLS 5.1
    Exception in thread "main" java.lang.ClassCastException
    at
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:319)
    at FirstStatelessEJBClient.Client.lookupHome(Client.java:149)
    at FirstStatelessEJBClient.Client.<init>(Client.java:44)
    at FirstStatelessEJBClient.Client.main(Client.java:82)
    Can anybody throw a light on this.
    Thanks
    Ashish

  • Null Pointer Exception in orion-ejb-jar.xml GUI editor

    Hi,
    I am getting a NPE when attempting to configure CMR mappings orion-ejb-jar.xml with the GUI/Properties Editor.
    Using 9.0.5.2 on Windows XP professional SP2
    Have defined the necessary <relationships> descriptors for this relation.
    1:M unidirectional from entity X to Entity Y
    1)Over orion-ejb-jar.xml right click and select 'Properties...'
    2) Highlight Entity X in properties gui and open the tree. Select 'CMP Field Mappings'.
    3)On the right pane there are two tabs 'CMP Field Mappings' and 'Relationship Mappings'. Select Relationship Mappings.
    4) Relationship Mappings tab now displayed with the above relationship displayed in drop down 'Relationship' tab.
    5) Regardless of whether I select any extra properties on the CMP Mapping, If I hit ok button I get the NPE shown below (n.b. All details filled in except the FK field on the many side of the relation - this is the only field I can enter on this window in this case.).
    java.lang.NullPointerException
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveCollectionMapping(RelationshipsPanel.java:1195)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveOneToManyRelationship(RelationshipsPanel.java:748)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveRelationship(RelationshipsPanel.java:528)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.onExit(RelationshipsPanel.java:394)
         at oracle.ide.panels.TabbedPanel.exitCurrentTraversable(TabbedPanel.java:219)
         at oracle.ide.panels.TabbedPanel.onExit(TabbedPanel.java:106)
         at oracle.jdevimpl.deploy.ejb.oc4j.CmpFieldMappingsPanel.onExit(CmpFieldMappingsPanel.java:134)
         at oracle.ide.panels.MDDPanel.exitTraversable(MDDPanel.java:850)
         at oracle.ide.panels.MDDPanel.onExit(MDDPanel.java:290)
         at oracle.ide.panels.TDialog$L.vetoableChange(TDialog.java:72)
         at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:300)
         at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:217)
         at oracle.bali.ewt.dialog.JEWTDialog.fireVetoableChange(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.dismissDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog$UIListener.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
    <snip ....>
    Very good chance I am doing something wrong ! However, would be interested in getting a reason (or any lead for that matter) why JDev is throwing NPE in this case.
    Cheers
    Ben

    Hi,
    I am getting a NPE when attempting to configure CMR mappings orion-ejb-jar.xml with the GUI/Properties Editor.
    Using 9.0.5.2 on Windows XP professional SP2
    Have defined the necessary <relationships> descriptors for this relation.
    1:M unidirectional from entity X to Entity Y
    1)Over orion-ejb-jar.xml right click and select 'Properties...'
    2) Highlight Entity X in properties gui and open the tree. Select 'CMP Field Mappings'.
    3)On the right pane there are two tabs 'CMP Field Mappings' and 'Relationship Mappings'. Select Relationship Mappings.
    4) Relationship Mappings tab now displayed with the above relationship displayed in drop down 'Relationship' tab.
    5) Regardless of whether I select any extra properties on the CMP Mapping, If I hit ok button I get the NPE shown below (n.b. All details filled in except the FK field on the many side of the relation - this is the only field I can enter on this window in this case.).
    java.lang.NullPointerException
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveCollectionMapping(RelationshipsPanel.java:1195)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveOneToManyRelationship(RelationshipsPanel.java:748)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.saveRelationship(RelationshipsPanel.java:528)
         at oracle.jdevimpl.ejb.mapper.RelationshipsPanel.onExit(RelationshipsPanel.java:394)
         at oracle.ide.panels.TabbedPanel.exitCurrentTraversable(TabbedPanel.java:219)
         at oracle.ide.panels.TabbedPanel.onExit(TabbedPanel.java:106)
         at oracle.jdevimpl.deploy.ejb.oc4j.CmpFieldMappingsPanel.onExit(CmpFieldMappingsPanel.java:134)
         at oracle.ide.panels.MDDPanel.exitTraversable(MDDPanel.java:850)
         at oracle.ide.panels.MDDPanel.onExit(MDDPanel.java:290)
         at oracle.ide.panels.TDialog$L.vetoableChange(TDialog.java:72)
         at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:300)
         at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:217)
         at oracle.bali.ewt.dialog.JEWTDialog.fireVetoableChange(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.dismissDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog$UIListener.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
    <snip ....>
    Very good chance I am doing something wrong ! However, would be interested in getting a reason (or any lead for that matter) why JDev is throwing NPE in this case.
    Cheers
    Ben

  • Model - level exceptions not thrown (EJB, 11.1.1.3)

    Hi,
    We noticed that with the latest jdev version (11.1.1.3) exceptions from model layer are not thrown or logged anywhere. Steps to reproduce (HR schema):
    - create a new Application (J2EE template, add ADF Faces and Page Flow to view project)
    - create Entities from tables (Department and Employee)
    - create a session bean
    - add this method
        public void test() {
            Employee emp = null;
            emp.getDepartment();
            System.out.println("test");
        }- expose it through local interface
    - create a data control from the session bean
    - create a new jspx page, and drag&drop the test() method as a button
    - run the project and click the button.
    No exceptions in the console, the only thing I was able to find is this Info in DefaultServer.log
    ####<May 27, 2010 12:02:03 PM CEST> <Info> <EJB> <myMachine> <DefaultServer> <[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-0004EFF816A89E472B1E> <583c10bfdbd326ba:-226d29eb:128d928460d:-7ffd-00000000000000a0> <1274954523439> <BEA-010227> <EJB Exception occurred during invocation from home or business: [email protected]1 threw exception: java.lang.NullPointerException> This is a MAJOR issue, it makes development practically impossible. If there isn't any workaround, we are going back to 11.1.1.2 until next release.
    I can send a test case if anyone is interested.
    Pedja

    We have identified the problem, but right now the fix is planned for a later release.
    If this is an urgent/important problem for you, I would suggest that you open a service request with Oracle support and see if you can get a patch for this, or provide a higher priority for this issue.

  • Exception thrown in EJB not captured in ManagedBean

    Hi. Im new in community.
    I have an EE project using JSF 1.2, EJB 3.0 deployed in Weblogic 10.3.6.
    My EJB that throws an Exception that is captured in my ManagedBean. However the exception does not reach to my ManagedBean.
    This exception should reload the page with an error message stating that the group already exists, but as the exception does not reach the ManagedBean, the page is not displayed with the error message.
    I appreciate the help. Rgrds.
    My web.xml
      <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/PRErrorPageView.faces</location>
      </error-page>
    My EJB:
    try {
                List<Grupo> grupos = findGrupoByName(grupo.getNomeGrupo());
                if (!grupos.isEmpty() && !alteraPermissao)
                    throw new GrupoException("msgErroGrupoNomeCadastrado");
    My ManagedBean:
    Here is the call of my EJB
    grupoServices.persisteGrupo(grupo, listCR, listCC, listCM, listCP, listMo, alteraGrupo, codigoTela, codigoUsuarioLogado);         
    cancelar();
    FacesUtil.addSuccessMessage("Grupo criado com sucesso!");
    } catch (GrupoException e) {
    logger.warning(e.getMsg());
    FacesUtil.addErrorMessage(e.getMsg());
    My class GrupoException:
    public class GrupoException extends ComponentException{
        /** The serialVersionUID */
        private static final long serialVersionUID = -6912605895523623154L;
            public GrupoException(String key){
            super(key);
    My ComponentException:
    public class ComponentException extends RuntimeException{
        /** The serialVersionUID */
        private static final long serialVersionUID = -2534006938034008594L;
        private String            msg;
        public ComponentException(String key) {
            String msgBundle = ResourcesUtil.getString(ResourcesUtil.MENSAGENS_FILE, key);
            this.msg = msgBundle;
    Weblogic log:
    ]] Root cause of ServletException.
    javax.faces.FacesException: #{cadastroGrupo.gravar}: javax.ejb.EJBException: EJB Exception: : br.com.telefonica.portal.services.exceptions.GrupoException
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl.persisteGrupo(GrupoServiceImpl.java:93)
        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 com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
        at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
        at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy87.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.__WL_invoke(Unknown Source)
        at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.web.views.CadastroGrupoBean.gravar(CadastroGrupoBean.java:310)
        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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        at javax.faces.component.UICommand.broadcast(UICommand.java:387)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    ; nested exception is: br.com.telefonica.portal.services.exceptions.GrupoException
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
        at javax.faces.component.UICommand.broadcast(UICommand.java:387)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        Truncated. see log file for complete stacktrace
    Caused By: javax.faces.el.EvaluationException: javax.ejb.EJBException: EJB Exception: : br.com.telefonica.portal.services.exceptions.GrupoException
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl.persisteGrupo(GrupoServiceImpl.java:93)
        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 com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
        at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
        at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy87.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.__WL_invoke(Unknown Source)
        at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.web.views.CadastroGrupoBean.gravar(CadastroGrupoBean.java:310)
        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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        at javax.faces.component.UICommand.broadcast(UICommand.java:387)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    ; nested exception is: br.com.telefonica.portal.services.exceptions.GrupoException
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        at javax.faces.component.UICommand.broadcast(UICommand.java:387)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
        Truncated. see log file for complete stacktrace
    Caused By: javax.ejb.EJBException: EJB Exception: : br.com.telefonica.portal.services.exceptions.GrupoException
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl.persisteGrupo(GrupoServiceImpl.java:93)
        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 com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.oracle.pitchfork.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:34)
        at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
        at com.oracle.pitchfork.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:42)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy87.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.__WL_invoke(Unknown Source)
        at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl_k21zc8_GrupoServicesLocalImpl.persisteGrupo(Unknown Source)
        at br.com.telefonica.portal.web.views.CadastroGrupoBean.gravar(CadastroGrupoBean.java:310)
        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 com.sun.el.parser.AstValue.invoke(AstValue.java:187)
        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        at javax.faces.component.UICommand.broadcast(UICommand.java:387)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    ; nested exception is: br.com.telefonica.portal.services.exceptions.GrupoException
        at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:156)
        at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:887)
        at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:818)
        at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:517)
        at weblogic.ejb.container.internal.BaseLocalObject.__WL_postInvokeTxRetry(BaseLocalObject.java:455)
        Truncated. see log file for complete stacktrace
    Caused By: br.com.telefonica.portal.services.exceptions.GrupoException
        at br.com.telefonica.portal.services.impl.GrupoServiceImpl.persisteGrupo(GrupoServiceImpl.java:93)
        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)
        Truncated. see log file for complete stacktrace

    Tao,
              > If your ejb method is in a transaction context, then you throw application
              exception, the container will try to commit the transaction.
              In the case of an application exception, the caller will be responsible for
              committing or rolling back the transaction. (A runtime exception will roll
              back the transaction automatically.) That is why, if you use CMT, that the
              EJB methods call from outside the EJB container (such as from a servlet)
              should never be able to throw runtime exceptions.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Tao Zhang" <[email protected]> wrote in message
              news:3a33c04a$[email protected]..
              >
              > Hi,
              > It's ok because you look after the transaction yourself. probably you use
              the default transaction attribute 'Supports'.
              >
              > If your ejb method is in a transaction context, then you throw application
              exception, the container will try to commit the transaction.
              >
              > Hope this can help.
              > Tao Zhang
              >
              > "Gormless" <[email protected]> wrote:
              > >
              > >When I throw an application exception from within a statless session bean
              which uses jdbs for DB Lookup Only I get
              > >"Exception thrown in non-transactional EJB invoke".
              > >
              > >As this is a llokup only I have no Transaction Management
              >
              

  • Handle Custom Exception messages in EJB 3.x

    Hi
    I would like to know the process to follow in order to handle CustomException as in example
    the following code used within the Satteless / statefull /Message EJB's may be
    *if(user.account.value <= 100){*
    throw new EJBHanldleException("1001")
    where "EJBHanldleException" is a normal Custom build java which extends java.lang.Exception
    I would like to get the Value "1001" on to the Client which initates the EJB call.
    a sample code would be usefull..... : (
    with regards
    kartthik

    Didn't you have a thread for this here: Please note *CreateException* extends Exception clause
    Were the replies in there completely useless?

  • Cannot capture the exception generated by EJB components.

    Hi, All:
    I got a strange problem when developing EJB application under SAP WAS server. I developed an EJB as below:
    public class UserAccountBean implements SessionBean{
         String getUserEmail(String accountID) throws SAPSystemException{
              if(error){
                   throw new SAPSystemException("Specified user not found.");
    Exception I defined as below.
    public class SAPSystemException extends Exception {
    @param message
         public SAPSystemException(String message) {
              super(message);
    In client side I code as below:
    public String getUserMail(String accountID){
         UserAccount bean = home.create();
         try{
              String email = bean.getUserEmail(accountID);
         }catch(SAPSystemException e){
              // do something here;
         }catch(Exception e){
              // do some other thing here;
    It is strange that the SAPSystemException I throw out in the bean cannot be caught by the block catch(SAPSystemException e), it is only captured as general exception and it is said as UndeclaredThrowableException.
    When I deployed EJB components and Web components together, the exception can be captured successfully. But when I deployed them separately, it has problem for exception capture. I think it must be the protocol problem. Before I only use RMI-IIOP but SAP WAS server using RMI-P4. Is anything I can do to solve this problem?
    I packed the remote and home interface for the EJB and common classes like value objects and exceptions in both components. Is there anything I forgot to set for the deployment?
    Thanks in advance.
    Message was edited by: Weimin Guo
    Message was edited by: Weimin Guo

    Thank you very much Gregor. In fact, I already defined this throws exception in the remote object interface.
    public interface UserAccount extends EJBObject {
         public String getUserEmail(String accountID) throws RemoteException, SAPSystemException;
    This is application-specific interface and this mechanism works well in my previous in other application server.
    I checked the SAP document and found if you using RMI-IIOP, you need to get the client package for your deployed EJBs and put in the path accessible by the WEB components. Based on this suggestion, I put the EJB jar file together with WEB application (Sure the EJB application still deployed in other host and JNDI point to that host. I remembered one book mentioned that if you don't want generate the client package from EJB containter, you can do it this way. For me, I just haven't found the way to get the client package with Administrator Tool it said.), It works!!!. I checked the remote object generated by home object, it is different with EJB jar file there or not. But in the document SAP said that only if you use RMI-IIOP you need do this way, for RMI-P4, you don't need that. Anyway, it seems that RMI-P4 use same way as RMI-IIOP(You only don't need narrow the home object after lookup).
    I'll try to find how to get EJB client package from WAS server. For this is my first time to use SAP WAS Server, things a little strange.
    Thank you very much for your great help.
    Cheers.

  • Can not catch in servlet exception thrown by EJB

    Hello everybody.
    I created an exception class InvalidDataException derived from Exception. This exception is thrown in an EJB session.
    In my servlet I wrote two catch blocks. The first one is :
    catch(InvalidDataException ex) and the second one is catch(Exception ex).
    The InvalidDataException is not catched in the InvalidDataException block but in the Exception block. And in the Exception block I display the class of the catched exception, the class is the class of my InvalidDataException.
    I hope my explanation is clear...
    Any ideas ??
    Thank you for your help
    Here is the stacktrace, there are french words, dont be afraid :-)
    10:20:48,261 INFO  [STDOUT] avant lancement exception invalidData
    10:20:48,264 ERROR [[BookServlet]] Servlet.service() for servlet BookServlet threw exception
    pipeline.MyExceptions.InvalidDataException: La date de d\uffffbut doit \ufffftre ant\uffffrieure \uf
    fff la date de fin du projet
            at pipeline.ejb.FacadeBean.verifDates(FacadeBean.java:169)
            at pipeline.ejb.FacadeBean.reserverRess(FacadeBean.java:125)
            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:585)
            at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
            at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionConta
    iner.java:228)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionI
    nterceptor.java:158)
            at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstance
    Interceptor.java:169)
            at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.
    java:71)
            at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:206)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.
    java:136)
            at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:643)
            at org.jboss.ejb.Container.invoke(Container.java:917)
            at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
            at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
            at $Proxy110.reserverRess(Unknown Source)
            at pipeline.web.BookServlet.doPost(BookServlet.java:235)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.ja
    va:174)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Htt
    p11BaseProtocol.java:663)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            at java.lang.Thread.run(Thread.java:595)

    Hello,
    I fix my problem. I included the class InvalidDataException in the *.war and in the *.jar so there were 2 definitions of InvalidDataException. Thats why my exception was not catched.
    Bye

  • How to transmit an exception from an EJB to a client ?

    I have a deployed EJB with a business method that throws an exception if something goes wrong. When the EJB is called (by a remote Java client) the client is not getting any exception if something goes wrong in the EJB's business method. This is how the EJB's business method is currently coded:
    void m() throws RemoteException
    try { //stuff
      } catch( Exception e ) {
        throw RemoteException(e.getMessage());
      } finally {
        // clean up
    What is wrong with this ? Any help is appreciated.
    Thanks,
    Colm.

    i think have to do something like this
    void m() throws RemoteException
    try { //stuff
      } catch( Exception e ) {
        throw new RemoteException(e.getMessage());
      } finally {
        // clean up
    look the "new", and have to create a custom class exception.
    look here:
    http://www-128.ibm.com/developerworks/library/j-ejbexcept.html
    http://docs.jboss.org/jbossas/javadoc/4.0.2/javax/ejb/EJBException.java.html
    http://docs.jboss.org/jbossas/javadoc/4.0.2/javax/ejb/

  • Getting a security exception when invoking EJB from a webservice

    Hi,
    I am getting the following exception when Invoke an EJB from a web service.
    The EJB fails when it tries to access a remote object(RMI).
    When I invoke the EJB directly I dont get this exception.
    Both the EJB and the WS are deployed as part of the same application on weblogic 9.2 .
    the WS was created by jwsc ant task.
    This is the exception:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: com.bea.xml.XmlCalendar (no security m
    anager: RMI class loader disabled)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    60)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:701)
    at java.lang.Thread.run(Thread.java:534)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
    RemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
    223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
    at com.netcom.server.rmi.RequestHandlerImpl_
    Stub.copy(Unknown Source)
    Message was edited by:
    guyh

    Hi Jitu,
    I changed the wsdl. And so I don�t get the warning anymore. My Webservice also runs well, now. Thanks anyway for the reply.
    There is a nice tech article on the sun network, which solved my problem. The basic idea is to split the wsdl into 2 wsdl documents. one containing all the porttypes messages and so on. And the other wsdl contains the binding and service elements.
    If you are interested check out this link:
    http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/index2.html
    thanks,
    footman

  • An unexpected exception while configiring EJB Transport

    Hi
    I am getting exception:
    'An unexpected exception occurred during the creation or update of this service:null' when i an creating EJB transport.
    I have uploaded the jar file, created JNDI provider and selected methods from the client jar in ' EJB Transport Configuration' screen, as soon i hit the next button i am getting this error.
    I have tried all debug statements in wlidebug.xml, could not get single trace element in logs.
    Any thoughts or suggestions are appreciated.
    Sekhar

    Hello,
    Have you made any progress on this problem? I am encountering the same problem when trying to create a business service with ejb-transport with a ALSB unix installation. I am able to at least create the business service on a Windows installation but then the same cryptic error occurs if you attempt to change the Targeted namespace.
    If you have found any clues to the problem please share them. Thanks!

  • How To Handle SQL Exceptions in  Session EJB Bean

    Hi,
    we are working on toplink JPA. My use case is I have an emp table with columns as "empid" , "emp name" , "job" with "empid" as primary Key. Here I'm creating a record in the Database by using a jspx page. Here My problem is when I'm entering a duplicate value for the empid I'm getting "ORA-00001: unique constraint (constraint_name) violated" . I'm able to catch the exception in the jspx backing bean where I'm calling the JPA insert method, But i could not catch the exception in the sessionEJB Bean. Is there any way to catch such exception in the sessionEJB.
    could anyone help me out.
    Thanks in Advance.
    regards,
    PrapanSol

    You should be able to call flush on your EntityManager in your SessionBean to trigger the exception.
    Note that the transaction will still be rolled back even if you catch this exception.

Maybe you are looking for