todd_farmer
asked on
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.Do mainExcept ion: java.sql.SQLException: Io exception: Protocol violation
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 400)
at com.mycompany.web.struts.a ction.User SearchActi on.execute (UserSearc hAction.ja va:56)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 19)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
Caused by: java.sql.SQLException: Io exception: Protocol violation
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:170)
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:212)
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:325)
at oracle.jdbc.driver.OracleS tatement.p repare_for _new_resul t(OracleSt atement.ja va:2606)
at oracle.jdbc.driver.OracleP reparedSta tement.exe cuteUpdate (OraclePre paredState ment.java: 402)
at oracle.jdbc.driver.OracleP reparedSta tement.exe cuteQuery( OraclePrep aredStatem ent.java:3 44)
at jrun.sql.JRunPreparedState ment.execu teQuery(JR unPrepared Statement. java:69)
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 294)
... 14 more
javax.servlet.ServletExcep tion: java.sql.SQLException: Io exception: Protocol violation
at org.apache.struts.action.R equestProc essor.proc essExcepti on(Request Processor. java:523)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 21)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
The error indicates a problem within the com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria() 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?
I'm having difficulty with this error. The stack trace is below:
com.mycompany.exception.Do
at com.mycompany.database.DAO
at com.mycompany.web.struts.a
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
Caused by: java.sql.SQLException: Io exception: Protocol violation
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.driver.OracleS
at oracle.jdbc.driver.OracleP
at oracle.jdbc.driver.OracleP
at jrun.sql.JRunPreparedState
at com.mycompany.database.DAO
... 14 more
javax.servlet.ServletExcep
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
The error indicates a problem within the com.mycompany.database.DAO
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?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Add it (classes12.zip) to your classpath in front of all other jars, even the JRun jars.
ASKER
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html
ASKER
Thanks, I'll give ojdbc14.jar a shot and report back.
ASKER
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.Do mainExcept ion: java.sql.SQLException: Io exception: Bigger type length than Maximum
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 496)
at com.mycompany.web.struts.a ction.User SearchActi on.execute (UserSearc hAction.ja va:56)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 19)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
Caused by: java.sql.SQLException: Io exception: Bigger type length than Maximum
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:134)
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:179)
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:334)
at oracle.jdbc.driver.OracleS tatement.p repare_for _new_get(O racleState ment.java: 3395)
at oracle.jdbc.driver.OracleS tatement.g etStringVa lue(Oracle Statement. java:3615)
at oracle.jdbc.driver.OracleR esultSetIm pl.getStri ng(OracleR esultSetIm pl.java:46 0)
at oracle.jdbc.driver.OracleR esultSet.g etString(O racleResul tSet.java: 1543)
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 299)
... 14 more
javax.servlet.ServletExcep tion: java.sql.SQLException: Io exception: Bigger type length than Maximum
at org.apache.struts.action.R equestProc essor.proc essExcepti on(Request Processor. java:523)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 21)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. 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.Do mainExcept ion: java.sql.SQLException: Protocol violation
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 496)
at com.mycompany.web.struts.a ction.User SearchActi on.execute (UserSearc hAction.ja va:56)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 19)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. java:66)
Caused by: java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:134)
at oracle.jdbc.dbaccess.DBErr or.throwSq lException (DBError.j ava:179)
at oracle.jdbc.dbaccess.DBErr or.check_e rror(DBErr or.java:11 60)
at oracle.jdbc.ttc7.Oall7.rec eive(Oall7 .java:594)
at oracle.jdbc.ttc7.TTC7Proto col.doOall 7(TTC7Prot ocol.java: 1986)
at oracle.jdbc.ttc7.TTC7Proto col.execut eFetch(TTC 7Protocol. java:1005)
at oracle.jdbc.driver.OracleS tatement.d oExecuteQu ery(Oracle Statement. java:2687)
at oracle.jdbc.driver.OracleS tatement.d oExecuteWi thTimeout( OracleStat ement.java :2850)
at oracle.jdbc.driver.OracleP reparedSta tement.exe cuteUpdate (OraclePre paredState ment.java: 609)
at oracle.jdbc.driver.OracleP reparedSta tement.exe cuteQuery( OraclePrep aredStatem ent.java:5 37)
at jrun.sql.JRunPreparedState ment.execu teQuery(JR unPrepared Statement. java:69)
at com.mycompany.database.DAO .implement ation.User DbDAO.getU sersByCrit eria(UserD bDAO.java: 294)
... 14 more
javax.servlet.ServletExcep tion: java.sql.SQLException: Protocol violation
at org.apache.struts.action.R equestProc essor.proc essExcepti on(Request Processor. java:523)
at org.apache.struts.action.R equestProc essor.proc essActionP erform(Req uestProces sor.java:4 21)
at org.apache.struts.action.R equestProc essor.proc ess(Reques tProcessor .java:224)
at org.apache.struts.action.A ctionServl et.process (ActionSer vlet.java: 1194)
at org.apache.struts.action.A ctionServl et.doGet(A ctionServl et.java:41 4)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 740)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at jrun.servlet.ServletInvoke r.invoke(S ervletInvo ker.java:9 1)
at jrun.servlet.JRunInvokerCh ain.invoke Next(JRunI nvokerChai n.java:42)
at jrun.servlet.JRunRequestDi spatcher.i nvoke(JRun RequestDis patcher.ja va:252)
at jrun.servlet.ServletEngine Service.di spatch(Ser vletEngine Service.ja va:527)
at jrun.servlet.http.WebServi ce.invokeR unnable(We bService.j ava:168)
at jrunx.scheduler.ThreadPool $ThreadThr ottle.invo keRunnable (ThreadPoo l.java:451 )
at jrunx.scheduler.WorkerThre ad.run(Wor kerThread. 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.closeRes ultSet(rs) ;
ConnectionManager.closeSta tement(ps) ;
ConnectionManager.closeCon nection(co nn);
}
}
com.mycompany.exception.Do
at com.mycompany.database.DAO
at com.mycompany.web.struts.a
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
Caused by: java.sql.SQLException: Io exception: Bigger type length than Maximum
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.driver.OracleS
at oracle.jdbc.driver.OracleS
at oracle.jdbc.driver.OracleR
at oracle.jdbc.driver.OracleR
at com.mycompany.database.DAO
... 14 more
javax.servlet.ServletExcep
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
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.Do
at com.mycompany.database.DAO
at com.mycompany.web.struts.a
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
Caused by: java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.dbaccess.DBErr
at oracle.jdbc.ttc7.Oall7.rec
at oracle.jdbc.ttc7.TTC7Proto
at oracle.jdbc.ttc7.TTC7Proto
at oracle.jdbc.driver.OracleS
at oracle.jdbc.driver.OracleS
at oracle.jdbc.driver.OracleP
at oracle.jdbc.driver.OracleP
at jrun.sql.JRunPreparedState
at com.mycompany.database.DAO
... 14 more
javax.servlet.ServletExcep
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.R
at org.apache.struts.action.A
at org.apache.struts.action.A
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at jrun.servlet.ServletInvoke
at jrun.servlet.JRunInvokerCh
at jrun.servlet.JRunRequestDi
at jrun.servlet.ServletEngine
at jrun.servlet.http.WebServi
at jrunx.scheduler.ThreadPool
at jrunx.scheduler.WorkerThre
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.
... 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.closeRes
ConnectionManager.closeSta
ConnectionManager.closeCon
}
}
ASKER
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.