Handling exceptions with servlets
Hi All,
I am trying to to write a servlet that would handle the errors of my applications under Application Server 8.1
Therefore i used the below:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ErrorDisplay extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String code = null, message = null, type = null, uri = null;
Object codeObj, messageObj, typeObj;
Throwable throwable;
// Retrieve the three possible error attributes, some may be null
codeObj = req.getAttribute("javax.servlet.error.status_code");
messageObj = req.getAttribute("javax.servlet.error.message");
typeObj = req.getAttribute("javax.servlet.error.exception_type");
throwable = (Throwable) req.getAttribute("javax.servlet.error.exception");
uri = (String) req.getAttribute("javax.servlet.error.request_uri");
if (uri == null) {
uri = req.getRequestURI(); // in case there's no URI given
// Convert the attributes to string values
if (codeObj != null) code = codeObj.toString();
if (messageObj != null) message = messageObj.toString();
if (typeObj != null) type = typeObj.toString();
// The error reason is either the status code or exception type
String reason = (code != null ? code : type);
out.println("<HTML>");
out.println("<HEAD><TITLE>" + reason + ": " + message + "</TITLE></HEAD>");
out.println("<BODY>");
out.println("<H1>" + reason + "</H1>");
out.println("<H2>" + message + "</H2>");
out.println("<PRE>");
if (throwable != null) {
throwable.printStackTrace(out);
out.println("</PRE>");
out.println("<HR>");
out.println("<I>Error accessing " + uri + "</I>");
out.println("</BODY></HTML>");
and i added the following to my web.xml
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/opt/SUNWappserver/appserver/samples/webapps/apps/nav/servlets/ErrorDisplay</location>
</error-page>
I have written a program to divide by zero, however it didnt call the above customized page but it threw the caught exception.
What is missing or what might i be doing wrong?
Any thoughts?
regards,
Scotty
the thrown exception is actually a ServletException? I would doubt that given the circumstances.
Similar Messages
-
Handling Exceptions with case statement - convert Exception to int value
Hi,
I'm developing a web app, with servlets.
I'm catching Exceptions in my servlets, for example I would like a user to insert data into a form. If the data cannot be converted into a integer value a java.lang.NumberormatException is thrown.
I would like to catch this and then create a message giving a more specific clue to what happened. Unfortunatly it's possible that other exceptions could be caught, so I want to be able to check which type of Exception has been caught.
I started writing a getErrorMessage(int Code) class. The method has a case statement which just checks the code and return the appropriate message.
This worked well for SQL exceptions as they provide a getErrorCode method. But I was wondering is there any way to convert other Exceptions such as
java.lang.NumberormatException into an integer value?
CheersExceptions have their types (classes) and messages (and maybe an embedded exception). That is, they have much richer internal status then an integer.
Why should they be "converted" to integers?
FLAME on
Gone are the days of good old errno.
FLAME off -
Some basic questions how to handle Exceptions with good style
Ok I have two really basic Exception questions at once:
1. Until now I always threw all exceptions back all the way to my main method and it always worked well for me but now I am sitting at a big project where this method would explode the programm with throwings of very many exceptions in very many methods. So I would like to know if there is a more elegant solution.
2. What do I do with exceptions that will never occur?
Lets say I have a method like this:
void main() {calculate();}
void calculate()
sum(3,5);
void sum(int a,int b)
MathematicsA.initialise("SUM"); // throws AlgorithmNotFoundException, will never occur but has to be handled
}So what is the most elegant way?:
h4. 1. Ignore because it will not happen
void sum(int a,int b)
try {MathematicsA.initialise("SUM");}
catch(AlgorithmNotFoundException) {}
}h4. 2. Print stacktrace and exit
void sum(int a,int b)
try {MathematicsA.initialise("SUM");}
catch(AlgorithmNotFoundException e)
e.printStackTrace();
System.exit();
}h4. 3. throw it everywhere
void main() throws AlgorithmNotFoundException, throws ThousandsOfOtherExceptions {}
void calculate() throws AlgorithmNotFoundException, throws HundretsOfOtherExceptions
sum(3,5);
void sum(int a,int b) throws AlgorithmNotFoundException
MathematicsA.initialise("SUM");
}h4. 4. Create special exceptions for every stage
void main() throws MainParametersWrongException
try {calculate();}
catch(Exception e)
throw new MainParametersWrongException();
void calculate() throws SumInternalErrorException
try {sum(3,5);}
catch (SumInternalErrorException) {throw new CalculateException();}
void sum(int a,int b) throws SumInternalErrorException
try
MathematicsA.initialise("SUM");
} catch (AlgorithmNotFoundException e) {
throw new SumInternalErrorException();
}P.S.: Another problem for me is when a method called in a constructor causes an Exception. I don't want to do try/catch everytime I instantiate an object..
Example:
public class MySummation()
Mathematics mathematics;
public MySummation()
mathematics.initialise("SUM"); // throws AlgorithmNotFoundException
void sum(int x,int y)
return mathematics.doIt(x,y);
}(sorry for editing all the time, I was not really sure what I really wanted to ask until i realised that I had in fact 2 questions at the same time, and still it is hard to explain what I really want to say with it but now the post is relatively final and I will only add small things)
Edited by: kirdie on Jul 7, 2008 2:21 AM
Edited by: kirdie on Jul 7, 2008 2:25 AM
Edited by: kirdie on Jul 7, 2008 2:33 AM
Edited by: kirdie on Jul 7, 2008 2:34 AMsphinks wrote:
I`m not a guru, but give my point of view. First of all, the first way is rude. You shouldn`t use try with empty catch. "rude" isn't the word I'd use to describe it. Think about what happens if an exception is thrown. How will you know? Your app fails, and you have NO indication as to why. "stupid" or "suicidal" are better descriptions.
Then for the second way, I`ll reccomend for you use not printStackTrace(); , but use special method for it:
public void outputError (Exception e) {
e.printStackTrace();
}It`ll be better just because if in future you`d like to output error message instead of stack of print it on GUI, you`ll need change only one method, but not all 'try' 'catch' statements for changing e.printStackTrace(); with the call of new output method.I disagree with this. Far be it from me to argue against the DRY principle, but I wouldn't code it this way.
I would not recommend exiting from a catch block like that. It's not a strategy for recovery. Just throw the exception.
Then, the third way also good, but I suppose you should use throws only if the caller method should know that called method have a problem (for example, when you read parametrs from gui, so if params are inccorect, main method of programm should know about it and for example show alert window)."throw it everywhere"? No, throw it until you get to an appropriate handler.
If you're writing layered applications - and you should be - you want to identify the layer that will handle the exception. For example, if I'm writing a web app with a view layer, a service layer, and a persistence layer, and there's a problem in the persistence tier, I'd let the service layer know what the persistence exception was. The service layer might translate that into some other exception with some business meaning. The view layer would translate the business exception into something that would be actionable by the user.
And in all other cases I suppose you should use the fourth way. So I suppose it`s better to combine 2,3,4 ways as I have mentioned above.I don't know that I'd recommend special exceptions for every layer. I'd reuse existing classes where I could (e.g., IllegalArgumentException)
Sorry, I can give you advice how to avoid problem with try-catch in constructor. :-(You shouldn't catch anything that you can't handle. If an exception occurs in a constructor that will compromise the object you're trying to create, by all means just throw the exception. No try/catch needed.
You sound like you're looking for a single cookie cutter approach. I'd recommend thinking instead.
% -
Handle Exception with RowsetIterate DataTag
Hi everybody...!!!...
I'm working with JDeveloper 10g version 9.0.5.2 modifying a software and when I'm trying to open a jsp page which is relationship with a ViewObject, JDeveloper show me an exception ArrayIndexOutOfBoundsException which I don't know how to resolve with RowsetIterate DataTag.
I'll be waiting your responses for my problem.
Greetings.Hi...!!!...
I put a try - catch block over the data tag, but know appear this new message on rowsetIterate datatag:
Mensaje de Error: org.apache.struts.taglib.html.FormTag
java.lang.ClassCastException: org.apache.struts.taglib.html.FormTag
at ReporteActividadesGenerar.jspService(ReporteActividadesGenerar.jsp:167)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at oracle.jbo.html.struts11.BC4JRequestProcessor.processForwardConfig(BC4JRequestProcessor.java:100)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.ayi.caos.client.actions.SecurityFilter.doFilter(SecurityFilter.java:138)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534) -
Illegal State Exception with Servlets
Hi Friends,
I am using RequestDispatcher to forwrd my request from one servlet to another
Here's the code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class TryServlet extends HttpServlet
public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:con";
Connection con= DriverManager.getConnection(url,"scott","tiger");
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from Projects");
response.setContentType("text/html");
PrintWriter out=response.getWriter();
while (rst.next())
String firstname=rst.getString("PIN");
String lastname=rst.getString("ProjectTitle");
out.println("<p> Name:"+firstname+" "+lastname+"");
con.close();
RequestDispatcher rd=getServletContext().getNamedDispatcher("HelloServlet");
rd.forward(request,response);
return;
catch(Exception e)
e.printStackTrace();
I m getting the error
java.lang.IllegalStateException: Cannot forward after response has been committed
i need to include the two rows of tables before i forwad the request to HelloServlet
What needs to be done?
thanx
Poojaimport java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class TryServlet extends HttpServlet
public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:con";
Connection con= DriverManager.getConnection(url,"scott","tiger");
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from Projects");
response.setContentType("text/html");
PrintWriter out=response.getWriter();
while (rst.next())
String firstname=rst.getString("PIN");
String lastname=rst.getString("ProjectTitle");
out.println("<p> Name:"+firstname+" "+lastname+"");
con.close();
RequestDispatcher rd=getServletContext().getNamedDispatcher("HelloServlet");
rd.forward(request,response);
return;
catch(Exception e)
e.printStackTrace();
please explain your problem for more details??? -
Hi,
The Servlet is also declared in web.xml like
<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>view.backing.Servlet1</servlet-class>
Why do I get these when running it?
<May 17, 2012 5:18:54 PM CST> <Error> <HTTP> <BEA-101371> <There was a failure when processing annotations for application C:\Users\HP\AppData\Roaming\JDeveloper\system11.1.1.5.37.60.13\o.j2ee\drs\User_prof\ViewControllerWebApp.war. Please make sure that the annotations are valid. The error is view.backing.Servlet1>
<May 17, 2012 5:18:54 PM CST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1337246332677' for task '0'. Error is: 'weblogic.application.ModuleException: Failed to load webapp: 'User_prof-ViewController-context-root''
weblogic.application.ModuleException: Failed to load webapp: 'User_prof-ViewController-context-root'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: view.backing.Servlet1
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
Truncated. see log file for complete stacktrace
>
<May 17, 2012 5:18:54 PM CST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'User_prof'.>
<May 17, 2012 5:18:54 PM CST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Failed to load webapp: 'User_prof-ViewController-context-root'
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: view.backing.Servlet1
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
Truncated. see log file for complete stacktrace
>
[05:18:54 PM] #### Deployment incomplete. ####
[05:18:54 PM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)
#### Cannot run application User_prof due to error deploying to IntegratedWebLogicServer.
Many Thanks & Best Regards,
HuaMinHua,
is
<servlet-class>view.backing.Servlet1</servlet-class>is this the complied path to the serverlet?
The error Caused By: java.lang.ClassNotFoundException: view.backing.Servlet1 clearly says that the app can't find the class.
Timo -
Yes, handling exception with CVI is possible
I'm not talking about SEH but regular exceptions.
First lookt at the demo code available at :
http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/demo.c.html
Once you understand what we expect from TRY, THROW and other, you could look
at both files :
http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
l
and
http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
l
Finally if you want to use this mecanism in your own code, look at the
Download page in the "Progammation C" section. At the bottom you should find
the zip file you're looking for.
Even if it looks cool, never forget to use the macros errChk and nullChk
defined in
Enjoy !
Regards, Philippe
Feel f
ree to visit : http://perso.wanadoo.fr/philippe.baucour (aka The Rebel
CVI Site)No. Sorry about that. I got many request for that but I simply do not have
time. However, in the latest sample code available online I try to have
comments in English. I guess it help some of you. Concerning the Exception
source code, sure comments are in French but the code is pretty old (see the
download page, 01/04/01). However, read it twice. Should not be that hard to
figure out how to use TRY, CATCH and THROW
Feel free to visit the home page where some explainations now exist in
english
If you are looking for a sample code illustrating one example or another try
: http://perso.wanadoo.fr/philippe.baucour/src/functions/Client_us.html
which is localized as well.
As you can see I try to make some effort ;-)
Philippe
Feel free to visit : http://perso.wanadoo.fr/philippe.baucour
"Vishi Anand" a �crit dans le message
de news: 3e96eea2@newsgroups....
> Good but can you please have something in english for poor folks like us
who
> don't know french. Would like to see what other tools/utils you got there.
>
> vishi
>
> "Philippe BAUCOUR" wrote in message
> news:3e9662fe@newsgroups....
> > I'm not talking about SEH but regular exceptions.
> >
> > First lookt at the demo code available at :
> > http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/demo.c.html
> >
> > Once you understand what we expect from TRY, THROW and other, you could
> look
> > at both files :
> >
>
http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
> > l
> > and
> >
>
http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
> > l
> >
> > Finally if you want to use this mecanism in your own code, look at the
> > Download page in the "Progammation C" section. At the bottom you should
> find
> > the zip file you're looking for.
> >
> > Even if it looks cool, never forget to use the macros errChk and nullChk
> > defined in
> >
> > Enjoy !
> > --
> > Regards, Philippe
> > Feel free to visit : http://perso.wanadoo.fr/philippe.baucour (aka The
> Rebel
> > CVI Site)
> >
> >
> >
> >
> >
>
> -
Exception with the type CX_SY_OPEN_SQL_DB occured and was not handled
Hi Champs,
I am working on an interface which picks up file uploaded in a XI server and process it. The Function module used is a Z function module, developed locally.
I am uploading an tab limited file in XI server and a background job processes the file. The tab limited file contains Payelement Transaction ID as primary key. And after validation of elements like WBS element, cost center etc the file is posted using BAPI BAPI_ACC_DOCUMENT_POST. And all the Payelement Trans Ids are also replicated in a Z table, with there status viz. Success or Error or Warning.
After background job was completed, we found in Tcode SXMB_MONI that the file was in error.
The error message was :
Error during proxy processing An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause The system tried to insert a data record, even though a data record with the same primary key already exists.
But to my dismay, I found that some of the Payelement Trans Ids were posted for a document and are also replicated in my Z table.
From the error it seems that we are inserting a record that is already there in the document. I have checked in for BAPI's input parameter, there is nothing duplicate.
Note: Insertion in Z table is made after the BAPI BAPI_ACC_DOCUMENT_POST.
Can you help me out in this issue as it is now getting into veins
Reagrds,
NishantHi,
Even we have faced this kind of issue. In order to solve this just write the following code:
1) Before inserting records in to Z table, write one select query on that table with primary key fields in where clause. Pass the value that are returned by BAPI BAPI_ACC_DOCUMENT_POST to the key field.
2) If sy-subrc = 4, insert records in Z table else Continue and dont insert records in this table.
This will solve your problem.
Regards,
Prashant -
Problem with Handling Exception in Jsp
hi
I am unable to handling exception in Jsp.
In my Simple Form i taken a simple text field named salary.
Details.jsp
<%@ page language="java" isErrorPage="true" errorPage="Det.jsp"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<html:html>
<html:form action="/det.do">
Enter Salary<html:text property="sal"/><br>
<br>
<html:submit value="SEND" />
</html:form>
</html:html>and my Actionclass is:
package com.gurukul.util;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class DetUserAction extends Action {
String s=null;
int sal;
public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
try
sal=Integer.parseInt(req.getParameter("sal"));
if (sal>0)
s="success";
else
throw new SalException(sal);}
catch(SalException e)
e.getMessage();
return map.findForward(s);
and my Formbean is
package com.gurukul.util;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class DetUserAction extends Action {
String s=null;
int sal;
public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
try
sal=Integer.parseInt(req.getParameter("sal"));
if (sal>0)
s="success";
else
throw new SalException(sal);}
catch(SalException e)
e.getMessage();
return map.findForward(s);
}and my struts-config.xml is
</form-bean>
<form-bean name="DetUser"
type="com.gurukul.util.DetUserForm">
</form-bean>
<action path="/det"
type="com.gurukul.util.DetUserAction"
name="DetUser"
input="/Details.jsp"
scope="request">
<exception key="errors.sal"
type="com.gurukul.util.SalException"
path="/jsp/Det.jsp"/>
<forward name="success" path="/jsp/DetailList.jsp" />
<forward name="failure" path="/jsp/Details.jsp"/>
</action>and Det.jsp(i.e error jsp) is
<%@ page language="java" isErrorPage="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<html:html>
<center><b>
Invalid Salary</b></center>
<%= exception.getMessage() %>
</html:html>but i didnt get exception on jsp.
please help me
Regards
VAShi
can you please guide me how to handle exceptions in Jsp(struts)? -
Proper way of handling errors in servlets?
Hi
What is the best way of handling errors in servlets? There are dozens of IOExceptions and SQLExceptions and I'm not quite sure what to with them. Now I just throw a new ServletException.IOException and SQLException is throw by your own code, so I think you should catch the exception and handle it, for example, direct user to a error page and display the reason of the error.
-
Problem with passing exception with declarative security
I am having a problem with passing exceptions with message security bunding enables. I have a JAXWS EJB 3.0 web service, The service defines methods which throw exceptions. The exceptions are passed correclty when there is no message security enabled. once the security is enabled and an exception is thrown, I get the stack trace below. Furthermore, the service with security enabled works fine as long as methods do not throw an exception. I am thinking that the JAXWS generated wrapped exception is not correctly handled by the message security provider in the server. Just a thought. Any help would be greatly appreciated.
Stack trace:
[#|2007-03-23T00:49:06.333-0600|WARNING|sun-appserver-pe9.0|javax.enterprise.sys
tem.stream.err|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;_RequestID=64417
ac0-ded8-474d-9066-5a97c8559b67;|
ERROR: 'NAMESPACE_ERR: An attempt is made to create or change an object in a wa
y which is incorrect with regard to namespaces.'|#]
[#|2007-03-23T00:49:06.334-0600|SEVERE|sun-appserver-pe9.0|javax.xml.messaging.s
aaj.soap|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;_RequestID=64417ac0-de
d8-474d-9066-5a97c8559b67;|SAAJ0511: Unable to create envelope from given source
|#]
[#|2007-03-23T00:49:06.334-0600|INFO|sun-appserver-pe9.0|javax.enterprise.system
.core.security|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;|SEC2003: Contai
ner-auth: wss: Error securing response
com.sun.enterprise.security.jauth.AuthException: Unable to create envelope from
given source:
at com.sun.xml.wss.provider.ServerSecurityAuthModule.secureResponse(Serv
erSecurityAuthModule.java:129)
at sun.reflect.GeneratedMethodAccessor237.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.jauth.AuthContext.invokePriv(AuthContext.
java:128)
at com.sun.enterprise.security.jauth.AuthContext$1.run(AuthContext.java:
78)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.jauth.AuthContext.invoke(AuthContext.java
:75)
at com.sun.enterprise.security.jauth.ConfigFile$ConfigServer.secureRespo
nse(ConfigFile.java:662)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:220)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:197)
at com.sun.enterprise.webservice.JAXWSSystemHandlerDelegateFactory$Servl
etDelegate.processResponse(JAXWSSystemHandlerDelegateFactory.java:540)
at com.sun.enterprise.webservice.monitoring.JAXWSEndpointImpl.processRes
ponse(JAXWSEndpointImpl.java:121)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOA
PMessageDispatcher.java:148)
at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3Me
ssageDispatcher.java:160)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3Messag
eDispatcher.java:89)
at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpo
int(EjbWebServiceServlet.java:178)
at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServ
iceServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.jav
a:100)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipe
line.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:23
1)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBloc
ked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Proces
sorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTas
k(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.jav
a:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:2
52)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThrea
d.java:75)
|#]
[#|2007-03-23T00:49:06.335-0600|WARNING|sun-appserver-pe9.0|javax.enterprise.sys
tem.core|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;_RequestID=64417ac0-de
d8-474d-9066-5a97c8559b67;|Exception while tracing response : Unable to create e
nvelope from given source: |#]
[#|2007-03-23T00:49:06.336-0600|WARNING|sun-appserver-pe9.0|javax.enterprise.sys
tem.stream.err|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;_RequestID=64417
ac0-ded8-474d-9066-5a97c8559b67;|
com.sun.enterprise.security.jauth.AuthException: Unable to create envelope from
given source:
at com.sun.xml.wss.provider.ServerSecurityAuthModule.secureResponse(Serv
erSecurityAuthModule.java:129)
at sun.reflect.GeneratedMethodAccessor237.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.jauth.AuthContext.invokePriv(AuthContext.
java:128)
at com.sun.enterprise.security.jauth.AuthContext$1.run(AuthContext.java:
78)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.jauth.AuthContext.invoke(AuthContext.java
:75)
at com.sun.enterprise.security.jauth.ConfigFile$ConfigServer.secureRespo
nse(ConfigFile.java:662)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:220)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:197)
at com.sun.enterprise.webservice.JAXWSSystemHandlerDelegateFactory$Servl
etDelegate.processResponse(JAXWSSystemHandlerDelegateFactory.java:540)
at com.sun.enterprise.webservice.monitoring.JAXWSEndpointImpl.processRes
ponse(JAXWSEndpointImpl.java:121)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOA
PMessageDispatcher.java:148)
at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3Me
ssageDispatcher.java:160)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3Messag
eDispatcher.java:89)
at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpo
int(EjbWebServiceServlet.java:178)
at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServ
iceServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.jav
a:100)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipe
line.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:23
1)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBloc
ked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Proces
sorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTas
k(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.jav
a:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:2
52)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThrea
d.java:75)
|#]
[#|2007-03-23T00:49:06.336-0600|SEVERE|sun-appserver-pe9.0|javax.enterprise.reso
urce.webservices.jaxws.server.soapmd|_ThreadID=11;_ThreadName=httpWorkerThread-8
080-0;_RequestID=64417ac0-ded8-474d-9066-5a97c8559b67;|Unable to create envelope
from given source:
com.sun.enterprise.security.jauth.AuthException: Unable to create envelope from
given source:
at com.sun.xml.wss.provider.ServerSecurityAuthModule.secureResponse(Serv
erSecurityAuthModule.java:129)
at sun.reflect.GeneratedMethodAccessor237.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.jauth.AuthContext.invokePriv(AuthContext.
java:128)
at com.sun.enterprise.security.jauth.AuthContext$1.run(AuthContext.java:
78)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.jauth.AuthContext.invoke(AuthContext.java
:75)
at com.sun.enterprise.security.jauth.ConfigFile$ConfigServer.secureRespo
nse(ConfigFile.java:662)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:220)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:197)
at com.sun.enterprise.webservice.JAXWSSystemHandlerDelegateFactory$Servl
etDelegate.processResponse(JAXWSSystemHandlerDelegateFactory.java:540)
at com.sun.enterprise.webservice.monitoring.JAXWSEndpointImpl.processRes
ponse(JAXWSEndpointImpl.java:121)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOA
PMessageDispatcher.java:148)
at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3Me
ssageDispatcher.java:160)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3Messag
eDispatcher.java:89)
at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpo
int(EjbWebServiceServlet.java:178)
at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServ
iceServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.jav
a:100)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipe
line.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:23
1)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBloc
ked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Proces
sorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTas
k(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.jav
a:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:2
52)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThrea
d.java:75)
|#]
[#|2007-03-23T00:49:06.338-0600|WARNING|sun-appserver-pe9.0|javax.enterprise.sys
tem.stream.err|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;_RequestID=64417
ac0-ded8-474d-9066-5a97c8559b67;|
com.sun.enterprise.security.jauth.AuthException: Unable to create envelope from
given source:
at com.sun.xml.wss.provider.ServerSecurityAuthModule.secureResponse(Serv
erSecurityAuthModule.java:129)
at sun.reflect.GeneratedMethodAccessor237.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.jauth.AuthContext.invokePriv(AuthContext.
java:128)
at com.sun.enterprise.security.jauth.AuthContext$1.run(AuthContext.java:
78)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.jauth.AuthContext.invoke(AuthContext.java
:75)
at com.sun.enterprise.security.jauth.ConfigFile$ConfigServer.secureRespo
nse(ConfigFile.java:662)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:220)
at com.sun.enterprise.security.wss.WebServiceSecurity.secureResponse(Web
ServiceSecurity.java:197)
at com.sun.enterprise.webservice.JAXWSSystemHandlerDelegateFactory$Servl
etDelegate.processResponse(JAXWSSystemHandlerDelegateFactory.java:540)
at com.sun.enterprise.webservice.monitoring.JAXWSEndpointImpl.processRes
ponse(JAXWSEndpointImpl.java:121)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOA
PMessageDispatcher.java:148)
at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3Me
ssageDispatcher.java:160)
at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3Messag
eDispatcher.java:89)
at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpo
int(EjbWebServiceServlet.java:178)
at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServ
iceServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.jav
a:100)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipe
line.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j
ava:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:23
1)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(
ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBloc
ked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(Proces
sorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTas
k(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.jav
a:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:2
52)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThrea
d.java:75)
|#]Hi,
Thanks for the reply. I read the weblog and posted a reply to it already.
History:
I actually have a web service where I have message level security enabled and it works great. I had some issues early on with descriptor but those are worked out. As I was testing, I created a test case that throws an exception. That is when I get the NAMESPACE_ERROR, jauth exceptions , etc.
Attempt to find issue:
Glassfish: V1 (glassfish-installer-9.0-b48.jar), jdk1.5.0_11
Code: EJB tech tip EJB30 web service
Security: message security, specified almost verbatim to how it is done in the link you mention.
Sample works fine until I modify the web service to throw an exception. Once I do that, I get the NAMESPACE_ERROR stack trace I posted in original message. The sample in the tech tip uses the embedded app-client.
Thanks for helping with this. -
JSR168 Portlet Exception with Oracle OC4J and Spring
JSR168 Portlet Exception with Oracle OC4J and Spring
I’m having a problem with accessing a Spring JSR168 Portlet when deployed on Oracle OC4J. I have created a very simple portlet that just renders simple jsp page. I created two versions. One using GenricPortlet and one using org.springframework.web.portlet.mvc.AbstractContro ller. The non-Spring portlet deploys and runs as expected. The Spring portlet deploys but throws the following exception
Code:
07/11/05 08:23:44 [ERROR] DispatcherPortlet - Could not complete request <javax.portlet.PortletException>javax.portlet.PortletExcept
ion
at oracle.portlet.server.containerimpl.RequestDispatcherImpl.include(RequestDispatcherImpl.java:74)
at org.springframework.web.portlet.DispatcherPortlet.render(DispatcherPortlet.java:1077)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:809)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:475)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:445)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at oracle.portlet.server.containerimpl.ServerImpl.getMarkup(ServerImpl.java:161)
at oracle.portlet.wsrp.v1.WSRPv1ToServer.getMarkup(WSRPv1ToServer.java:4512)
at oracle.portlet.wsrp.v1.WSRP_v1_Markup_PortTypeSoapToJaxb.getMarkup(WSRP_v1_Markup_PortTypeSoapToJaxb.java:68)
at oasis.names.tc.wsrp.v1.bind.runtime.WSRP_v1_Markup_Binding_SOAP_Tie.invoke_getMarkup(WSRP_v1_Markup_Binding_SOAP_Tie.java
:60)
at oasis.names.tc.wsrp.v1.bind.runtime.WSRP_v1_Markup_Binding_SOAP_Tie.processingHook(WSRP_v1_Markup_Binding_SOAP_Tie.java:7
79)
at oracle.j2ee.ws.server.StreamingHandler.handle(StreamingHandler.java:297)
at oracle.j2ee.ws.server.JAXRPCProcessor.doEndpointProcessing(JAXRPCProcessor.java:413)
at oracle.j2ee.ws.server.WebServiceProcessor.invokeEndpointImplementation(WebServiceProcessor.java:349)
at oracle.j2ee.ws.server.JAXRPCProcessor.doRequestProcessing(JAXRPCProcessor.java:277)
at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServiceProcessor.java:114)
at oracle.j2ee.ws.server.JAXRPCProcessor.doService(JAXRPCProcessor.java:134)
at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java:177)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.portlet.server.service.ContextFilter.doFilter(ContextFilter.java:86)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.servlet.ServletException: Error in servlet
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:759)
at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
at com.evermind.server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:51)
at com.evermind.server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
at oracle.portlet.server.containerimpl.RequestDispatcherImpl.include(RequestDispatcherImpl.java:65)
... 34 more
Nested Exception is javax.servlet.ServletException: Error in servlet
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:759)
at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:160)
at com.evermind.server.http.ServletRequestDispatcher.access$000(ServletRequestDispatcher.java:51)
at com.evermind.server.http.ServletRequestDispatcher$1.oc4jRun(ServletRequestDispatcher.java:97)
at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:102)
at oracle.portlet.server.containerimpl.RequestDispatcherImpl.include(RequestDispatcherImpl.java:65)
at org.springframework.web.portlet.DispatcherPortlet.render(DispatcherPortlet.java:1077)
at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:809)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:475)
at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:445)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at oracle.portlet.server.containerimpl.ServerImpl.getMarkup(ServerImpl.java:161)
at oracle.portlet.wsrp.v1.WSRPv1ToServer.getMarkup(WSRPv1ToServer.java:4512)
at oracle.portlet.wsrp.v1.WSRP_v1_Markup_PortTypeSoapToJaxb.getMarkup(WSRP_v1_Markup_PortTypeSoapToJaxb.java:68)
at oasis.names.tc.wsrp.v1.bind.runtime.WSRP_v1_Markup_Binding_SOAP_Tie.invoke_getMarkup(WSRP_v1_Markup_Binding_SOAP_Tie.java
:60)
at oasis.names.tc.wsrp.v1.bind.runtime.WSRP_v1_Markup_Binding_SOAP_Tie.processingHook(WSRP_v1_Markup_Binding_SOAP_Tie.java:7
79)
at oracle.j2ee.ws.server.StreamingHandler.handle(StreamingHandler.java:297)
at oracle.j2ee.ws.server.JAXRPCProcessor.doEndpointProcessing(JAXRPCProcessor.java:413)
at oracle.j2ee.ws.server.WebServiceProcessor.invokeEndpointImplementation(WebServiceProcessor.java:349)
at oracle.j2ee.ws.server.JAXRPCProcessor.doRequestProcessing(JAXRPCProcessor.java:277)
at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServiceProcessor.java:114)
at oracle.j2ee.ws.server.JAXRPCProcessor.doService(JAXRPCProcessor.java:134)
at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java:177)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.portlet.server.service.ContextFilter.doFilter(ContextFilter.java:86)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
2007-11-05 08:23:44.085 WARNING An internal error has occurred in method getMarkup()
I have managed to deploy and run the Spring portlet using Sun App Server and Sun Portlet container with no problems which leads me to believe my Spring setup is correct.
I also have managed to run the Spring pets portlet example on Sun App Server and Sun Portlet container with no problems. But again it fails on Oracle with the same problem.
To deploy on Oracle I ran the oracle wsrp jar against my EAR. As far as I can tell it has not corrupted any of the Spring setup in the web.xml.
The version are as follows
Oracle Portal 10.1.4 running on OAS 10.1.2
calling the portlet using WSRP v1.
The portlet is running on standalone OC4J 10.1.3.3 with Oracle portlet container 10.1.3.2. On Windows Spring 2.0.6.
Any ideas? Thanks PaulWas an answer ever found? I am currently experiencing the same issue.
Edited by: user10567841 on Nov 8, 2008 12:21 PM -
How to handle exception CX_SY_REF_IS_INITIAL
hi experts,
im working on a test scenario for abap mapping in SAP XI im getting this error
An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference
i understand that i need to catch this exception in the abap coding but i'm not familiar with oops concepts
can any one please suggest me how to handle this exception for the following code...
method IF_MAPPING~EXECUTE.
break x1149.
* initialize iXML
TYPE-POOLS: ixml.
class cl_ixml definition load.
** Instances & Variable declaration =======================
* instance main factory
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
* instance input stream factory
l_streamfactory TYPE REF TO if_ixml_stream_factory,
* instance input stream
l_istream TYPE REF TO if_ixml_istream,
* instance input document
l_document TYPE REF TO if_ixml_document,
* instance parse input document
l_parser TYPE REF TO if_ixml_parser,
* instance for elements within the nodes
node TYPE REF TO if_ixml_node,
*instance of nodemap
nodemap TYPE REF TO if_ixml_named_node_map,
* instance for iterator
iterator TYPE REF TO if_ixml_node_iterator,
name TYPE string,
value TYPE string,
* instance main factory
o_ixml TYPE REF TO if_ixml,
* instance output document
o_document TYPE REF TO if_ixml_document,
* instance output stream
o_istream TYPE REF TO if_ixml_ostream,
* instance parse output document
o_parser TYPE REF TO if_ixml_parser,
* instance fot renderer
renderer type ref to if_ixml_renderer,
irc type i,
l_xml_size TYPE i,
*ROOT ELEMENT
l_element_MT_DEMANDTEC_COST TYPE REF TO if_ixml_element,
*NEXT CHILD ELEMENT FROM THE ABOVE PARENT
l_element_DT_DEMANDTEC TYPE REF TO if_ixml_element,
*CHILDREN1 ELEMENT FOR DT_DEMANDTEC
l_element_DT_WHSE TYPE REF TO if_ixml_element,
*CHILDREN2 ELEMENT FOR DT_DEMANDTEC
l_element_DT_DC TYPE REF TO if_ixml_element,
*CHILDREN3 ELEMENT FOR DT_DEMANDTEC
l_element_DT_PLANT TYPE REF TO if_ixml_element,
*CHILDREN4 ELEMENT FOR DT_DEMANDTEC
l_element_DT_QTY TYPE REF TO if_ixml_element.
*saving the xml document
DATA: l_xml_table TYPE TABLE OF t_xml_line.
types: begin of t_source,
whse(5),
dc(4) ,
plant(4),
qty type i,
end of t_source.
types: tt_source TYPE STANDARD TABLE OF t_source.
data: wa_source type t_source.
data: it_source TYPE tt_source,
ivalue type string.
* Procedures and business logic =======================================
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* create input stream
l_istream = l_streamfactory->create_istream_xstring( source ).
* initialize input document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* parse input document
l_parser->parse( ).
* Validate a document
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
refresh : it_source.
node ?= l_document.
CHECK NOT node IS INITIAL.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WHEN if_ixml_node=>co_node_text.
* text node
value = node->get_value( ).
if name eq 'DT_WHSE'.
wa_source-whse = value.
ELSEIF name eq 'DT_DC'.
wa_source-DC = value.
ELSEIF name eq 'DT_PLANT'.
wa_source-PLANT = value.
ELSEIF name eq 'DT_QTY'.
wa_source-QTY = value.
COLLECT wa_source INto it_source.
CLEAR wa_source.
ENDIF.
endcase.
node = iterator->get_next( ).
endwhile.
ENDIF.
loop at it_source into wa_source .
at first.
* Creating a ixml factory
o_ixml = cl_ixml=>create( ).
* Creating the dom object model
o_document = l_ixml->create_document( ).
endat.
* Build and Fill root node MT_DEMANDTEC_COST
AT FIRST.
l_element_MT_DEMANDTEC_COST =
O_document->create_simple_element(
name = 'MT_DEMANDTEC_COST'
parent = o_document ).
ENDAT.
* Build and Fill Child node DT_DEMANDTEC for parent
* MT_DEMANDTEC_COST
l_element_DT_DEMANDTEC = O_document->create_simple_element(
name = 'DT_DEMANDTEC'
parent = l_element_MT_DEMANDTEC_COST ).
* Build and Fill Child node1 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-WHSE.
l_element_DT_WHSE = O_document->create_simple_element(
name = 'DT_WHSE'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node2 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-DC.
l_element_DT_DC = O_document->create_simple_element(
name = 'DT_DC'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node3 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-PLANT.
l_element_DT_PLANT = O_document->create_simple_element(
name = 'DT_PLANT'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node4 DT_QTY for parent DT_DEMANDTEC
ivalue = wa_source-QTY.
l_element_DT_QTY = O_document->create_simple_element(
name = 'DT_QTY'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
endloop.
* render document ======================================================
* create output stream
o_istream = l_streamfactory->create_ostream_xstring( result ).
* Connect internal XML table to stream factory
o_istream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
renderer = o_ixml->create_renderer( ostream = o_istream
document = o_document ).
irc = renderer->render( ).
* how do i catch the exception for type CX_SY_REF_IS_INITIAL ...?
endmethod.
full reward points for answers.
Thanks & Regards,
Uday Kumar.
Edited by: UDAY on May 6, 2008 9:32 PMHi Uday,
Its occurs because you're trying to access a objects with null reference. Or you forgot to create an instance or an error occurs during the instance creation. So You should put all your "Procedures and business logic" inside a Try/catch block. as follow.
" Define a class exception object to get error message......
DATA o_exception TYPE REF TO cx_sy_ref_is_initial.
"// Use the statment Try block to catch the error.
TRY.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
* create input stream
l_istream = l_streamfactory->create_istream_xstring( source ).
* initialize input document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* parse input document
l_parser->parse( ).
* Validate a document
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
refresh : it_source.
node ?= l_document.
CHECK NOT node IS INITIAL.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WHEN if_ixml_node=>co_node_text.
* text node
value = node->get_value( ).
if name eq 'DT_WHSE'.
wa_source-whse = value.
ELSEIF name eq 'DT_DC'.
wa_source-DC = value.
ELSEIF name eq 'DT_PLANT'.
wa_source-PLANT = value.
ELSEIF name eq 'DT_QTY'.
wa_source-QTY = value.
COLLECT wa_source INto it_source.
CLEAR wa_source.
ENDIF.
endcase.
node = iterator->get_next( ).
endwhile.
ENDIF.
loop at it_source into wa_source .
at first.
* Creating a ixml factory
o_ixml = cl_ixml=>create( ).
* Creating the dom object model
o_document = l_ixml->create_document( ).
endat.
* Build and Fill root node MT_DEMANDTEC_COST
AT FIRST.
l_element_MT_DEMANDTEC_COST =
O_document->create_simple_element(
name = 'MT_DEMANDTEC_COST'
parent = o_document ).
ENDAT.
* Build and Fill Child node DT_DEMANDTEC for parent
* MT_DEMANDTEC_COST
l_element_DT_DEMANDTEC = O_document->create_simple_element(
name = 'DT_DEMANDTEC'
parent = l_element_MT_DEMANDTEC_COST ).
* Build and Fill Child node1 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-WHSE.
l_element_DT_WHSE = O_document->create_simple_element(
name = 'DT_WHSE'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node2 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-DC.
l_element_DT_DC = O_document->create_simple_element(
name = 'DT_DC'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node3 DT_WHSE for parent DT_DEMANDTEC
ivalue = wa_source-PLANT.
l_element_DT_PLANT = O_document->create_simple_element(
name = 'DT_PLANT'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
* Build and Fill Child node4 DT_QTY for parent DT_DEMANDTEC
ivalue = wa_source-QTY.
l_element_DT_QTY = O_document->create_simple_element(
name = 'DT_QTY'
VALUE = ivalue
parent = l_element_DT_DEMANDTEC ).
endloop.
* render document ======================================================
* create output stream
o_istream = l_streamfactory->create_ostream_xstring( result ).
* Connect internal XML table to stream factory
o_istream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
renderer = o_ixml->create_renderer( ostream = o_istream
document = o_document ).
irc = renderer->render( ).
" The Statement CATCH define a block that catches the exceptions of the
" exception class cx_sy_ref_is_initial
CATCH cx_sy_ref_is_initial INTO o_exception.
" If you need to get the error message text do as follow
DATA errorMsg type string.
" Get the message text
errorMsg = o_exception->GET_TEXT( ).
" Display the error information
MESSAGE errorMsg TYPE 'I'.
ENDTRY.
The TRY block defines a guarded area whose class-based exceptions can be caught in the subsequent CATCH blocks. If no exception occurs in the TRY block and it reaches its end, the system continues the processing after ENDTRY. If a class-based exception occurs in the TRY block, the system searches for an exception handler in the same or an external TRY control structure.
Font: SAP Help
You can see a how to create and use an exception in this example [ ABAP Objects - Defining a Class-based exceptions|https://wiki.sdn.sap.com/wiki/x/19w] .
Best Regards.
Marcelo Ramos -
hi,
i have below block,
DECLARE
doc dbms_xmldom.DOMDocument;
node dbms_xmldom.DOMNode;
elem dbms_xmldom.DOMElement;
cur_node dbms_xmldom.DOMNode;
root_elem_data dbms_xmldom.DOMElement;
root_elem_tab dbms_xmldom.DOMElement;
root_node_data dbms_xmldom.DOMNode;
mode_elmn dbms_xmldom.DOMElement;
mode_node dbms_xmldom.DOMNode;
mode_text dbms_xmldom.DOMText;
doc1 DBMS_XMLDOM.DOMDOCUMENT;
root_node_data1 DBMS_XMLDOM.DOMNODE;
child_document DBMS_XMLDOM.DOMDOCUMENT;
child_rootnode DBMS_XMLDOM.DOMNODE;
V_CLOB CLOB;
v_doc CLOB;
v_EMP CLOB;
v_output_filename VARCHAR2(300) := 'SPOOL_DIR/'||'EMP_XML_FILE.xml';
l_xmltype XMLTYPE;
BEGIN
doc := dbms_xmldom.newDOMDocument;
node := dbms_xmldom.makeNode(doc);
dbms_xmldom.setversion(doc, '1.0');
dbms_xmldom.setCharset(doc, 'UTF8');
elem := dbms_xmldom.createElement(doc, 'PartnerInfo');
dbms_xmldom.setAttribute(elem,'xmlns','EMP');
cur_node := dbms_xmldom.appendChild(node, dbms_xmldom.makeNode(elem));
mode_elmn := dbms_xmldom.createElement(doc, 'EMPLOYEE');
mode_node := dbms_xmldom.appendChild(cur_node,dbms_xmldom.makeNode(mode_elmn));
BEGIN
SELECT value(e) INTO l_xmltype
FROM TABLE(XMLSequence(Cursor(SELECT * FROM EMP1 where EMPNO=7501))) e;
child_document := DBMS_XMLDOM.newDOMDocument(l_xmltype);
root_node_data1 := dbms_xmldom.importNode(doc,dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(child_document)),TRUE);
root_node_data1 := DBMS_XMLDOM.appendChild(root_node_data, root_node_data1);
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
END;
dbms_lob.createtemporary(v_doc, true);
dbms_xmldom.writeToClob(doc,v_doc,'UTF8');
v_EMP:= v_doc;
dbms_xmldom.writeToFile(DOC,v_output_filename,'UTF8');
dbms_xmldom.freeDocument(doc);
--Dbms_Output.Put_Line('THE OUTPUT IS::'||V_EMP);
EXCEPTION
WHEN OTHERS THEN
Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
END;
The xml file is 'EMP_XML_FILE.xml'
<empno>U++kYmcVuGchxbh+++++++++++++++1+</empno>
<empname>J</empname>
suppose the empno 7501 is not available in our emp table,
i got error
ORA-03113: end-of-file on communication channel
how to handle xmldom with no data values.
by
sivahi,
please give the solution
by
siva -
Invalid Handle Exception-What is the reason?
I face with "Invalid Handle exception" (SQLException) while using the following code.
Could anybody tell me the possible reasons/Situation the error rise?
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(SQLStmt);
if(rs!=null){
ResultSetMetaData rsm = rs.getMetaData();
int totalcols = rsm.getColumnCount();
Vector temp;
while (rs.next()) {
Vector temp = new Vector();
for (int i = 1; i <= totalcols; i++) {
String value = rs.getString(i);
if (value == null) {
value = "";
temp.addElement(value);
}//for loop ends here
valueVector.addElement(temp);
rs.close();
stmt.close();
Thank you allVector temp;
while (rs.next()) {
Vector temp = new Vector();Are you sure that this is the code you are running? The reason I ask is that I'm pretty sure that it won't compile, at least under JDK1.4. You should get a compile error something like "temp is already defined".
If thats not the problem you need to find out on which line the error actually occurs. You can get this from the exception by calling the printStackTrace() method.
Col
Maybe you are looking for
-
My iPhone was stolen in Asia and it's now in Germany. How do I get it back? All I have left is a serial number, apple ID and password, plus a police report. What do I do now? I really want my phone back. Can someone help me? Thank you, Bobi
-
system details: windows 2003 with sp1, mssql 2000 with sp4, with solman 3.2, basis 16,aba16. Dear all, In transaction solar01 or solar02, in project document tab, rather choosing the option upload file, is it possible to create link for the external
-
Dear experts, Can any body explain me what is the link between payment method and Dunning? Why we can't execute dunning for a customer for which payment method in customer master or due line item? Regards babu
-
Dear all, In service po ESLL table there is no PO Number. SAY example i wanted to know wat r all the service pending po's. i can get all the datas except ESLL. becos int his table there is no po no. pls tel me ESLL table LINK WITH othe
-
How to automatically activate the indicator u2018Capital Goods Affectedu2019 in MI
Dear Expert; I've created a specific document for asset purchases order, I want at the MIRO automatically activate the indicator u2018Capital Goods Affectedu2019. Is it possible by setting via the SPRO or my document. Thank you in advance for your he