1 Reply Latest reply on Apr 19, 2013 5:53 AM by Jose Miguel Barone

    database configration for jboss errai project

    Brijesh Gupta Newbie

      Hello,

      I am brijesh new to forum.This is my first project in jboss errai.

      I want to add database to my application but getting problem.

      I have added these dependency in maven

       

       


      <plugin>

      <groupId>org.apache.maven.plugins</groupId>

      <artifactId>maven-surefire-plugin</artifactId>

      <version>3.0.5</version>

      <configuration>

      <systemPropertyVariables>

      <!-- Using HSQLDB as test database system -->

      <database.driverClass>com.mysql.jdbc.Driver</database.driverClass>

      <database.url>jdbc:mysql://localhost:3306/ErraiJpaDemo</database.url>

      <database.username>root</database.username>

      <database.password>admin</database.password>

      <hibernate.dialect>org.hibernate.dialect.MySQL5Dialect</hibernate.dialect>

      <!-- :~) -->

      </systemPropertyVariables>

      </configuration>

      </plugin>

      ...............................................................................................................

      <dependency>

          <groupId>org.hibernate</groupId>

          <artifactId>hibernate-core</artifactId>

          <version>4.1.1.Final</version>

          <type>pom</type>

      </dependency>

      <dependency>

              <groupId>org.hibernate</groupId>

              <artifactId>hibernate-entitymanager</artifactId>

              <version>4.1.1.Final</version>

          </dependency>

          <dependency>

          <groupId>mysql</groupId>

          <artifactId>mysql-connector-java</artifactId>

          <version>5.1.2</version>

      </dependency>

           <dependency>

            <groupId>org.hibernate.javax.persistence</groupId>

            <artifactId>hibernate-jpa-2.0-api</artifactId>

            <version>1.0.1.Final</version>

            <scope>provided</scope>

          </dependency>

          <dependency>

          <groupId>org.hibernate</groupId>

          <artifactId>hibernate-validator</artifactId>

          <version>4.1.0.Final</version>

      </dependency>

        <dependency>

          <groupId>org.hibernate</groupId>

          <artifactId>hibernate-jpamodelgen</artifactId>

          <version>1.2.0.Final</version>

      </dependency>

      ..............................................................................................................................

       

      This is my Resource Class

       

       

       

      package main.util;

       

      import java.util.logging.Logger;

       

      import javax.enterprise.inject.Produces;

      import javax.enterprise.inject.spi.InjectionPoint;

      import javax.persistence.EntityManager;

      import javax.persistence.EntityManagerFactory;

      import javax.persistence.Persistence;

      import javax.persistence.PersistenceContext;

       

      import org.jboss.weld.bootstrap.api.ServiceRegistry;

      import org.mortbay.jetty.plus.webapp.Configuration;

       

      /**

      * This class uses CDI to alias Java EE resources, such as the persistence context, to CDI beans

      *

      * <p>

      * Example injection on a managed bean field:

      * </p>

      *

      * <pre>

      * &#064;Inject

      * private EntityManager em;

      * </pre>

      */

       

      public class Resources {

         // use @SuppressWarnings to tell IDE to ignore warnings about field not being referenced directly

       

         @Produces

         @PersistenceContext

         private EntityManager em;

       

          EntityManagerFactory entityManagerFactory ;

          //private static SessionFactory sessionFactory;

       

       

       

         public EntityManager getConnection() {

       

              if (em == null) {

       

       

          entityManagerFactory = Persistence.createEntityManagerFactory("ErraiJpaDemo",System.getProperties());

                  em = entityManagerFactory.createEntityManager();

       

       

                  /*em = entityManagerFactory.createEntityManager();

                  em = getJpaTemplate().getEntityManagerFactory()

                          .createEntityManager();*/

              }

              return em;

       

          }

       

         public EntityManager getEm() {

          return em;

      }

       

      public void setEm(EntityManager em) {

          this.em = em;

      }

       

      public EntityManagerFactory getEntityManagerFactory() {

          return entityManagerFactory;

      }

       

      public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {

          this.entityManagerFactory = entityManagerFactory;

      }

       

      @Produces

         public Logger produceLog(InjectionPoint injectionPoint) {

            return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());

         }

      }

      .............................................................................................................

       

      My service class where I am calling entityManager is

       

      package main.server;

       

      import java.util.Date;

       

      import javax.enterprise.context.ApplicationScoped;

      import javax.enterprise.event.Event;

      import javax.enterprise.event.Observes;

      import javax.inject.Inject;

      import javax.persistence.EntityManager;

      import javax.transaction.UserTransaction;

       

      import main.client.shared.HelloMessage;

      import main.client.shared.Response;

       

      import org.jboss.errai.bus.server.annotations.Service;

       

      /**

      * A very simple CDI based service.

      */

      @ApplicationScoped

      @Service

      public class SimpleCDIService  implements HelloWorldService{

        @Inject

        private Event<Response> responseEvent;

        @Inject

        EntityManager em;

       

        public void handleMessage(@Observes HelloMessage event) {

          System.out.println("Received HelloMessage from Client: " + event.getMessage());

         em.getTransaction().begin();

         em.persist(event);

         em.getTransaction().commit();

       

       

       

          // Note that because Response is declared @Conversational, this message

          // only goes to the client who sent the HelloEvent.

          responseEvent.fire(new Response(event.getMessage() + new Date()));

        }

      }

       

      ..............................................................................................

      My model class

       

      package main.client.shared;

       

      import javax.persistence.Entity;

      import javax.persistence.GeneratedValue;

      import javax.persistence.Id;

       

      import org.jboss.errai.common.client.api.annotations.Portable;

       

      /**

      * A marshallable bean that's used as the event object when sending

      * user-entered text from the client to the server.

      *

      * @author Jonathan Fuerth <jfuerth@gmail.com>

      */

      @Portable

      @Entity

      public class HelloMessage {

          @Id

          @GeneratedValue

          private int id;

          private String message;

       

          public HelloMessage() {

          }

       

          public HelloMessage(String message) {

              this.message = message;

          }

       

          public int getId() {

              return id;

          }

       

          public void setId(int id) {

              this.id = id;

          }

       

          public String getMessage() {

              return message;

          }

       

          public void setMessage(String message) {

              this.message = message;

          }

      }

       

      .................................................................................................................

      But when run mvn package I get this

       

       

      [INFO] INFO [JaxrsProxyLoaderGenerator] generating jax-rs proxy loader class.

      [INFO] INFO [Version] HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

      [INFO] INFO [Version] HHH000412: Hibernate Core {4.1.1}

      [INFO] INFO [Environment] HHH000206: hibernate.properties not found

      [INFO] INFO [Environment] HHH000021: Bytecode provider name : javassist

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

      [INFO] INFO [Ejb3Configuration] HHH000204: Processing PersistenceUnitInfo [

      [INFO]  name: ErraiClientPersistenceUnit

      [INFO]  ...]

      [INFO] WARN [ConnectionProviderInitiator] HHH000181: No appropriate connection

      rovider encountered, assuming application will be supplying connections

      [INFO] INFO [Dialect] HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

      [INFO] WARN [H2Dialect] HHH000431: Unable to determine H2 database version, cer

      ain features may not work

      [INFO] INFO [LobCreatorBuilder] HHH000422: Disabling contextual LOB creation as

      connection was null

      [INFO] INFO [TransactionFactoryInitiator] HHH000268: Transaction strategy: org.

      ibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

      [INFO] INFO [ASTQueryTranslatorFactory] HHH000397: Using ASTQueryTranslatorFact

      ry

       

       

      ................................................................................................................................................

       

      and when run mvn gwt:run   Ui comes and when I fill and invoke client I get this error at my service class in server

      ...................................................................................................................................................................

       

      Error calling remote service: cdi.event:Dispatcher -- Additional Details:

      java.lang.RuntimeException: Failed to dispatch CDI Event

          at org.jboss.errai.cdi.server.events.EventDispatcher.callback(EventDispatcher.java:186)

          at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)

          at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)

          at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)

          at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.Server.handle(Server.java:326)

          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)

          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)

          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)

          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      Caused by: java.lang.NullPointerException:

          at main.server.SimpleCDIService.handleMessage(SimpleCDIService.java:30)

          at main.server.SimpleCDIService$Proxy$_$$_WeldClientProxy.handleMessage(SimpleCDIService$Proxy$_$$_WeldClientProxy.java)

          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.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)

          at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

          at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

          at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

          at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:573)

          at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:563)

          at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:558)

          at org.jboss.errai.cdi.server.events.EventDispatcher.callback(EventDispatcher.java:164)

          at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)

          at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)

          at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)

          at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.Server.handle(Server.java:326)

          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)

          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)

          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)

          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

       

       

      Additional Details:

      Error calling remote service: cdi.event:Dispatcher -- Additional Details:

      java.lang.RuntimeException: Failed to dispatch CDI Event

          at org.jboss.errai.cdi.server.events.EventDispatcher.callback(EventDispatcher.java:186)

          at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)

          at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)

          at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)

          at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.Server.handle(Server.java:326)

          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)

          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)

          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)

          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      Caused by: java.lang.NullPointerException:

          at main.server.SimpleCDIService.handleMessage(SimpleCDIService.java:30)

          at main.server.SimpleCDIService$Proxy$_$$_WeldClientProxy.handleMessage(SimpleCDIService$Proxy$_$$_WeldClientProxy.java)

          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.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)

          at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

          at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

          at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

          at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:573)

          at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:563)

          at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:558)

          at org.jboss.errai.cdi.server.events.EventDispatcher.callback(EventDispatcher.java:164)

          at org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)

          at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:632)

          at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:93)

          at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:107)

          at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:117)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)

          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

          at org.mortbay.jetty.Server.handle(Server.java:326)

          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)

          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)

          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)

          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      ...........................................................................................................

      When I remove

       

         em.getTransaction().begin();

         em.persist(event);

         em.getTransaction().commit();

       

      from my service,Its run and return message to client.

       

       

       

      Plz suggest solution,This is my first application using jboss errai,Thanks in advance

        • 1. Re: database configration for jboss errai project
          Jose Miguel Barone Newbie

          I think the NullPointer is because the pm it's not injected ... and to do that you need to specify the provider and other things in the persistence.xml file.

          Something like that:

           

          <persistence>

             <persistence-unit name="myapp" transaction-type="RESOURCE_LOCAL"> // you can use LOCAL or JTA with a datasource in the app server, in the example you're using LOCAL

                <provider>org.hibernate.ejb.HibernatePersistence</provider>

                <properties>

                   ... ...

                </properties>

             </persistence-unit>

          </persistence>

           

          in the WEB-INF folder of your server classes.

           

          In your example i only see the setting of properties, not the persistence.xml.

          My little cent

          Regards.