[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: EJB JAR inside EAR

starkc do-not-reply at jboss.com
Fri Feb 1 09:52:24 EST 2008


I feel I have to reiterate that the code is closed to be, I do not have source access at this time, which unfortunately may limit us although I hope it does not.

StrategyBeanBMPs ejbCreate, as per a decompiler, is as follows:


  |   public StrategyPK ejbCreate(String s, String s1, String s2, Timestamp timestamp, byte abyte0[], String s3, BigDecimal bigdecimal, 
  |             String s4)
  |         throws CreateException, RemoteException
  |     {
  |         if(!isEncrypted(abyte0))
  |             abyte0 = encrypt(abyte0);
  |         super.ejbCreate(s, s1, s2, timestamp, abyte0, s3, bigdecimal, s4);
  |         Connection connection;
  |         try
  |         {
  |             ejbFindByPrimaryKey(new StrategyPK(s, s1));
  |             throw new DuplicateKeyException("Primary key already exists");
  |         }
  |         catch(ObjectNotFoundException objectnotfoundexception)
  |         {
  |             connection = null;
  |         }
  |         PreparedStatement preparedstatement = null;
  |         try
  |         {
  |             connection = dataSource.getConnection();
  |             if(DatabaseDetector.isOracle(connection))
  |                 preparedstatement = connection.prepareStatement("insert into strategy (business, strategy, version, deploy_dt, deploy_admin_server, deploy_port, deploy_protocol, xml) values (?, ?, ?, ?, ?, ?, ?, empty_blob())");
  |             else
  |                 preparedstatement = connection.prepareStatement("insert into strategy (business, strategy, version, deploy_dt, deploy_admin_server, deploy_port, deploy_protocol, xml) values (?, ?, ?, ?, ?, ?, ?, ?)");
  |             if(timestamp == null)
  |                 timestamp = new Timestamp(System.currentTimeMillis());
  |             preparedstatement.setString(1, s);
  |             preparedstatement.setString(2, s1);
  |             preparedstatement.setString(3, s2);
  |             preparedstatement.setTimestamp(4, timestamp);
  |             preparedstatement.setString(5, s3);
  |             if(bigdecimal == null)
  |                 bigdecimal = new BigDecimal("7001");
  |             preparedstatement.setBigDecimal(6, bigdecimal);
  |             preparedstatement.setString(7, s4);
  |             if(!DatabaseDetector.isOracle(connection))
  |             {
  |                 String s5 = new String(abyte0);
  |                 StringReader stringreader = new StringReader(s5);
  |                 preparedstatement.setCharacterStream(8, stringreader, s5.length());
  |             }
  |             if(preparedstatement.executeUpdate() != 1)
  |                 throw new CreateException("Error adding row");
  |             if(DatabaseDetector.isOracle(connection))
  |             {
  |                 Object obj = null;
  |                 Object obj1 = null;
  |                 boolean flag = true;
  |                 try
  |                 {
  |                     connection = dataSource.getConnection();
  |                     boolean flag1 = connection.getAutoCommit();
  |                     connection.setAutoCommit(false);
  |                     String s6 = "select xml from strategy where business = ? and strategy = ? for update";
  |                     preparedstatement = connection.prepareStatement(s6);
  |                     preparedstatement.setString(1, s);
  |                     preparedstatement.setString(2, s1);
  |                     ResultSet resultset = preparedstatement.executeQuery();
  |                     if(resultset.next())
  |                     {
  |                         Blob blob = resultset.getBlob("xml");
  |                         if(blob != null)
  |                         {
  |                             OutputStream outputstream = ((OracleBlob)blob).getBinaryOutputStream();
  |                             outputstream.write(abyte0);
  |                             outputstream.flush();
  |                             outputstream.close();
  |                             connection.commit();
  |                             connection.setAutoCommit(flag1);
  |                         }
  |                     }
  |                 }
  |                 catch(IOException ioexception)
  |                 {
  |                     ioexception.printStackTrace();
  |                     try
  |                     {
  |                         connection.rollback();
  |                     }
  |                     catch(Exception exception) { }
  |                     throw new EJBException("IO Exception reading xml from strategy" + ioexception.toString());
  |                 }
  |                 catch(SQLException sqlexception1)
  |                 {
  |                     sqlexception1.printStackTrace();
  |                     try
  |                     {
  |                         connection.rollback();
  |                     }
  |                     catch(Exception exception1) { }
  |                     throw new EJBException("select xml from strategy where business = '" + super.business + "' and strategy = '" + super.strategy + "' for update" + sqlexception1.toString());
  |                 }
  |             }
  |             StrategyPK strategypk = new StrategyPK(s, s1);
  |             return strategypk;
  |         }
  |         catch(SQLException sqlexception)
  |         {
  |             sqlexception.printStackTrace();
  |             throw new EJBException("Error executing SQL insert into strategy (business, strategy, version, deploy_dt, xml) values (?, ?, ?, ?, ?): " + sqlexception.toString());
  |         }
  |         finally
  |         {
  |             closeConnection(connection, preparedstatement);
  |         }
  |     }

I was never able to successfully recreate the scenario to pin down the statement throwing the exception, however looking at the trace a guess would be this one:

super.ejbCreate(s, s1, s2, timestamp, abyte0, s3, bigdecimal, s4);

Which would cause it to call the Strategy.create method?  This may not be correct understanding of the situation...

The output of the -tf command on the earfile is as follows:

  | META-INF/
  | META-INF/MANIFEST.MF
  | decisionCore.jar
  | decisionserver.war
  | META-INF/application.xml
  | 

decisionCore contains the EJBs, whereas decisionserver.war comtains the webapp, obviously.  At one point I had a jboss-app.xml placed next to the application.xml, specifying isolation, etc... however it was removed along the course of my testing to this point.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125547#4125547

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125547



More information about the jboss-user mailing list