aspose file tools*
The moose likes Struts and the fly likes java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null" Watch "java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null" New topic
Author

java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null

Rahul B. Shah
Greenhorn

Joined: Jan 17, 2011
Posts: 24
Hello,
I am new to struts & trying simple application which involves database,so i created a plain java class which does database connection & from action class i am calling this java class but it seems to be wrong

code ::::

LoginAction.java

package loginapplicationaction;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;

import loginapplicationform.LoginForm;

public class LoginAction extends Action
{
private Connection con=null;
private PreparedStatement pstat=null;
private ResultSet rsTry=null;
private String input="",check="";
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception
{
LoginForm lf = (LoginForm)form;
InitDbase idb = new InitDbase();
con = idb.getCon();
input = lf.getUserName();
System.out.println(input+".........................");
checkDB(input);
if(input.equalsIgnoreCase(check))
{
return mapping.findForward("success");
}
else
{
return mapping.findForward("failure");
}
}

public void checkDB(String msg)
{
String sql="";
try
{
sql = "Select * from product where name='"+msg+"' ";
pstat = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
rsTry = pstat.executeQuery();
if(rsTry.next())
{
check = rsTry.getString("Name");
}
}
catch(Exception e)
{

}
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------------

InitDbase.java

package loginapplicationaction;

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import javax.swing.JOptionPane;

public class InitDbase
{
private Connection con = null;
private final Logger myLogger = Logger.getLogger(InitDbase.class);

public InitDbase()
{
createDBConnection();
}

public void createDBConnection()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/trial","root","rahul");
if(con==null)
{
MessageBox("Could Not Connect To Database");
myLogger.info("Connection Not Successfull");
}
else
{
MessageBox("Connection Successfull");
myLogger.info("Connection Successfull");
}
}
catch(ClassNotFoundException cnfe)
{
MessageBox("ClassNotFound..."+cnfe.toString());
myLogger.error("Could Not Find MySQL Connector Class"+cnfe);

}
catch(SQLException sqle)
{
MessageBox("SQLException :-"+sqle.toString());
myLogger.info("Error In CreateDBConnection" + sqle);
}
}

public void MessageBox(Object obj)
{
JOptionPane.showMessageDialog(null,obj.toString());
}

public Connection getCon()
{
return con;
}
public void setCon(Connection conn)
{
this.con = conn;
}
}
---------------------------------------------------------------------------------------------------------------------------------------------------------

Error.log

2011-08-06 11:39:54,109 [INFO ] org.apache.struts.action.ActionServlet.initChain(ActionServlet.java:1686) - Loading chain catalog from jar:file:/E:/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LoginApplication/WEB-INF/lib/struts-core-1.3.10.jar!/org/apache/struts/chain/chain-config.xml
2011-08-06 11:40:03,921 [INFO ] org.apache.struts.chain.ComposableRequestProcessor.init(ComposableRequestProcessor.java:147) - Initializing composable request processor for module prefix ''
2011-08-06 11:40:04,000 [WARN ] org.apache.struts.util.PropertyMessageResources.loadLocale(PropertyMessageResources.java:352) - Resource org/apache/struts/action/ActionResources_en_US.properties Not Found.
2011-08-06 11:40:04,000 [WARN ] org.apache.struts.util.PropertyMessageResources.loadLocale(PropertyMessageResources.java:352) - Resource org/apache/struts/action/ActionResources_en.properties Not Found.
2011-08-06 11:40:04,015 [WARN ] org.apache.struts.chain.commands.AbstractExceptionHandler.execute(AbstractExceptionHandler.java:95) - Unhandled exception
java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:70)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
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:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
2011-08-06 11:40:04,015 [WARN ] org.apache.struts.chain.commands.ExceptionCatcher.postprocess(ExceptionCatcher.java:165) - Exception from exceptionCommand 'servlet-exception'
java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:70)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
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:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
2011-08-06 11:40:04,015 [ERROR] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:253) - Servlet.service() for servlet action threw exception
java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null
at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:70)
at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
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:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
--------------------------------------------------------------------------------------------------------------------------------------------------------

i dont know what is missing

Thank-You.
 
wood burning stoves
 
subject: java.lang.IllegalArgumentException: The path of an ForwardConfig cannot be null