Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001310 [Resin] major always 08-21-06 20:21 08-24-06 09:32
Reporter gzhu View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform Linux or Solaris 10 x86 64bit
Status closed   OS Debian (for e.g.)
Projection none   OS Version 2.6.7-1-686-smp
ETA none Fixed in Version 3.0.22 Product Version 3.0.19
  Product Build built Mon, 15 May 2006 04:50:47
Summary 0001310: create CMP ejb failed with "Missing IN or OUT parameter at index::.." when prepare statement cache size is greater than 0
Description Repeatedly creating CMP ejb will fail if the <prepare-statement-cache-size..> is greater than 0. This is happening with Oracle thin driver in ojdbc14.jar, connecting to Oracle 10.2.0 server.

Looks like unclean preparedStatement (with bind objects off) were returned from Connection.prepareStatement(sql), which caused the exceptions thrown at executeUpdate(). It only happens when you have a tight loop to get prepareStatement; a couple of seconds of delay would ease this problem.

A couple of days debugging showed that the culprit was not directly from com.caucho.amber.manager.AmberConnection::_prepareStatementMap.

======== stack trace from the attached test case ==============

com.caucho.ejb.CreateExceptionWrapper: java.sql.SQLException: Missing IN or OUT parameter at index:: 3
   at _ejb.TestEjb.TestEjbCMP__EJB$LocalHome.create(TestEjbCMP__EJB.java:324)
   at _jsp._jsp._test._testEJB__jsp._jspService(_testEJB__jsp.java:39)
   at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
   ......
Steps To Reproduce 1. Create a CMP java:
=========== testejb/TestEjbBean.java ==========================
package testejb;

import java.util.*;
import javax.ejb.*;
import javax.naming.*;


/**
 *
 * @ejb.bean
 * name = "TestEjb"
 * local-jndi-name = "TestEjbHome"
 * cmp-version = "2.x"
 * reentrant = "False"
 * view-type = "local"
 * @ejb.persistence
 * table-name = "test_ejb"
 * @ejb.transaction
 * type = "Required"
 * @ejb.pk class = "testejb.TestEjbPK"
 * @version $Id$
 */
public abstract class TestEjbBean
        implements EntityBean
{

        /**
     * No argument constructor.
     * Sets up the environment based on values in the bean's ejb-jar.xml deployment descriptor file.
     * @ejb.create-method
     */
        public TestEjbPK ejbCreate () throws CreateException {
        setId(0);
            return new TestEjbPK(getId());
    }

        /**
     * No argument constructor.
     * Sets up the environment based on values in the bean's ejb-jar.xml deployment descriptor file.
     * @ejb.create-method
     */
        public TestEjbPK ejbCreate (int id, String name) throws CreateException {
        try {
                        ejbCreate();
            setId(id);
            setName(name);
        }
        catch (Exception e) {
            throw new CreateException("ERROR: Couldn't create testejb bean");
        }
            return new TestEjbPK(getId());
    }

        /**
         * @ejb.persistence
         * column-name = "id"
         * sql-type = "INTEGER"
         * jdbc-type = "INTEGER"
         * @ejb.pk-field
         * @ejb.interface-method
         */
        public abstract int getId();
        /**
         * @ejb.interface-method
         * @param _value
         */
        public abstract void setId(int _value);

        /**
         * @ejb.persistence
         * column-name = "name"
         * sql-type = "VARCHAR(15)"
         * jdbc-type = "VARCHAR"
         * @ejb.interface-method
         */
        public abstract String getName();
        /**
         * @ejb.interface-method
         * @param _value
         */
        public abstract void setName(String _value);
}
========== end of testejb/TestEjbBean.java ===============


2. a simple JSP to trigger the exception

============== my.jsp =====================
<%@
        page import="testejb.*, javax.naming.*, javax.ejb.*, java.io.*"
%>
<html>
<body>
<h1>EJB Creation Test</h1>
<%
Context context = new InitialContext();
TestEjbHome h = (TestEjbHome) (context.lookup("java:comp/env/cmp/TestEjb"));
try
{
        for (int i=1; i< 5; i++)
        {
            TestEjb t = h.create(i, "name"+i);
            out.println("Created TestEjb: ("+ t.getId() + ", " + t.getName()+&qu
ot;)\n\n");
            out.flush();
        }
}
catch(Exception ex)
{
    ex.printStackTrace(new PrintWriter(out));
}

%>

</body>
</html>
=============== end of my.jsp ===========


Additional Information
Attached Files

- Relationships

- Notes
(0001479)
ferg
08-24-06 09:32

The prepared statement cache shouldn't be caching prepared statements with a result type.
 

- Issue History
Date Modified Username Field Change
08-21-06 20:21 gzhu New Issue
08-21-06 20:51 gzhu Issue Monitored: gzhu
08-24-06 09:32 ferg Note Added: 0001479
08-24-06 09:32 ferg Assigned To  => ferg
08-24-06 09:32 ferg Status new => closed
08-24-06 09:32 ferg Resolution open => fixed
08-24-06 09:32 ferg Fixed in Version  => 3.0.22


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker