Exception :
NoClassDefException : javax/xml/XmlStreamException
Application :
SOAPclient - uses sdf to invoke service .
Resolution :
Had to install jre 6. The exception occurs since XmlStreamException is not available in jre 5 . had to modify the compiler version to 1.6 and jre to 1.6 accordingly to get rid of the Exception
Exceptions
Monday, June 27, 2011
Monday, May 23, 2011
Exception: No suitable driver found
STATUS: Closed
Scenario:
While getting a thin client connection to the database (without using datasource) using the below code:
Connection myLink = DriverManager.getConnection("jdbc: oracle:thin:@127.0.0.1:1521:xe", "testuser", "testpassword");
Statement myStatement = myLink.createStatement();
we get a SQLException as follows:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@127.0.0.1:1521:x eat java.sql.DriverManager.getConnecti on(DriverManager.java:602)at java.sql.DriverManager.getConnecti on(DriverManager.java:185)...
Resolution:
Add the following line of code before getting the connection:
Class.forName("oracle.jdbc.driver. OracleDriver");
Possible Root Cause:
The driver manager needs to be registered in order to get a connection.
Scenario:
While getting a thin client connection to the database (without using datasource) using the below code:
Connection myLink = DriverManager.getConnection("jdbc: oracle:thin:@127.0.0.1:1521:xe", "testuser", "testpassword");
Statement myStatement = myLink.createStatement();
we get a SQLException as follows:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@127.0.0.1:1521:x eat java.sql.DriverManager.getConnecti on(DriverManager.java:602)at java.sql.DriverManager.getConnecti on(DriverManager.java:185)...
Resolution:
Add the following line of code before getting the connection:
Class.forName("oracle.jdbc.driver. OracleDriver");
Possible Root Cause:
The driver manager needs to be registered in order to get a connection.
java.lang.IllegalStateException: getOutputStream() has already been called for this response
STATUS : Closed
Scenario :
jsp to generate a report and on click of a button download the report xls from the server. Code in the jsp is as follows.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=Report.xls");
OutputStream out1 =response.getOutputStream();
WritableWorkbook workbook = Workbook.createWorkbook(out1);
Resolution :
Moved the code in the jsp to a servelet
Possible RootCause :
You cannot get a handle to the multiple output stream objects. When the jsp code gets compiled to plain java it adds code " out.write() " to write the jsp content to the outputstream. Since you already have got a handle to the ouputstream the out.write() system code throws the exception. Hence moving the code to a servelet solves the issue.
Scenario :
jsp to generate a report and on click of a button download the report xls from the server. Code in the jsp is as follows.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment; filename=Report.xls");
OutputStream out1 =response.getOutputStream();
WritableWorkbook workbook = Workbook.createWorkbook(out1);
Resolution :
Moved the code in the jsp to a servelet
Possible RootCause :
You cannot get a handle to the multiple output stream objects. When the jsp code gets compiled to plain java it adds code " out.write() " to write the jsp content to the outputstream. Since you already have got a handle to the ouputstream the out.write() system code throws the exception. Hence moving the code to a servelet solves the issue.
Subscribe to:
Posts (Atom)