hibernate class not found exception - eclipse

before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
http://www.youtube.com/watch?v=o2Vjs8ylmFM
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:531)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:901)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:830)
org.apache.jsp.index_jsp._jspService(index_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ExceptionInInitializerError
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.RuntimeException: Problème de configuration : persistent class not found
Base.HibernateUtil.<clinit>(HibernateUtil.java:16)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
net.sf.hibernate.MappingException: persistent class not found
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:76)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ClassNotFoundException: Favorieensei
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:268)
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:73)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.5.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.5
and my class hibernateUtil is :
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
and my hibernate.cfg.xml page is:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
and this is my page jsp
<%#page import="DBase.HibernateUtil"%>
<%# page import="java.io.*" %>
<%# page import="java.util.*" %>
<%# page import="DBase.*" %>
<%# page import="net.sf.hibernate.*" %>
<%# page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("david#live.fr");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
this is my screan shot
plz help us we are running on time i have 3 left to finish it

The stack trace clearly states that class Favorieensei is missing. You need to check your project structure.

Related

javax.ejb.EJBException: Transaction aborted

I'm a student :D and I'm working on a project for Web Technologies. I have to work in JavaEE in JSF framework with JPA, EJB, JDBC, and I have a problem.
Warning: #{cc.attrs.loginButtonAction}: javax.ejb.EJBException: Transaction aborted
javax.faces.FacesException: #{cc.attrs.loginButtonAction}: javax.ejb.EJBException: Transaction aborted
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at
All errors
https://shrib.com/#Gaur8rM4LwV
And my code.
EJB. Controller with database
#Stateless
public class UsersFacade extends AbstractFacade<Users> {
#PersistenceContext(unitName = "OtoNaszDomPU")
private EntityManager em;
#Override
protected EntityManager getEntityManager() {
return em;
}
//...
//...
public String LoginAuthentication(String username, String password) {
Users user = null;
user = GetUser(username);
if (user == null) {
return "notExist";
}
String salt = user.getSalt();
byte[] hashed = HashSha256(password.concat(salt));
String encryptedPassword = bytesToString(hashed);
System.out.println("haslo:" + password + ", salt:" + salt + ", sha: " + encryptedPassword + " == " + user.getPassword());
//Until next line everything works properly.
return encryptedPassword.equals(user.getPassword()) == true ? "true" : "false";
}
Methods Hash256 and byteToString works properly
And My front
komponentyZlozone:Logowanie is a CompositeComponent
<center>
<h:form class="centered Form">
<h3 style="font-size: 50px">Oto Nasz Dom</h3>
<komponentyZlozone:Logowanie
usernameLabel="#{bundle['logowanie.pseudonim']}"
usernameValue="#{loginController.user}"
passwordLabel="#{bundle['logowanie.haslo']}"
passwordValue="#{loginController.pwd}"
loginButtonLabel="#{bundle['logowanie.zaloguj']}"
loginButtonAction="#{loginController.validateUsernamePassword()}"
/>
<br/><br/>
<h:button value="Rejestracja" outcome="userRegister" style="font-size: 25px; box-shadow: gray; padding: 5px;">
<f:ajax execute="toogle" render="toogleRender" event="click"/>
</h:button>
</h:form>
</center>
CompositeComponent "Blueprint"
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml"
xmlns:h = "http://java.sun.com/jsf/html"
xmlns:f = "http://java.sun.com/jsf/core"
xmlns:composite = "http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name = "usernameLabel" />
<composite:attribute name = "usernameValue" />
<composite:attribute name = "passwordLabel" />
<composite:attribute name = "passwordValue" />
<composite:attribute name = "loginButtonLabel" />
<composite:attribute name = "loginButtonAction"
method-signature = "java.lang.String validateUsernamePassword()" />
</composite:interface>
<composite:implementation>
<h:form>
<h:panelGrid columns = "2" id = "loginPanel">
#{cc.attrs.usernameLabel} :
<h:inputText id = "username" value = "#{cc.attrs.usernameValue}" required="true" />
#{cc.attrs.passwordLabel} :
<h:inputSecret id = "password" value = "#{cc.attrs.passwordValue}" required="true" />
</h:panelGrid>
<h:commandButton
action = "#{cc.attrs.loginButtonAction}"
value = "#{cc.attrs.loginButtonLabel}"
style="padding: 10px"
/>
</h:form>
</composite:implementation>
</html>
Thanks for help!
edit.
I don't uderstand why i'm getting this error. During debugging i could not find out what's the problem. :(

Primefaces 5.2 dialog form not submitting

I am using primefaces 5.2 dialog framework to popup a dialog from my backing bean. That dialog with a simple login form.
main.xhtml as:
<h:form prependId="false">
......
<p:commandButton value="#{apps['application.sec.login']}" immediate="true" actionListener="#{loginControlBean.fireLoginDialog}" icon="fa fa-fw fa-sign-in" />
.....
</h:form>
backing bean LoginControlBean.java as:
#Named(value = "loginControlBean")
#SessionScoped
public class LoginControlBean implements Serializable{
private static final Logger logger =Logger.getLogger(LoginControlBean.class.getName());
#Inject
private StaffSession staffSession;
/* ... get/set pairs ...*/
......
public void fireLoginDialog() {
Map<String,Object> options = new HashMap<String, Object>();
options.put("modal", true);
options.put("draggable", false);
options.put("resizable", false);
RequestContext.getCurrentInstance().openDialog("/sec/login", options, null);
}
.......
public void login(ActionEvent event) {
logger.info("Passed in information: User name: "+staffSession.getTempUserName()+" Password: "+staffSession.getTempPassword());
.......
}
login.xhtml as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h:outputStylesheet library="css" name="default.css"/>
<h:outputStylesheet library="css" name="cssLayout.css"/>
<title>Staff Login</title>
</h:head>
<h:body>
<ui:composition>
<h:form id="loginform">
<p:growl id="logingrowl" sticky="true" showDetail="true" life="60000" />
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="username" value="#{apps['application.sec.username']}" />
<p:inputText id="username" value="#{staffSession.tempUserName}" required="true" label="username" />
<h:outputLabel for="password" value="#{apps['application.sec.password']}" />
<p:password id="password" value="#{staffSession.tempPassword}" required="true" label="password" />
<f:facet name="footer">
<p:commandButton process="#form" value="Login" update="logingrowl" actionListener="#{loginControlBean.login}"/>
</f:facet>
</h:panelGrid>
</h:form>
</ui:composition>
</h:body>
</html>
dialog popup properly and when I input user name and password, then hit login button. I got exception in my backend(server side) log as:
####<Nov 2, 2016 5:20:10 PM AEDT> <Info> <com.longz.ozssc.web.staff.LoginControlBean> <macmini16g.tweedheadstorage.com.au> <OzsscWEBServer> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <49d77419-9b42-461a-92bb-25b06f512a63-0000001d> <1478067610444> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <Passed in information: User name: null Password: null>
filled in fields in the form were bound to staffSession, but unfortunately, when I tried to access the values from backing bean staffSession, it is "null". Seems form submit is not working.
Any idea??
You didn't set the values of your input fields correctly.
value="#{staffSession.tempUserName}"
You need to add the bean to the values:
value="#{loginControllBean.staffSession.tempUserName}"

Spring threw load exception(java.lang.NoSuchMethodError:)

I am trying to run a simple jsp program in eclipse but when i run the program i get following errors.I am working with spring now and i have added all the jars properly in the right path.The jsp program is as follows
<%#taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>WELCOME TO EMPLOYEE ACCESS SITE.PLEASE ENTER THE FOLLOWING INFORMATION</h1>
<form:form method="POST" action="/Spring/mvc1/addStudent">
<table>
<tr>
<td><form:label path="name">Name</form:label></td>
<td><form:input path="name" /></td>
</tr>
<tr>
<td><form:label path="id">id</form:label></td>
<td><form:input path="id" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Submit"/>
</td>
</tr>
</table>
</form:form>
</body>
</html>
and when i run this above program i get the following set of error
SEVERE: Servlet /Spring threw load() exception
java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:454)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4364)
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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Mar 27, 2013 11:02:15 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 27, 2013 11:02:15 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 27, 2013 11:02:15 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/109 config=null
Mar 27, 2013 11:02:15 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2471 ms
Mar 27, 2013 11:02:23 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: No WebApplicationContext found: no
ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
at org.springframework.web.servlet.support.RequestContextUtils.getWebApplicationContext(RequestContextUtils.java:81)
at org.springframework.web.servlet.support.RequestContext.initContext(RequestContext.java:219)
at org.springframework.web.servlet.support.JspAwareRequestContext.initContext(JspAwareRequestContext.java:74)
at org.springframework.web.servlet.support.JspAwareRequestContext.<init>(JspAwareRequestContext.java:48)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:76)
at org.apache.jsp.mvc11.student_jsp._jspx_meth_form_005fform_005f0(student_jsp.java:104)
at org.apache.jsp.mvc11.student_jsp._jspService(student_jsp.java:73)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
I havent linked the jsp page to spring class yet.I just wanted to see the front end display.I am not sure where the problem is...
Your JSP page should be returned by Spring Controller. It would work if you had no spring form tags in JSP, but your form in JSP has tags which require name and id paths. They should be coming from a bean. So you need to pass that bean/POJO along with the JSP. Add bean in the Model object.
Code would be something like this :
Suppose page URL is : http://localhost:8484/yourappcontext/student
#Controller
public class StudentController {
#RequestMapping(value="/student", method = RequestMethod.GET)
public String showAddStudentPage(Model model) {
// instantiate empty student pojo containing name & id needed by JSP
Student student = new Student();
// add student pojo in model being sent with JSP
model.addSttribute("student", student);
return "addStudent"; // this would be your JSP name.
}
}

GWT: getting 404 in GWTTestCase when trying to make an Ajax call

I'm using GWT 2.4. I'm trying to write a test case where I make an Ajax call, but I'm getting a 404. Here is how I define the service in my .gwt.xml file ...
<module>
<!-- Inherit our applications main module. -->
<inherits name='com.myco.clearing.product.ProductPlus' />
<!-- Specify the path to any remote services. -->
<servlet path="/xmlhelperservice" class="com.myco.clearing.product.server.XmlHelperServiceImpl" />
</module>
Here is how the interface that the service implements ...
#RemoteServiceRelativePath( "xmlhelperservice" )
public interface XmlHelperService extends RemoteService {
Node getNode(final String fileName) throws IOException;
}
but in my test class (that extends GWTTestCase), I'm getting a 404 when trying to invoke the service ...
public void testDocument() throws Exception {
xmlHelperService = GWT.create(XmlHelperService.class);
xmlHelperService.getNode("doc.xml", new AsyncCallback<Node>() {
#Override
public void onSuccess(Node node) {
...
}
#Override
public void onFailure(Throwable caught) {
caught.printStackTrace(System.err);
fail(caught.getMessage());
}
});
}
What is the right way to define/invoke my service to avoid the 404? Stack trace below. Thanks, - Dave
[WARN] 404 - POST /com.myco.clearing.product.ProductPlusJUnit.JUnit/xmlhelperservice (10.40.70.197) 1450 bytes
com.google.gwt.user.client.rpc.StatusCodeException: 404 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body><h2>HTTP ERROR: 404</h2><pre>NOT_FOUND</pre>
<p>RequestURI=/com.myco.clearing.product.ProductPlusJUnit.JUnit/xmlhelperservice</p><p><i><small>Powered by Jetty://</small></i></p><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</body>
</html>
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:220)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:662)
See if you have overlooked this in your web.xml file.
<servlet>
<servlet-name>XmlHelperServiceImpl</servlet-name>
<servlet-class>com.myco.clearing.product.server.XmlHelperServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XmlHelperServiceImpl</servlet-name>
<url-pattern>/com.myco.clearing.product.ProductPlus/xmlhelperservice</url-pattern>
</servlet-mapping>
Also see common pitfalls in this documentation.

problem hibernate in web service

before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
http://www.youtube.com/watch?v=o2Vjs8ylmFM
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:
An error occurred at line: 1 in the generated java file
The type net.sf.hibernate.Session cannot be resolved. It is indirectly referenced from required .class files
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
Session cannot be resolved to a type
13: <BODY>
14: <%
15:
16: Session hibernateSession = HibernateUtil.currentSession();
17: Transaction tx = hibernateSession.beginTransaction();
18:
19: Etudinat etudiant = new Etudinat();
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
and my class hibernateUtil is :
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
and my hibernate.cfg.xml page is:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
and this is my page jsp
<%#page import="DBase.HibernateUtil"%>
<%# page import="java.io.*" %>
<%# page import="java.util.*" %>
<%# page import="DBase.*" %>
<%# page import="net.sf.hibernate.*" %>
<%# page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("david#live.fr");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
plz help us we are running on time i have 3 left to finish it
The file you label your jsp page is not a jsp page but a hibernate configuration file.
The problem is most likely in your classpath though. The hibernate libraries are not on the classpath used to compile the java code generated from your jsp.