Mantis - Resin
Viewing Issue Advanced Details
1489 major always 12-04-06 12:14 12-05-06 19:02
gzhu Dell  
ferg Debian  
normal 2.6.7-1-686-smp  
closed 3.1.0  
resin-3.1.s061203 fixed  
none    
none 3.1.0  
0001489: EJB 2 CMP deploy failed on snapshot version 3.1.s061203
EJB2 CMP failed to deploy because of uncaught exception in generated java MyCodeCMP__EJB.java.

The generated code :

    public com.ironplanet.db.addcreditinfo.AddCreditInfo create()
      throws javax.ejb.CreateException
    {
       ....
       try {
         thread.setContextClassLoader(_context._server.getClassLoader());
         try {
            ......
            trans.getAmberConnection().create("MyCode", bean); <<<< HERE
            ......
         }
        } catch (java.sql.SQLException e) {
          throw new com.caucho.ejb.CreateExceptionWrapper(e);
        }
      } catch (RuntimeException e) {
        throw trans.setRollbackOnly(e);
      } finally {
        thread.setContextClassLoader(oldLoader);
        trans.commit();
      }
      return ....;
    }

In this snapshot version, src/com/caucho/amber/manager/AmberConnection.java::create(...) (line 1499) now throws Exception instead of (previously) SQLException, which caused compilation error for MyCodeCMP__EJB.java with "Uncaught Exception: java.lang.Exception".

My Temp. Fix:

src/com/caucho/ejb/gen/EntityCreateCall.java:

145,145
< out.println("} catch (java.sql.SQLException e) {");
> out.println("} catch (java.lang.Exception e) {");

At this point, I wont worry too much about trans.setRollbackOnly(e); our application code will deal with CreateException properly.
configure any EJB2 CMP, and start resin
Development environment

Notes
(0001634)
gzhu   
12-04-06 12:32   
My modified code to see the full context of the change:

http://backhoe.ironplanet.com/download/resin/fix1489/EntityCreateCall.java [^]

(0001638)
ferg   
12-05-06 19:02   
regressions already catch this issue