1 Reply Latest reply on Jun 1, 2009 5:07 PM by Pete Muir

    Error during deployment. Cannot resolve beans?

    John Ament Master

      I get the following stack while trying to deploy my app.



      09:55:59,524 ERROR [AbstractKernelController] Error installing to Start: name=vfszip:/opt/jboss/jboss-5.1.0.GA/server/default/deploy/imageserver.war/_WebBeansBootstrapBean state=Create
      javax.inject.UnsatisfiedDependencyException: The injection point   Field @Current imageDAO on Annotated class Class @RequestScoped @Named FileUploadListener
        Constructor public FileUploadListener();
        Method List public getMessages();
        Method void public setMessages(List);
        Method boolean public isOverride();
        Method void public setOverride(boolean);
        Method void public onUpload(UploadEvent);
        Method void public final native wait(long);
        Method void public final wait(long, int);
        Method void public final wait();
        Method int public native hashCode();
        Method Class public final native getClass();
        Method boolean public equals(Object);
        Method String public toString();
        Method void public final native notify();
        Method void public final native notifyAll();
       with binding types [@Current] in Request scoped simple bean 'uploader' com.coat.web.images.server.web.FileUploadListener,  API types = [FileUploadListener, Object], binding types = [@Current] has unsatisfied dependencies with binding types 
           at org.jboss.webbeans.BeanValidator.validate(BeanValidator.java:112)
           at org.jboss.webbeans.bootstrap.WebBeansBootstrap.boot(WebBeansBootstrap.java:207)
           at org.jboss.webbeans.bootstrap.api.helpers.BootstrapBean.boot(BootstrapBean.java:120)
           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:150)
           at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
           at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
           at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
           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:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
           at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
           at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
           at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
           at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
           at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
           at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
           at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
           at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
           at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
           at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
           at org.jboss.Main.boot(Main.java:221)
           at org.jboss.Main$1.run(Main.java:556)
           at java.lang.Thread.run(Thread.java:619)
      



      My DAO is defined like:




      @Named("imageDAO") @RequestScoped
      public class ImageDAO extends BasicDAO<Image>{
           @Current LoginBean login;
           @Override
           public void preSave(Image entity) {
                // TODO Auto-generated method stub
                entity.setCreateBy(login.getName());
                entity.setCreateProc("ImageDAO.save");
                entity.setCreateDate(new java.util.Date());
           }
           public List<Image> findByPath(String path){
                Query q = entityManager.createQuery("select i from Image i where i.fileName = :fileName")
                     .setParameter("fileName", path);
                return q.getResultList();
           }
           public List<Image> findBySku(String sku){
                Query q = entityManager.createQuery("select i from Image i where i.skuAssociated = :sku")
                     .setParameter("sku", sku);
                return q.getResultList();
           }
           public List<Image> findActiveImageByName(String name) {
                Query q = entityManager.createQuery("select i from Image i where i.fileName = :fileName and i.active = :active")
                     .setParameter("active", true).setParameter("fileName",name);
                return q.getResultList();
           }
           public boolean exists(String name) {
                List<Image> results = findByPath(name);
                if(results.size() == 0) return false;
                return true;
           }
      }



      Which depends on LoginBean (it's a simplified SSO solution)




      @Named("login") @SessionScoped
      public class LoginBean implements java.io.Serializable{
           private String name;
           public String getName() {
                if(name == null)
                     doLogin();
                
                return name;
           }
           public void setName(String name) {
                this.name = name;
           }
           public void doLogin(){
                FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest req = (HttpServletRequest)ctx.getExternalContext().getRequest();
                name = req.getParameter("name");
                if(name == null ||name.equals("")) {
                     throw new RuntimeException("Illegal access, no login name supplied.");
                }
           }
      }



      And the upload listener, which appears to be in error:



      @Named("uploader") @RequestScoped
      public class FileUploadListener {
           @Current ImageDAO imageDAO;



      Obviously much is stripped out because it's quite long.


      Everything was working fine until I added in the DAO.  It extends a BasicDAO which has the entity manager in it.  Is it failing to be created because of the inheritance?