Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-04-05
8
Medium Priority
?
4,874 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?

0
Comment
Question by:todd_farmer
  • 4
  • 2
  • 2
8 Comments
 
LVL 5

Assisted Solution

by:mrigank
mrigank earned 200 total points
ID: 16385342
Check if you are using the correct version of classes***.zip and ojdbc..jar
0
 
LVL 5

Expert Comment

by:mrigank
ID: 16385373
Add it (classes12.zip) to your classpath in front of all other jars, even the JRun jars.
0
 
LVL 30

Author Comment

by:todd_farmer
ID: 16385491
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Accepted Solution

by:
fargo earned 1800 total points
ID: 16385535
i think u should better off with ojdbc14.jar (oracle thin jdbc driver) rather than classes12.jar. Try replacing classes12 with ojdbc14.jar
0
 
LVL 11

Expert Comment

by:fargo
ID: 16385583
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
 
LVL 30

Author Comment

by:todd_farmer
ID: 16385614
Thanks, I'll give ojdbc14.jar a shot and report back.
0
 
LVL 30

Author Comment

by:todd_farmer
ID: 16385929
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
 
LVL 30

Author Comment

by:todd_farmer
ID: 16386379
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question