"What should I use to open it"?
windows:wordpad or notepad
linux: kedit, gedit, openoffice, ..
"Which one?"
Is there a specific log file for your webapp? If not, probably the catalina-***.out or stdout***.log file, or else the stderr***.log file..
Usually, there is a date associated to the file as well, pick the most recent.
The java stack trace shows you the origination of the error...and sometimes even more useful information (SQL exception indicating bad user/password... or the like)
> "What should I use to open it"?
> windows:wordpad or notepad
> linux: kedit, gedit, openoffice, ..
>
>
> "Which one?"
> Is there a specific log file for your webapp? If
> not, probably the catalina-***.out or stdout***.log
> file, or else the stderr***.log file..
>
> Usually, there is a date associated to the file as
> well, pick the most recent.
>
> The java stack trace shows you the origination of the
> error...and sometimes even more useful information
> (SQL exception indicating bad user/password... or the
> like)
Also, PS:
It's likely to be toward the bottom of the file.
Maybe start by searching the file for text matching the method that tries to contact Oracle?
for example..
public void performMyOracleQueryThingamagigger(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
//....
}
search for "performMyOracleQueryThingamagigger"
> ok i have read the recent one
> it is BIG
I assume your tomcat is non-production.
1. stop tomcat
2. move the logs directory to logs.old
3. make a new logs directory.
4. restart tomcat.
5. take the LEAST number of steps to duplicate the error
6. Open the log file now (should be shorter)
ok this is the whole thing
May 8, 2007 11:03:51 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
May 8, 2007 11:03:51 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
May 8, 2007 11:04:21 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet dress threw exception
javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
When does the exception occur?
Are you doing something on the web page and it going to the database? Does the exception occur when you first start tomcat?
Also, if you are using Oracle, you surely know the name of the method you are calling that is going to need to connect to Oracle. Also--you could search for the word "Oracle" -- I imagine it appears somewhere in the stack trace?
If I may ask, how long have you been writing java code?
My guess is:
javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
One of your filters isn't configured correctly, or requires an entry in your web.xml or server.xml file that isn't there.
Perhaps you could distill into as short a post as possible.
1. What are you doing, basically.
2. Has tomcat worked prior to this, or are you just setting THAT up?
3. Are you applying some sort of a filter knowingly? If so, which one is that?
ok from the beginning what i m doing.
i m building an ecommerce site ,it is a 3 tier architecture ,i have passed 2 satges.my shopping cart is working fine. now i m in the last phase of having the oracle as the backend.
i want to display the customer's information on the confirm page.
i added the connectivity code and the sql staments blablah in the servlet which i have created.
i m just having 1 servlet.
now after doing all this.i open my webpage.i add an item(through checbox),enter quantity and click the submit button.
this error comes
javax.servlet.ServletException: Servlet execution threw an exception
now u c nothing is working now.
i know it is with the code of oracle coneectivity and the rest that is making this problem,i have commented that part and then my shopping cart works.
so what should i do?something is wrong with the connection part.....or what?
i have it in try and catch
it is big code
public class DressServlet extends HttpServlet
{
private String[][] data = new String[100][4];
public void init(ServletConfig fig) throws ServletException
{
super.init(fig);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{.........................
}
ServletContext context = getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/empty.htm");
dispatcher.forward(request, response);
try
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn=DriverManager.getConnection ("jdbc:oracle:thin:@127.0.0.1:1522:XE","system","786313");
String first_name = request.getParameter("firstName");
String last_name = request.getParameter("lasttName");
String address = request.getParameter("address");
String country = request.getParameter("country");
String email = request.getParameter("email");
Statement stmt=conn.createStatement();
if(action.equals("insert"))
{
String queryinsert = "INSERT INTO" + "customer"+ ("cust_id" + "," +"cust_first_name" + "," + "cust_last_name" + "," + "cust_address" + ", " + "cust_country" + "," + "cust_email") +" VALUES"+"('" + "custId"+ "',"
+ "firstname" + "',"
+" lasttname "+ "',"
+ "address "+ "',"
+ "country "+ "',"
+ "email" + "')";
}
else if (action.equals("display"))
{
ResultSet result = stmt.executeQuery("SELECT (cust_first_name,cust_last_name,cust_address,cust_country,cust_email) FROMcustomer WHERE (cust_first_name = first_name AND cust_last_name = last_name)");
result.close();
}
stmt.close();
conn.close();
}
catch(Exception e)
{
System.out.println("error"+e);
e.printStackTrace(System.out);
}
String temp="";
Cookie cookie2= new Cookie("address", temp);
cookie2.setMaxAge(24*60*60);
response.addCookie(cookie2);
ServletContext context2 = getServletContext();
RequestDispatcher dispatcher2 = context2.getRequestDispatcher("/confirmpage.jsp");
dispatcher2.forward(request, response);
}
public void chip(String cookieValue)
{.............................
}}
this is practically my whole servlet
> Good catch. I am fried just getting her (?) to the
> posting of code stage.
And then there's the usual suspects:
"Don't use instance variables in a servlet."
"Use PreparedStatement instead of that mess of quotes and commas."
"Close your connection in a finally block."
> ok i m tired,i have been working on this project
> whole day.i ll be back tomorrow.meantime plz somebody
> find the error in the program.
> tell me WHAT to do
You seem to be under the mistaken impression that people here are your personal servants who are here to fix your code for you.
It doesn't work that way. People are here to help you find and fix your problem, and to help you understand what you did wrong so you can leran from your mistake, not to do your work for you.
of course i know that
i wrote my last msg coz yesterday i have been working on my project from 11:00 am till midnight ,and i was dead tired.i started getting problems in the evening and then only i came online.
plz don't write such things when u don't know exactly what the other person is doing.
when did i act like every1 are servants of mine?
i m just trying to get my errors cleared up