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

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.

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. :(

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.
}
}

Why can't get a GWT UI Binder template to use a ClientBundle from my project

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field='res' type='com.myproject.resources.Resources'/>
<ui:style>
.panel {
background-color: ivory;
}
</ui:style>
<g:FlowPanel styleName='{style.panel}'>
<g:Image url='{res.logo}'/>
<g:VerticalPanel>
<g:PushButton text="My Button" ui:field="myButton"></g:PushButton>
</g:VerticalPanel>
</g:FlowPanel>
</ui:UiBinder>
I have a resources class
public interface Resources extends ClientBundle {
public static final Resources INSTANCE = GWT.create(Resources.class);
#Source("logo.png")
ImageResource logo();
}
I don't get any errors in the GWT XML editor, however, GWT designer will not load. An When I run it I get an Exception also.
onModuleLoad() threw an exception
Exception while loading module com.myproject.client.MyProject. See Development Mode for details.
java.lang.reflect.InvocationTargetException
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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.myproject.client.ClientFactory' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.myproject.client.MyProject.onModuleLoad(MyProject.java:42)
... 9 more
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:503)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
... 11 more
Hard to tell if it's you issue or not, but your code should be:
<g:Image resource='{res.logo}'/>
(i.e. resource, not url)
Make sure you have this inherits tag in your gwt.xml file, it is required when using ClientBundle:
<inherits name="com.google.gwt.resources.Resources" />

hibernate class not found exception

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.

GWT 2.2 RootPanel CSS error

Hey guys, I'm just starting out with GWT and am getting the following error when I run the project in Eclipse
19:36:16.084 [ERROR] [adaptivgwt]
Warning:
com.google.gwt.user.client.ui.RootPanel
descendants will be incorrectly
positioned, i.e. not relative to their
parent element, when
'position:static', which is the CSS
default, is in effect. One possible
fix is to call
'panel.getElement().getStyle().setPosition(Position.RELATIVE)'.
java.lang.IllegalStateException:
com.google.gwt.user.client.ui.RootPanel
is missing CSS
'position:{relative,absolute,fixed}'
at com.google.gwt.user.client.ui.AbsolutePanel.verifyPositionNotStatic(AbsolutePanel.java:279)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:118)
at com.ivstel.adaptiv.client.AdaptivGWT.loadLogin(AdaptivGWT.java:29)
at com.ivstel.adaptiv.client.AdaptivGWT.onModuleLoad(AdaptivGWT.java:21)
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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Unknown Source)
This is what my entry point looks like:
public class AdaptivGWT implements EntryPoint {
private static AdaptivGWT singleton;
public static AdaptivGWT get() {
return singleton;
}
public void onModuleLoad() {
singleton = this;
loadLogin();
}
public void loadLogin() {
RootPanel.get("login").clear();
RootPanel.get("main").clear();
LoginGWT login = new LoginGWT();
RootPanel.get("login").add(login, 10, 10);
}
public void loadMain(User user) {
RootPanel.get("login").clear();
MainGWT main = new MainGWT();
RootPanel.get("main").add(main, 10, 10);
}
}
The HTML file.
<!doctype html>
<!-- The DOCTYPE declaration above will set the -->
<!-- browser's rendering engine into -->
<!-- "Standards Mode". Replacing this declaration -->
<!-- with a "Quirks Mode" doctype may lead to some -->
<!-- differences in layout. -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="AdaptivGWT.css">
<title>Adaptiv</title>
<script type="text/javascript" language="javascript" src="adaptivgwt/adaptivgwt.nocache.js"></script>
</head>
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
<div id="login"></div>
<div id="main"></div>
</body>
</html>
Using the position arguments (i.e. 10, 10) with the add method requires the elements you want to add the GWT widgets to as child element, also be positioned elements (i.e. they must have a property: position:). In your case the div's (both with id main and login) have no position. Better use add(main) instead. If you want to position your element 10 pixels to left/top use css margin or padding (depending on your use case).
On a side note, it's not necessary to have both a 'login' and 'main' div's, you could simply use one div, or directly add it to the body, i.e. use get(). That way you have the full control in GWT, instead having part of the structure in the html file.