Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Problem with a simple struts application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with a simple struts application" Watch "Problem with a simple struts application" New topic
Author

Problem with a simple struts application

Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
I have written a small application in struts.

The code for it is as follows:

login.jsp




LoginForm.java





struts-config.xml

Can anybody test it and tell me where I have gone wrong.
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Hi Dinakar Kasturi

Tell what error you got,then only it is easy for viewers to correct you

Changes in struts-config file


Still error, tell what the error is???
Vikas
Ranch Hand

Joined: Dec 16, 2004
Posts: 63
Hi,

If I check your action mapping i.e.

<action name = "java" path = "/login" scope = "session" type = "sample.LoginAction">

the action tag is not closed it must be like

<action name = "java" path = "/login" scope = "session" type = "sample.LoginAction" /> instead.

What other error do you get?? Kindly specify.

Thank you
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
Hi,

Thanks a lot. Now, I think there is no problem with the code. But the problem is in setting up my IDE or ClassPath settings.

I am using myeclipse and configured tomcat. when I start tomcat, it says

A configuration Error Occuredduring statup. Please verify the preference field with prompt: Tomcat JDK Name.


Any help in resolving the issue is highly appreciated.

Dinakar Kasturi
Nilesh Naik
Greenhorn

Joined: Jul 18, 2006
Posts: 13
Looking at login.jsp and LoginForm.java, the properties do not match.
The property name used in the jsp should be a member(with getter and setter methods) in the ActionForm

Please do make the necessary Changes.
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
I made necessary changes as told by you. Even then it is giving an error.

Currently, the error is

Aug 25, 2006 2:38:36 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 25, 2006 2:38:36 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8009
Starting service Tomcat-Standalone
Apache Tomcat/4.1.32
Aug 25, 2006 2:38:46 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:130)
at org.apache.commons.beanutils.BeanUtilsBean.<init>(BeanUtilsBean.java:110)
at org.apache.commons.beanutils.BeanUtilsBean$1.initialValue(BeanUtilsBean.java:68)
at org.apache.commons.beanutils.ContextClassLoaderLocal.get(ContextClassLoaderLocal.java:80)
at org.apache.commons.beanutils.BeanUtilsBean.getInstance(BeanUtilsBean.java:78)
at org.apache.commons.beanutils.ConvertUtilsBean.getInstance(ConvertUtilsBean.java:115)
at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:217)
at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:560)
at org.apache.commons.digester.Rule.end(Rule.java:230)
at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.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.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:487)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:578)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3643)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:776)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:759)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:537)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:730)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:625)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:374)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:784)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:330)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1155)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:696)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1147)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:310)
at org.apache.catalina.core.StandardService.start(StandardService.java:449)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2212)
at org.apache.catalina.startup.Catalina.start(Catalina.java:458)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:345)
at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
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.main(Bootstrap.java:150)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 55 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
... 56 more
Aug 25, 2006 2:38:47 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:130)
at org.apache.commons.beanutils.BeanUtilsBean.<init>(BeanUtilsBean.java:110)
at org.apache.commons.beanutils.BeanUtilsBean$1.initialValue(BeanUtilsBean.java:68)
at org.apache.commons.beanutils.ContextClassLoaderLocal.get(ContextClassLoaderLocal.java:80)
at org.apache.commons.beanutils.BeanUtilsBean.getInstance(BeanUtilsBean.java:78)
at org.apache.commons.beanutils.ConvertUtilsBean.getInstance(ConvertUtilsBean.java:115)
at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:217)
at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:560)
at org.apache.commons.digester.Rule.end(Rule.java:230)
at org.apache.commons.digester.Digester.endElement(Digester.java:1130)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.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.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:487)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:578)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3643)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:776)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:759)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:537)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:730)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:625)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:374)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:784)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:330)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1155)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:696)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1147)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:310)
at org.apache.catalina.core.StandardService.start(StandardService.java:449)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2212)
at org.apache.catalina.startup.Catalina.start(Catalina.java:458)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:345)
at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
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.main(Bootstrap.java:150)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 55 more
Caused by: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
... 56 more
Aug 25, 2006 2:38:47 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 25, 2006 2:38:47 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8009
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
It is clearly telling

You have more than one version of 'org.apache.commons.logging.Log'

Hope you added 2 different versions of commons-logging.jar
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
I resolved old errors. The new error that I get is:

org.apache.jasper.JasperException: File "/struts-html.tld" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:404)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:202)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:458)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:523)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:253)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:137)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


But, I have strutshtml file in WEB-INF.

Can anybody explain on what can be the problem
azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
<%@ taglib uri = "/WEB-INF/struts-html.tld" prefix = "html" %>
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
Hi, I made the necessary changes. Now, the error I get is

org.apache.jasper.JasperException: /login.jsp(19,0) The end tag "</html:form" is unbalanced
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:170)
org.apache.jasper.compiler.Parser.checkUnbalancedEndTag(Parser.java:1744)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1599)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1827)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1405)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1827)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1405)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1827)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1100)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1405)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1598)
org.apache.jasper.compiler.Parser.parse(Parser.java:171)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:253)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:137)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)




My code for login.jsp is



web.xml is



I am using Tomcat 5.0.8.

Can anybody throw some light on it?

Thanks,
Dinakar Kasturi
SCJP 1.4
azhar bharat
Ranch Hand

Joined: Jul 17, 2006
Posts: 87
you have not closed the "html:password" tag.


[ August 27, 2006: Message edited by: azhar bharat ]
Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
Hey...It's working now. Thanks for all who helped me and for complete javaranch.

Thanks,
Dinakar Kasturi
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with a simple struts application