aspose file tools*
The moose likes Struts and the fly likes Hi Im New to Struts and Hibernate. Help Find a solution for HTTP STATUS 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Hi Im New to Struts and Hibernate. Help Find a solution for HTTP STATUS 404" Watch "Hi Im New to Struts and Hibernate. Help Find a solution for HTTP STATUS 404" New topic
Author

Hi Im New to Struts and Hibernate. Help Find a solution for HTTP STATUS 404

Jugal Bhatt
Greenhorn

Joined: Feb 03, 2013
Posts: 1
Hi,
The following is the code. help find the error. I get this(HTTP STATUS 404) error everytime i run the Apache Tomcat Server.



Main.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Fedex</title>
</head>
<body>
<s:form action="add">
<s:textfield name="competency.empid" label="Empid"/>
<s:textfield name="competency.name" label="Name"/>
<s:textfield name="competency.java"/>
<s:textfield name="competency.mainframe"/>
<s:textfield name="competency.oracle"/>
<s:textfield name="competency.others1"/>
<s:textfield name="competency.others2"/>
<s:submit name="Submit"/>
<s:reset name="Clear"/>
</s:form>
</body>
</html>



competency.java

package cmsPack;

import com.opensymphony.xwork2.ActionSupport;

public class Competency extends ActionSupport {

/**
*
*/
private static final long serialVersionUID = 1L;
private String java;
private String mainframe;
private String oracle;
private String others1;
private String others2;
public String getJava() {
return java;
}
public void setJava(String java) {
this.java = java;
}
public String getMainframe() {
return mainframe;
}
public void setMainframe(String mainframe) {
this.mainframe = mainframe;
}
public String getOracle() {
return oracle;
}
public void setOracle(String oracle) {
this.oracle = oracle;
}
public String getOthers1() {
return others1;
}
public void setOthers1(String others1) {
this.others1 = others1;
}
public String getOthers2() {
return others2;
}
public void setOthers2(String others2) {
this.others2 = others2;
}


}


CompetencyAction.java

package cmsPack;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import cmsPack.CompetencyManager;
public class CompetencyAction extends ActionSupport {

/**
*
*/
private static final long serialVersionUID = 1L;
private Competency comp;
private CompetencyManager compman= new CompetencyManager();
private List<Competency> complist;



public String add()
{
try
{
compman.add(getComp());
this.complist= compman.list();
}
catch (Exception e) {
e.printStackTrace();
}
return SUCCESS;
}

public Competency getComp() {
return comp;
}
public void setComp(Competency comp) {
this.comp = comp;
}
public CompetencyManager getCompman() {
return compman;
}
public void setCompman(CompetencyManager compman) {
this.compman = compman;
}
public List<Competency> getComplist() {
return complist;
}
public void setComplist(List<Competency> complist) {
this.complist = complist;
}


}


CompetencyManager.java


package cmsPack;

import java.util.List;

import org.hibernate.Session;

import com.opensymphony.xwork2.ModelDriven;

public class CompetencyManager extends HibernateUtil implements ModelDriven<Competency>{


public Competency add(Competency comp)
{
Session ses =HibernateUtil.getSessionFactory().getCurrentSession();
ses.beginTransaction();
ses.save(comp);
ses.getTransaction().commit();
ses.close();
return comp;

}


@Override
public Competency getModel() {
// TODO Auto-generated method stub
return null;
}


public List<Competency> list() {
Session ses = HibernateUtil.getSessionFactory().getCurrentSession();
ses.beginTransaction();
Competency complist = (Competency) ses.createQuery("from competency").list();
ses.getTransaction().commit();
return (List<Competency>) complist;
}

}


HibernateUtil.java


package cmsPack;


import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.annotations.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try { // Create the SessionFactory from hibernate.cfg.xml
return new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex); }
} public static SessionFactory getSessionFactory() {
return sessionFactory; }
}


Hibernate.cfg.xml


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="connection.url">jdbc:derby:C:\DerbyDatabases\MyDB;create=true</property>
<property name="connection.username">admin</property>
<property name="connection.password">admin</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping class="cmsPack.Competency" />

</session-factory>

</hibernate-configuration>



web.xml



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Fedex</display-name>
<welcome-file-list>
<welcome-file>mainscreen.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>main.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>


Console



Feb 03, 2013 4:01:50 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Learning_Struts_Hibernate' did not find a matching property.
Feb 03, 2013 4:01:50 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jre7\bin\client;C:\Program Files\Java\jre7\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;.
Feb 03, 2013 4:01:50 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8081
Feb 03, 2013 4:01:50 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 285 ms
Feb 03, 2013 4:01:50 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 03, 2013 4:01:50 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
Feb 03, 2013 4:01:50 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
Feb 03, 2013 4:01:51 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Feb 03, 2013 4:01:51 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/C:/Fedex/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning_Struts_Hibernate/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load bean: typerg.apache.struts2.views.gxp.inject.InjectedObjectContainer classrg.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/C:/Fedex/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning_Struts_Hibernate/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
... 25 more

Feb 03, 2013 4:01:51 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/Fedex/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning_Struts_Hibernate/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:483)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load configuration. - bean - jar:file:/C:/Fedex/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning_Struts_Hibernate/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
... 20 more
Caused by: Unable to load bean: typerg.apache.struts2.views.gxp.inject.InjectedObjectContainer classrg.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/C:/Fedex/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning_Struts_Hibernate/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
... 25 more

Feb 03, 2013 4:01:51 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Feb 03, 2013 4:01:51 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/Learning_Struts_Hibernate] startup failed due to previous errors
Feb 03, 2013 4:01:51 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8081
Feb 03, 2013 4:01:51 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 03, 2013 4:01:51 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Feb 03, 2013 4:01:51 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 952 ms

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8702
    
    6

Sounds like you are missing a dependency:

Please use code tags in your future posts. They preserve code formatting and make your code easier to read.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hi Im New to Struts and Hibernate. Help Find a solution for HTTP STATUS 404
 
Similar Threads
Exception starting filter in Struts2
action mapped error
set property error?
Struts can't work
struts2.2.1 combined tutorial with modified changes not able to work