Struts mysql

Am trying to access a mysql database using struts ,but I get a error mgs:
error
exception
javax.servlet.ServletException: java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingStatement
root cause
java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingStatement.
why?
part code action class
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
//casting a formbean
LoginForm bean =(LoginForm) form ;
//get form parameters
String name = bean.getName();
//get connection from database
javax.sql.DataSource dataSource;
java.sql.Connection myConnection = null;
try {
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
PreparedStatement stmt=(PreparedStatement) myConnection.createStatement();
// Execute a query
String query = "SELECT * FROM `role` NATURAL JOIN `user` WHERE username = '"+bean.getName()+"' ";
ResultSet rs =stmt.executeQuery(query);
// extract data from the ResultSet
while(rs.next()){
String role = rs.getString("role");
if(role.equalsIgnoreCase("admin")||(role.equalsIgnoreCase("user")) ){
HttpSession session = request.getSession();
session.setAttribute("result",role);
return mapping.findForward("success");
}else{
return mapping.findForward("fail");
//close connection
rs.close();
stmt.close();
}catch (SQLException sqle){
getServlet().log("Connection.process", sqle);
}finally {
//enclose this in a finally block to make
//sure the connection is closed
}try{
myConnection.close();
}catch (SQLException e){
getServlet().log("Connection.close", e);
part code form class
public class LoginForm extends org.apache.struts.validator.ValidatorForm{
private String name = null;
private String result ;
public void setName(String name) {
this.name = name;
public String getName() {
return name;
public void setResult(String result) {
this.result = result;
public String getResult() {
return result;
part code struts config
<struts-config>
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property
property="url"
value="jdbc:mysql://localhost:3306/DBstruts" />
<set-property
property="username"
value="root" />
<set-property
property="password"
value="" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
<set-property
property="validationQuery"
value="SELECT COUNT(*) FROM role" />
</data-source>
</data-sources>
<form-beans>
<form-bean name="loginForm"
type="com.jjolt.jjlogin.LoginForm">
</form-bean>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
<forward name="login" path="/login.jsp"/>
</global-forwards>
<action-mappings>
<action path="/login"
type="com.jjolt.jjlogin.DbStruts"
name="loginForm"
scope="request"
validate="true"
input="/login.jsp">
<forward name="success" path="/success.jsp"/>
<forward name="fail" path="/fail.jsp" />
</action>
</action-mappings>

where's the stack trace?
why didn't you put the code inside of the code tags?

Similar Messages

  • Struts MySQL Tutorial

    Hi,
    I tried to follow the tutorial at http://www.developeriq.com/articles/view_article.php?id=493 but when I try to access the query.jsp I get the following exception.
    org.apache.jasper.JasperException: /query.jsp(7,0) Attribute name invalid for tag form according to TLD
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I understand that it has something to do with changers made to struts in 1.2. Does anyone have an idea how to make the example work in 1.2 or maby you now a newer tutorial for connecting struts to mysql.

    The error message says that the form tag
    <html:form action="Query"
    name="queryForm">does not have a name attribute i.e. should look
    <html:form action="Query" styleId="queryForm">usually the styleId is not needed.

  • Help! JSP w/ struts can't find Class.forName("com.mysql.jdbc.Driver")

    I think this is just a directory structure issue but I can't figure it out. I am writing a JSP / Struts / MYSQL web application which uses the mysql JDBC connector. The connector (mysql-connector-java-5.1.6-bin.jar) is in the referenced libraries. If I write the line of code:
    Class.forName("com.mysql.jdbc.Driver");
    To load up the driver, it works in JSP files in the folder /projectname/webroot/web-inf just fine and I can go on to execute MySQL queries. However, I need to load up the driver in an action (.java action) with the directory structure /projectname/src/action and it throws the exception "class not found", I believe, it can no longer seem to get to the driver. Can anyone tell me how to resolve this problem?
    Thanks in advance, I hope this is the correct place (I have done my best to find the right one).
    Edited by: Arkanin on Apr 24, 2008 4:39 PM

    Arkanin wrote:
    I think this is just a directory structure issue but I can't figure it out. I am writing a JSP / Struts / MYSQL web application which uses the mysql JDBC connector. The connector (mysql-connector-java-5.1.6-bin.jar) is in the referenced libraries. Nope, it's not. I don't know what "referenced libraries" means. It has to be in CLASSPATH, and that isn't an environment variable.
    If I write the line of code:
    Class.forName("com.mysql.jdbc.Driver"); No, wrong.
    The JAR file for the Driver class might go in the WEB-INF/lib of your web app. If you're using Tomcat 5.5.26, put it in common/lib.
    %

  • Doubts regarding web development

    hi friends.. iam going to design an web application with jsp,struts,mysql.I need to know how to build strong design while in developing web application.. anyone can tell me the links that related to Web development strategies or anyone tell me the important issues that come into mind while developing web application... thanks in advance

    +>>I need to know how to build strong design while in developing web application.+.
    for mvc model architecture to do better and strong application...
    +>> important issues that come into mind while developing web application+
    - clear data model and app architecuture
    -security
    -internationalization
    -validation
    -standards

  • Problem with connection in Mysql database in struts application

    Helllo
    i've just started learning struts for my new project where i'm having problem in accessing mysql database
    the datasource being defined in struts-config.xml is as follows:
    <data-sources >
        <data-source type="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
          <set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
          <set-property property="user" value="root" />
          <set-property property="password" value="" />
          <set-property property="minCount" value="" />
          <set-property property="maxCount" value="" />
          <set-property property="description" value="A" />
          <set-property property="url" value="jdbc:mysql:///dnbotind_nbotdb" />
          <set-property property="readOnly" value="false" />
          <set-property property="autoCommit" value="true" />
          <set-property property="loginTimeout" value="" />
        </data-source>
      </data-sources>as i run the application
    it gives the errors HTTP status 404-Servlet action is not available
    Thx in advance

    student-java wrote:
    it gives the errors HTTP status 404-Servlet action is not availableThis is unrelated to the datasource configuration.
    HTTP 404 is a "Page not found" error. The request URL is simply wrong. Either there's a typo in the URL, or there is a typo in the servlet mapping, or the servlet is not there where you think.

  • Error in using mysql in struts, help

    error log:
    2005-12-07 10:34:28 StandardContext[employees]Marking servlet action as unavailable
    2005-12-07 10:34:28 StandardContext[employees]Servlet /employees threw load() exception
    javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
         at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
         at javax.servlet.GenericServlet.init(GenericServlet.java:256)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:997)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:840)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3915)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4240)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
         at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:795)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
         at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
         at org.apache.commons.digester.Rule.end(Rule.java:276)
         at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
         at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
         at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
         at org.apache.commons.digester.Digester.parse(Digester.java:1567)
         at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:475)
         at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
         at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:480)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:961)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:347)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
         at org.apache.catalina.core.StandardService.start(StandardService.java:476)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:547)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:286)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:387)
    my datasource config in struts-config.xml
         <data-sources>
              <data-source type="org.apache.commons.dbcp.BasicDataSource">
                   <set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" />
                   <set-property property="url" value="jdbc:mysql://localhost:3306/employees" />
                   <set-property property="maxCount" value="5" />
                   <set-property property="minCount" value="1" />
                   <set-property property="user" value="root" />
                   <set-property property="password" value="2" />
              </data-source>
         </data-sources>
    my question: i can use the database via command, but why can not connect to database in my application employees?
    and another interesting thing is that my application work correctly yesterday, but can not work today(make no change on anything)?

    error log:
    2005-12-07 10:34:28 StandardContext[employees]Marking servlet action as unavailable
    2005-12-07 10:34:28 StandardContext[employees]Servlet /employees threw load() exception
    javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
         at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
         at javax.servlet.GenericServlet.init(GenericServlet.java:256)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:997)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:840)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3915)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4240)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
         at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:795)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
         at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:256)
         at org.apache.commons.digester.Rule.end(Rule.java:276)
         at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
         at org.apache.catalina.util.CatalinaDigester.endElement(CatalinaDigester.java:76)
         at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
         at org.apache.commons.digester.Digester.parse(Digester.java:1567)
         at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:475)
         at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
         at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:480)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:961)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:347)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
         at org.apache.catalina.core.StandardService.start(StandardService.java:476)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:547)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:286)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:387)
    my datasource config in struts-config.xml
         <data-sources>
              <data-source type="org.apache.commons.dbcp.BasicDataSource">
                   <set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" />
                   <set-property property="url" value="jdbc:mysql://localhost:3306/employees" />
                   <set-property property="maxCount" value="5" />
                   <set-property property="minCount" value="1" />
                   <set-property property="user" value="root" />
                   <set-property property="password" value="2" />
              </data-source>
         </data-sources>
    my question: i can use the database via command, but why can not connect to database in my application employees?
    and another interesting thing is that my application work correctly yesterday, but can not work today(make no change on anything)?

  • Database connectivity in struts with mysql

    Hi,
    I want to database connectivity in struts with mysql in struts-config.xml file. I have give the code in struts-config.xml file is given below...................
    <data-sources>
    <data-source key="dbname" type="org.apache.commons.dbcp.BasicDataSource" >
    <set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
    <set-property property="url" value="jdbc:mysql://localhost:3306/antrowinnovation" />
    <!-- <set-property property="username" value=""/>
    <set-property property="password" value="indra" /> -->
    </data-source>
    </data-sources>
    And give the code in Action class is given below...
         int i=0;
         Connection con;
         Statement stmt;
              DataSource dataSource = (DataSource)servlet.getServletContext().getAttribute("dbname");
              System.out.println(dataSource);
         try{
              System.out.println("Database connecting....");
                   con=dataSource.getConnection();
              stmt=con.createStatement();
              System.out.println("Database connected....");
                   i=stmt.executeUpdate("insert into login values('" + username + "','" + password + "')");
                   System.out.println("Values inserted....");
                   }catch(Exception e){
                        System.out.println(e.getMessage());
                        System.out.println("Exception in try");
                        e.printStackTrace();
              return 0;
    But when i have run this then i got this Exception....
    INFO: Initialize action of type: login.LoginAction
    null
    Database connecting....
    null
    Exception in try
    java.lang.NullPointerException
         at login.LoginAction.insertUser(LoginAction.java:27)
         at login.LoginAction.execute(LoginAction.java:47)
         at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
         at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
         at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:743)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)
    Plz help me..

    Read some Struts tutorial.

  • Login screen in struts and mysql database

    This coding is used for only jsp page like login screen. Now i want to use this coding in struts and mysql. will u please help how can i use this coding in struts. please help me
    Index.jsp
    Admin : <input type="text" name="admin_name" size="22" value="">
    Password : <input type="password" name="admin_password" size="22">
    <input value="Login" name="login" type="submit" value="Login">
    <input value="Cancel" name="login" type="submit" value="Cancel">
    admincheck.jsp
    try
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    conn = DriverManager.getConnection
    ("Jdbc:mysql://localhost:3306/domaininform","root","");
    String admnName = request.getParameter("admin_name") ; // Get
    the User Name
    String admnPwd = request.getParameter("admin_password") ;
    statement = conn.createStatement();
    String Query = ("select * from admin " ) ;
    rs = statement.executeQuery(Query);
    while(rs.next())
    admn = rs.getString(1);
    pwd = rs.getString(2);
    if( (admnName.equals(admn)) && (admnPwd.equals(pwd)))
    { %>
    <jsp:forward page="selectTable.jsp?butType=normal"/>
    <% } %>
    <% if( (admnName != admn) && (admnPwd !=pwd ))
    {   %>
    <jsp:forward page="index.jsp">
    <jsp:param name="errMsg"
    value="Sorry Your UserName and Password is Mismatch" />
    </jsp:forward>
    <% } %>

    i know struts. but i don't know exactly send the
    textbox values in form page, action page and
    database. if u give coding like this i can easily
    manage. please help me.Read up on form beans, action classes and how they are associated in struts configuration files. You database level code (usually DAOs) can be called from action classes unless your architecture chooses to have some other layers.
    x

  • Struts, hibernate, mysql problem

    I am using eclipse, struts, hibernate, mysql, tomcat to run my web application. When I try to run more than one application that using hibernate, then all the application will hang. I am only able to run one application at a time and keep changing the host in server.xml if I want to run other application that use hibernate.
    This problem occur only when I run more than one application that using hibernate. So is anyone know why does this happen??? help plx..........

    http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch13.html

  • Problem occurs when working with the struts and mYsql database

    Hi all,
    I am working on Struts and using database mysql. I am getting this error when i tries to modify the values of jsp page and after modify when i submit a page ,the values are modifying but it is showing this error.
    After modifying the values i am forwarding the controller to the Display page where all records from the databse will be displayed.Please tell me how to solve.this..
    Thanks
    javax.servlet.ServletException: Cannot find bean employees in any scope
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495)
         at org.apache.jsp.viewEmployee_jsp._jspService(viewEmployee_jsp.java:208)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:627)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:306)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    javax.servlet.jsp.JspException: Cannot find bean employees in any scope
         at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938)
         at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:277)
         at org.apache.jsp.viewEmployee_jsp._jspService(viewEmployee_jsp.java:124)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:627)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:306)
         at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
         at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)
    Apache Tomcat/4.1.31

    Hi,
    i think you have got this sample application from Mastering Jakarta Struts book.
    Try the following changes, you can escape from this exception:
    1) In the employeelist.jsp, change the name attribute to "USER instead of "employees" as follows
    <logic:iterate id="employee" name="USER">
    and also <logic:present name="USER"> </logic:present> before and after the iterate tags.
    2)In the EmployeeList Action.java,add the following in the excute method...
              EmployeesActionMapping employeesMapping =
                   (EmployeesActionMapping)mapping;
                   if ( employeesMapping.isLoginRequired() ) {
                        HttpSession session = request.getSession();
                             if ( session.getAttribute("USER") == null ) {
                                  System.out.println("session.getAttribute is NULL");
                                  target = "login";
                             ActionErrors errors = new ActionErrors();
                             errors.add(ActionErrors.GLOBAL_ERROR,
                             new ActionError("errors.login.required"));
                             if (!errors.empty()) {
                             saveErrors(request, errors);
                        }else{
                   session.setAttribute("USER",getEmployees());
    Thanks,
    Shanmu

  • Provide me solution for STRUTS and MySQL connection

    Hi,
    friends.
    I am developing application in which i using mySQL database 5
    and using struts.
    I follow steps searched through google but i could not established
    database connection
    kindly step by step instruct me to connect with Database using struts
    if possible give me sample application to
    [email protected]
    Thanks.

    but i could not established database connectionPlease be specific. How did you conclude that? Which exceptions are you getting? Show the full message and the trace. They are not to be ignored :)

  • Accessing a mysql database in struts

    Hy, people, everyone ok????I have a problem: I am making a web application using apache struts were the action calls a DAO wich already have a connection with the database, by a connection that dont use a datasource(yet), so I need to load a driver from the java packages to use to instantiate the connection passing the url, login and password to the drivermanager to create the connection object.Wich driver should I put for the dirvermanager?I mean, what I use in this comand:Class.forName("the driver???");????????

    I'm fine. I hope everyone else is too. How are things
    in your section of the world? Is your family doing
    okay? I hope your neighbors are friendly and the
    weather is nice. I wonder if it's Friday when/where
    you're reading this. Did you get plenty of rest the
    last time you slept? Did you have nice dreams? I hope
    you did, because it's important to get a restful
    night's sleep. It can really, really help you get
    through the day in a great mood. It can even help you
    be more okay, especially when you haven't been getting
    as much rest as you should.&ccedil;a va yawmark. It is indeed Friday where I am. As for my nocturnal somnolence, it was interrupted by my four-year old who had a bad dream and came to sleep next to her mother. My wife then retired to another room to pursue further torpidity. I, on the other hand, had to deal with a coughing child. On the whole however, I feel okay. I hope that this prose reaches you in a state of general well-being.
    Thanks for all your concern,
    Streamy.

  • JSP,Struts and MySQL

    I have 2 date fields(say: from , to) in JSP. based on these date, i want to retrieve data from MySQL database. In Database, the date format is "yyyy-mm-dd" but i am using date picker in JSP for entering From date and TO date. Could you please help me how to read these date fields so that i could use them in query

    hi,
    use date fromatter to formate the date comming from date picker while preparing the query..
    Surya

  • Newbie in iplanet "does iplanet supports struts and mysql"

    hi
    i am a newbie in iplanet , i wish to know that do iplanet webserver 6.0 sp4 supports struts application, as i have a running struts appiication which is deployed on tomcat but its not working on iplanet is there any kind of special configuration i have to do. please help me out

    Refer to
    JBuilder 5, Struts 1.0 & WebLogic 6.0, a Tutorial
    http://www.netstore.ch/mesi/strutsTutorial/
    'Struts Example for iPlanet Application Server, SP3'
    http://www.icsynergy.com/downloads/struts/strutsHowTo.html
    iPlanetApplication Server Installation
    http://jakarta.apache.org/struts/userGuide/installation-ip.html
    "dan" <[email protected]> wrote:
    >
    Can anyone tell me how can i implement a struts 1.1 application in the
    following
    servers:
    iPlanet Web server 6.0
    iPlanet Application Server
    BEA WebLogic Server 7.0

  • J2EE Struts - Database connection failed - help???:(

    Hello,
    I have built a little web application and it works without any problems. In the next step I tried to add a database connection but I have already worked on it for at least one day and I could not fix the problem with the database connection.
    I downloaded the MySQL Server 5.0 and installed it, furthermore I have downloaded the jdbc driver mysql-connector-java-3.1.11.zip and extracted it to the MySQL Server 5.0 directory. Furthermore I have added under system settings - system - etended - system variables the whole path to the driver -> C:\Programme\MySQL\MySQL Server 5.0\mysql-connector-java-3.1.11\mysql-connector-java-3.1.11-bin.jar to the CLASSPATH systemvariable.
    Then I have startet the SQL Server 5.0 with mysqld --console from the command line.
    Furthermore I have added under Project-Properties-Java Build Path - Libraries - Add External JARs in Eclipse the mysql-connector-java-3.1.11-bin.jar to my Struts WebProject.
    To test the whole thing I have added to the existing test-database from mysql a table named owner and wanted to test the database connection in the Action-class with the following statements - I quote the whole execute method of the OwnerAction class:
    public ActionForward execute(
                     ActionMapping mapping,
                     ActionForm form,
                     HttpServletRequest request,
                     HttpServletResponse response)
                     throws Exception {
                   OwnerForm ownerForm = (OwnerForm) form;
                   String greet = ownerForm.getGreet();
                   String name = ownerForm.getName();
                   request.setAttribute("name", name);
                   request.setAttribute("greet", greet);
                   String address = ownerForm.getAddress();
                   String email = ownerForm.getEmail();
                   int tel = ownerForm.getTel();
                   Connection conn = null;
                   Statement stmt = null;
                   ResultSet rs = null;
                   DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
                   conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","sa");
                   try {
                         //conn = dataSource.getConnection();
                         stmt = conn.createStatement();
                         int id = 0;
                         rs = stmt.executeQuery("select max(id) as counter from owner");
                         while(rs.next()){
                            id = rs.getInt("counter");
                         id += 1;
                         stmt.executeUpdate("insert into owner values("+id+", '"+greet+"', '"+name+"', '"+email+"', '"+address+"', "+tel+")");
                         rs.close();
                         stmt.close();
                         conn.close();
                      catch(SQLException e){
                         throw new SQLException("database error");
                      // Forward control to the specified success target
                      return (mapping.findForward("success"));
          }But when I execute the WebApplication and the Action will be called the following error message appears in the browser:
    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 execution threw an exception
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    root cause
    java.lang.NoClassDefFoundError: org/gjt/mm/mysql/Driver
         com.asprise.struts.action.OwnerAction.execute(OwnerAction.java:72)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.
    It must depend with anything that the driver was not found but I have defined it in the CLASSPATH variable and added it to the Web-Project in eclispe.
    Has anybody an idea what I have else made wrong or have forgotten??:(:(:(
    thanks in advance
    lg
    pat

    One thing I have forgotten - I have also copied the mysql-connector-java-3.1.11-bin.jar in the WebRoot\WEB-INF\lib directory of my EasyStruts WebApplication.
    Can anything else be wrong??:(:((
    regards

Maybe you are looking for

  • How To-set DFF to null and Not required in OAF page ??

    enabled service dff, added 2 segments. i want them displayed in service request oaf pages. details of dff- Application=Service , title = Additional Information for Agents in context field region : unchecked required and displayed In global data eleme

  • Appearing and Missing Text

    Hello. I bought the following template from template monster: I then outsourced it to a professional to set it up according to my wishes: I had everything replaced and added some of my own ideas like sound and video. Please visit the site here: http:

  • Asset is incomplete and has to be completed

    Dear experts while closing the asset year 2008 im getting the error "Asset is incomplete and has to be completed " I opened the transaction code AUVA I got incomplete assets list with depreciation start date for 15 depreciation area.Please find the b

  • Paste date in strings in format of mm/dd/yy to Numbers

    I have trouble to paste a list of dates in the format of mm/dd/yy into numbers. For example: 04/01/10 04/23/10 After pasting into Numbers, I got: 2004-01-10 04/23/10 How can I paste a list fo date strings in the format as they are?

  • File transfer from client to AS

    hi, I want to transfer a text file from my c:\text.txt to application server c:\files\files.txt. Hw can I achieve this using oracle forms webutil file transfer? becasue when i read the file using client_text_io it takes a lot of time. thanks and rega