Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-2023

Weld's @Inject cannot be used in a no-interface session bean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • EJB3_1 1.0.5
    • EJB3_1 1.0.4
    • nointerface
    • None

      The session bean:

      @Stateless
      public class Kundenverwaltung {
      @PersistenceContext
      private EntityManager em;

      @Inject
      private KundenverwaltungDao dao;
      ...
      }

      The CDI bean:
      @Named
      public class KundenverwaltungDao {
      @PersistenceContext(unitName="hskaPersistence")
      private EntityManager em;
      ...
      }

      The deployment results in a NPE:
      10:11:39,203 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/_WeldBootstrapBean state=Create: java.lang.NullPointerException
      at org.jboss.ejb3.nointerface.impl.view.factory.JavassistNoInterfaceViewFactory$NoInterfaceViewProxyFactoryClassLoaderProvider.get(JavassistNoInterfaceViewFactory.java:114)
      at javassist.util.proxy.ProxyFactory.getClassLoader(ProxyFactory.java:426)
      at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:270)
      at org.jboss.weld.util.Proxies.createProxyClass(Proxies.java:187)
      at org.jboss.weld.util.Proxies.createProxy(Proxies.java:154)
      at org.jboss.weld.bean.builtin.ee.AbstractEEBean.<init>(AbstractEEBean.java:53)
      at org.jboss.weld.bean.builtin.ee.UserTransactionBean.<init>(UserTransactionBean.java:66)
      at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:140)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377)
      at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.boot(BootstrapBean.java:121)
      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.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
      at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:151)
      at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
      at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257)
      at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
      at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
      at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
      at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202)
      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:378)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2029)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1050)
      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1289)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1213)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1107)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:918)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:633)
      at org.jboss.system.ServiceController.doChange(ServiceController.java:671)
      at org.jboss.system.ServiceController.start(ServiceController.java:443)
      at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:189)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:102)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:49)
      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1660)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1378)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1399)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1431)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1319)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:378)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2029)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1050)
      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1289)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1213)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1107)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:918)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:633)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:898)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:677)
      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)

              jaikiran Jaikiran Pai (Inactive)
              juergen.zimmermann Juergen Zimmermann (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: