<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Últimas mensagens do tópico "Web Service: RESTEasy + Hibernate"]]></title>
		<link>http://www.portaljava.com/forum/posts/list/34.page</link>
		<description><![CDATA[Últimas mensagens enviadas no tópico "Web Service: RESTEasy + Hibernate"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Web Service: RESTEasy + Hibernate</title>
				<description><![CDATA[ Olá pessoal, <br /> <br /> estou com um problema no meu serviço que usa RESTEasy + Hibernate.<br /> Consigo utilizar meus serviços mais simples normalmente, mas quando faço chamadas a métodos que fazem persistência, recebo um erro no Tomcat.<br /> <br /> Segue um trecho do código do serviço: <br /> [code]@ProduceMime("text/plain")<br /> @Path("/myrest/")<br /> public class PersonREST{<br /> <br /> 	@GET<br /> 	@Path("/status/")<br /> 	public String status() {<br /> 		return "OK!";<br /> 	}<br />         <br />     @GET<br /> 	@Path("/hello/{name}")<br /> 	public String helloMr(@PathParam("name")String name) {<br /> 		return "Hello Mr. " + name;<br /> 	}<br /> <br />     /**<br /> 	 * FIXME: Don't work!<br /> 	*/<br /> 	@GET<br /> 	@Path("/persons/{id}")<br /> 	public Person findPerson(@PathParam("id")Long id) {<br /> 		PersonService personService = new PersonServiceImpl(); <br /> <br /> 		return personService.procura(id);<br /> 	}<br /> <br /> [/code]<br /> Quando eu faço a chamadas..<br /> [code]http://localhost:8080/resteasy/myrest/status[/code]<br /> [code]http://localhost:8080/resteasy/myrest/hello/Sergio[/code]<br /> ... recebo as respostas: <br /> [quote]OK!![/quote]<br /> [quote]Hello Mr. Sergio[/quote]<br /> <br /> Mas quando chamo... <br /> [code]http://localhost:8080/resteasy/myrest/persons/3[/code]<br /> ... recebo o erro: <br /> <br /> [quote]INFO: Starting Coyote HTTP/1.1 on http-8080<br /> 03/10/2008 12:29:43 org.apache.jk.common.ChannelSocket init<br /> INFO: JK: ajp13 listening on /0.0.0.0:8009<br /> 03/10/2008 12:29:44 org.apache.jk.server.JkMain start<br /> INFO: Jk running ID=0 time=0/77  config=null<br /> 03/10/2008 12:29:44 org.apache.catalina.startup.Catalina start<br /> INFO: Server startup in 9504 ms<br /> log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).<br /> log4j:WARN Please initialize the log4j system properly.<br /> java.lang.RuntimeException: Failed processing public com.restful.resteasy.bo.Person com.restful.resteasy.restservice.PersonREST.findPerson(java.lang.Long)<br />     at org.resteasy.MethodInjectorImpl.invoke(MethodInjectorImpl.java:109)<br />     at org.resteasy.ResourceMethod.invoke(ResourceMethod.java:162)<br />     at org.resteasy.ResourceMethod.invoke(ResourceMethod.java:134)<br />     at org.resteasy.Dispatcher.invoke(Dispatcher.java:161)<br />     at org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:138)<br />     at org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:77)<br />     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)<br />     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br />     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)<br />     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br />     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)<br />     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br />     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br />     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)<br />     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)<br />     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)<br />     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)<br />     at java.lang.Thread.run(Thread.java:619)<br /> Caused by: java.lang.ExceptionInInitializerError<br />     at com.restful.resteasy.dao.DaoFactory.&lt;init&gt;(DaoFactory.java:13)<br />     at com.restful.resteasy.service.PersonServiceImpl.&lt;init&gt;(PersonServiceImpl.java:14)<br />     at com.restful.resteasy.restservice.PersonREST.findPerson(PersonREST.java:47)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />     at java.lang.reflect.Method.invoke(Method.java:597)<br />     at org.resteasy.MethodInjectorImpl.invoke(MethodInjectorImpl.java:72)<br />     ... 18 more<br /> Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set<br />     at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:80)<br />     at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:62)<br />     at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:460)<br />     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:155)<br />     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)<br />     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)<br />     at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)<br />     at com.restful.resteasy.dao.HibernateSessionFactory.&lt;clinit&gt;(HibernateSessionFactory.java:17)<br />     ... 26 more[/quote]<br /> <br /> A camada de persistência funciona perfeitamente sem o uso de REST. <br /> <br /> Alguém pode ajudar?<br /> <br /> Agradeço antecipadamente!]]></description>
				<guid isPermaLink="true">http://www.portaljava.com/forum/posts/preList/45103/165849.page</guid>
				<link>http://www.portaljava.com/forum/posts/preList/45103/165849.page</link>
				<pubDate><![CDATA[Fri, 3 Oct 2008 14:58:03]]> GMT</pubDate>
				<author><![CDATA[ serjaumfantin]]></author>
			</item>
			<item>
				<title>Re:Web Service: RESTEasy + Hibernate</title>
				<description><![CDATA[ O problema tá na sua compreensão do conceito de REST.<br /> <br /> Tenha sempre,eu disse "SEMPRE", em mente que REST é HTTP puro e simples.<br /> <br /> Tendo dito isso, como você espera retornar um objeto Person no método 'findPerson'? Como você espera mapear o objeto Person no protocolo HTTP?<br /> <br /> Retorne esse objeto em outro formato: XML, JSON, InputStream, etc.]]></description>
				<guid isPermaLink="true">http://www.portaljava.com/forum/posts/preList/45103/165851.page</guid>
				<link>http://www.portaljava.com/forum/posts/preList/45103/165851.page</link>
				<pubDate><![CDATA[Fri, 3 Oct 2008 17:37:34]]> GMT</pubDate>
				<author><![CDATA[ RafaelJ]]></author>
			</item>
			<item>
				<title>Re:Web Service: RESTEasy + Hibernate</title>
				<description><![CDATA[ Tomei como base este código, não atentando para este detalhe: <br /> <br /> [code]@Path("/")<br /> public class ShoppingStore {<br /> <br />    @Path("/customers/{id}")<br />    public Customer getCustomer(@PathParam("id") int id) {<br />       Customer cust = ...; // Find a customer object<br />       return cust;<br />    }<br /> }[/code]Fonte: http://wiki.jboss.org/wiki/JAXRSResourceLocators]]></description>
				<guid isPermaLink="true">http://www.portaljava.com/forum/posts/preList/45103/165852.page</guid>
				<link>http://www.portaljava.com/forum/posts/preList/45103/165852.page</link>
				<pubDate><![CDATA[Fri, 3 Oct 2008 19:56:09]]> GMT</pubDate>
				<author><![CDATA[ serjaumfantin]]></author>
			</item>
			<item>
				<title>Re:Web Service: RESTEasy + Hibernate</title>
				<description><![CDATA[ Só para esclarecer, a forma de retornar um objeto via serviço REST varia de framework para framework, pois não é definido isso na especificação da JSR 311.<br /> <br /> Eu particularmente sempre evito fazer isso, dando preferência a retornar XML, JSON, InputStream, etc.<br /> <br /> Rafael Nunes]]></description>
				<guid isPermaLink="true">http://www.portaljava.com/forum/posts/preList/45103/165963.page</guid>
				<link>http://www.portaljava.com/forum/posts/preList/45103/165963.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 13:41:38]]> GMT</pubDate>
				<author><![CDATA[ RafaelJ]]></author>
			</item>
			<item>
				<title>Re:Web Service: RESTEasy + Hibernate</title>
				<description><![CDATA[ Tu já testou a tua persistencia diretamente? Um teste unitário?<br /> <br /> Olha a msg de erro na tua exception<br /> <br /> [code]<br /> Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set <br /> [/code]<br /> <br /> Ou seja, não está configurado o dialeto do banco  :wink: ]]></description>
				<guid isPermaLink="true">http://www.portaljava.com/forum/posts/preList/45103/165965.page</guid>
				<link>http://www.portaljava.com/forum/posts/preList/45103/165965.page</link>
				<pubDate><![CDATA[Mon, 20 Oct 2008 14:53:22]]> GMT</pubDate>
				<author><![CDATA[ fabiofalci]]></author>
			</item>
	</channel>
</rss>