1 Reply Latest reply on Feb 25, 2005 6:18 PM by Jim Crume

    NullPointerException Deploying App with One To Many Reltions

    Jim Crume Newbie

      I am using JBoss 4.0.1 and EJB 3.0 preview 3.

      I have developed a simple app that has a container managed one to many relationship. When I try to deploy it, I get a NullPointerException. Following are snippets from my two classes:

      In Analyst:
      <snipped code>
      private Collection stocks;
      <snipped code>
      @OneToMany(mappedBy="analyst")
      public Collection getStocks()
      {
      return stocks;
      }

      public void setStocks(Collection stocks)
      {
      this.stocks = stocks;
      }

      In Stock:
      <snipped code>
      private Analyst analyst;
      <snipped code>
      @ManyToOne(targetEntity="beans.Analyst")
      public Analyst getAnalyst() {
      return analyst;
      }

      public void setAnalyst(Analyst analyst) {
      this.analyst = analyst;
      }

      Here is the stack trace:
      19:42:01,209 ERROR [Ejb3Module] Starting failed jboss.j2ee:service=EJB3,module=S
      tockListCmrApp.ejb3
      java.lang.NullPointerException
      at org.jboss.ejb3.entity.EntityToHibernateXml.mapManyToOne(EntityToHiber
      nateXml.java:979)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleManyToOne(EntityToHi
      bernateXml.java:956)
      at org.jboss.ejb3.entity.EntityToHibernateXml.processProperty(EntityToHi
      bernateXml.java:505)
      at org.jboss.ejb3.entity.EntityToHibernateXml.iterateProperties(EntityTo
      HibernateXml.java:251)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleBasicClass(EntityToH
      ibernateXml.java:1846)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleClass(EntityToHibern
      ateXml.java:1457)
      at org.jboss.ejb3.entity.EntityToHibernateXml.convert(EntityToHibernateX
      ml.java:161)
      at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(Hi
      bernateSessionFactory.java:144)
      at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.ja
      va:213)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:225)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:272)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:222)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:891)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:416)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy16.start(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:166)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
      at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:122)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy8.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:305)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:481)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:204)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      loop(AbstractDeploymentScanner.java:215)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      run(AbstractDeploymentScanner.java:194)
      19:42:01,219 WARN [ServiceController] Problem starting service jboss.j2ee:servi
      ce=EJB3,module=StockListCmrApp.ejb3
      java.lang.NullPointerException
      at org.jboss.ejb3.entity.EntityToHibernateXml.mapManyToOne(EntityToHiber
      nateXml.java:979)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleManyToOne(EntityToHi
      bernateXml.java:956)
      at org.jboss.ejb3.entity.EntityToHibernateXml.processProperty(EntityToHi
      bernateXml.java:505)
      at org.jboss.ejb3.entity.EntityToHibernateXml.iterateProperties(EntityTo
      HibernateXml.java:251)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleBasicClass(EntityToH
      ibernateXml.java:1846)
      at org.jboss.ejb3.entity.EntityToHibernateXml.handleClass(EntityToHibern
      ateXml.java:1457)
      at org.jboss.ejb3.entity.EntityToHibernateXml.convert(EntityToHibernateX
      ml.java:161)
      at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(Hi
      bernateSessionFactory.java:144)
      at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.ja
      va:213)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:225)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
      upport.java:272)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
      eanSupport.java:222)
      at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
      ler.java:891)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:416)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy16.start(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:166)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
      at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.java:144)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
      or.java:122)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
      BeanOperationInterceptor.java:131)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
      java:249)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy8.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
      tScanner.java:305)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
      canner.java:481)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      doScan(AbstractDeploymentScanner.java:204)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      loop(AbstractDeploymentScanner.java:215)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
      run(AbstractDeploymentScanner.java:194)