java.sql.SQLException: Io exception: Protocol violation in Jrun4 with Oracle10g

Hi,

I'm having difficulty with this error.  The stack trace is below:
 com.mycompany.exception.DomainException: java.sql.SQLException: Io exception: Protocol violation
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:400)
      at com.mycompany.web.struts.action.UserSearchAction.execute(UserSearchAction.java:56)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.sql.SQLException: Io exception: Protocol violation
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:170)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:212)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:325)
      at oracle.jdbc.driver.OracleStatement.prepare_for_new_result(OracleStatement.java:2606)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:402)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:344)
      at jrun.sql.JRunPreparedStatement.executeQuery(JRunPreparedStatement.java:69)
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:294)
      ... 14 more
 

 javax.servlet.ServletException: java.sql.SQLException: Io exception: Protocol violation
      at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
 

The error indicates a problem within the com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria() method.  The line referenced is:

            rs = ps.executeQuery();

The ps variable is a PreparedStatement that is set earlier.  I have test cases that execute outside of my AS (JRun4), and they consistently return correctly.  The problem appears only when I run the search through the web application - using the same exact parameters as my test case.  Both are consistent - test case consistently works, JRun consistently fails.

The database table that is being searched resides on an Oracle 10g database, and contains a column defined as a LONG data type.  I initially thought that this might be the cause of the problem, but found that I don't have issues with other methods that return the same exact columns using different criteria.

I've checked various resources online, and have not found a solution.  Any ideas?

LVL 30
todd_farmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrigankCommented:
Check if you are using the correct version of classes***.zip and ojdbc..jar
0
mrigankCommented:
Add it (classes12.zip) to your classpath in front of all other jars, even the JRun jars.
0
todd_farmerAuthor Commented:
I am using the same version of classes12.zip for both my unit testing and in the JRun4\server\lib directory.  There is no ojdbc.jar file in either.

I'm not so sure how I would modify the classpath that is used by JRun - are you suggesting thatJRun uses the Windows CLASSPATH environment variable?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

fargoCommented:
i think u should better off with ojdbc14.jar (oracle thin jdbc driver) rather than classes12.jar. Try replacing classes12 with ojdbc14.jar
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fargoCommented:
classes*.jar is generally used with jdk1.2 and 1.3. which version of java u r using? if 1.4 and above use ojdbc14.jar
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html
0
todd_farmerAuthor Commented:
Thanks, I'll give ojdbc14.jar a shot and report back.
0
todd_farmerAuthor Commented:
I'm still having difficulty, but it's a bit different now (or I missed it previously).  I now get the following stack trace:

 com.mycompany.exception.DomainException: java.sql.SQLException: Io exception: Bigger type length than Maximum
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:496)
      at com.mycompany.web.struts.action.UserSearchAction.execute(UserSearchAction.java:56)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.sql.SQLException: Io exception: Bigger type length than Maximum
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
      at oracle.jdbc.driver.OracleStatement.prepare_for_new_get(OracleStatement.java:3395)
      at oracle.jdbc.driver.OracleStatement.getStringValue(OracleStatement.java:3615)
      at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:460)
      at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1543)
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:299)
      ... 14 more
 

 javax.servlet.ServletException: java.sql.SQLException: Io exception: Bigger type length than Maximum
      at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
 
The error indicates the root cause is the following line:

                rs.getString("commentsview");

The commentsview column is defined as a VARCHAR2(1) (yeah, I know - I didn't write that junk).  It has values of "Y", "N" and null in the database currently.

When I do a page reload after this initial error, I get the Protocol error:

 com.mycompany.exception.DomainException: java.sql.SQLException: Protocol violation
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:496)
      at com.mycompany.web.struts.action.UserSearchAction.execute(UserSearchAction.java:56)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.sql.SQLException: Protocol violation
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:594)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
      at oracle.jdbc.ttc7.TTC7Protocol.executeFetch(TTC7Protocol.java:1005)
      at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2687)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:537)
      at jrun.sql.JRunPreparedStatement.executeQuery(JRunPreparedStatement.java:69)
      at com.mycompany.database.DAO.implementation.UserDbDAO.getUsersByCriteria(UserDbDAO.java:294)
      ... 14 more
 

 javax.servlet.ServletException: java.sql.SQLException: Protocol violation
      at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
      at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
 
My best guess is that there is something with how I'm using the Connection object that is causing that problem, but I'm not sure.  Here's the skeleton of my code (I pulled out all the ps.setString() and rs.getString() methods, or the post would be too large:

   public List getUsersByCriteria(String lastname, String firstname,
            String custid, String status, String associatedEntityCode,
            String associatedEntityBranch, String associatedEntityType)
            throws DomainException {
        List l = new ArrayList();
        Connection conn = null;
        ResultSet rs = null;
        PreparedStatement ps = null;
        try {
            conn = ds.getConnection();
            ps = conn.prepareStatement(sql.toString());
   
... setting prepared statement parameters here ...  

            rs = ps.executeQuery();
            while (rs.next()) {

                User u = new User(
                        rs.getString("address1"),
... bunch of rs.getString()s here ...
                       
                        );
                l.add(u);
            }
            return l;
        } catch (SQLException e) {
            LOG.error(e);
            throw new DomainException(e);
        } finally {
            ConnectionManager.closeResultSet(rs);
            ConnectionManager.closeStatement(ps);
            ConnectionManager.closeConnection(conn);
        }

    }
0
todd_farmerAuthor Commented:
It does appear to be the LONG column that causes this issue, even though I don't read it from the ResultSet.  When I changed the query to return explicit column names ("SELECT username, firstname, lastname, ...") instead of all columns, the problem went away.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.