We help IT Professionals succeed at work.

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

todd_farmer
todd_farmer asked
on
Medium Priority
5,024 Views
Last Modified: 2011-08-18
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?

Comment
Watch Question

Commented:
Check if you are using the correct version of classes***.zip and ojdbc..jar

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
Add it (classes12.zip) to your classpath in front of all other jars, even the JRun jars.
Top Expert 2006

Author

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?
Commented:
i think u should better off with ojdbc14.jar (oracle thin jdbc driver) rather than classes12.jar. Try replacing classes12 with ojdbc14.jar

Commented:
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
Top Expert 2006

Author

Commented:
Thanks, I'll give ojdbc14.jar a shot and report back.
Top Expert 2006

Author

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);
        }

    }
Top Expert 2006

Author

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.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.