File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

please help me where i am wrong

 
syed mahboob
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator



config.xml
------------

<app-config>
<request-info>
<path>login</path>
<bean-class>
com.lara.client.LoginBean
</bean-class>
<action-class>
com.lara.client.LoginBean
</action-class>
<forward name="success">
success.jsp
</forward>
<forward name="failure">
login.jsp
</forward>
</request-info>
<request-info>
<path>reg</path>
<bean-class>
com.lara.client.RegistrationBean
</bean-class>
<action-class>
com.lara.client.RegistrationAction
</action-class>
<forward name="success">
regSuccess.jsp
</forward>
<forward name="failure">
reg.jsp
</forward>
</request-info>
</app-config>



web.xml
---------

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>project</display-name>
<servlet>
<description>
</description>
<display-name>ControllerServlet</display-name>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>com.lara.servlets.controller.ControllerServlet</servlet-class>
<init-param>
<description>
</description>
<param-name>driverClass</param-name>
<param-value>oracle.jdbc.driver.OracleDriver</param-value>
</init-param>
<init-param>
<description>
</description>
<param-name>url</param-name>
<param-value>jdbcracle:thin:@localhost:1521:XE</param-value>
</init-param>
<init-param>
<description>
</description>
<param-name>username</param-name>
<param-value>test</param-value>
</init-param>
<init-param>
<description>
</description>
<param-name>password</param-name>
<param-value>syed</param-value>
</init-param>
<init-param>
<description>
</description>
<param-name>poolSize</param-name>
<param-value>10</param-value>
</init-param>

<init-param>
<param-name>config-file</param-name>
<param-value>
config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>



<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>




login.jsp
---------

${status}
<form action="login.do?" method="post">
Username: <input type="text" name="username" value="${param.username}" />
</br> Password: <input type="password" name="password" /> </br> <input
type="submit" value="submit" />

</form>


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet ControllerServlet threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
com.lara.servlets.controller.ControllerServlet.init(ControllerServlet.java:46)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(Unknown Source)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.28
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's hard to follow the code, as it's completely unindented, and you didn't UseCodeTags. I have added those for the Java code, but without indentation it's too hard to read. Please edit your post to make it more readable.

As to the problem itself, you can probably get a good deal closer to the solution if you write the value that's causing the problem to a log file (maybe using System.out.println) before parsing it into an integer.

Finally, some notes about servlets (which have nothing to do with the problem at hand): 1) Servlets should not have constructors - all initialization should be done in the init method. 2) If the destroy method doesn't do anything, delete it. 3) The doGet and doPost methods do the same thing; that likely violates the HTTP specification.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please keep discussion of the same problem in the same topic. I have closed this one.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic