3 Replies Latest reply on Jun 22, 2009 11:55 PM by Konstantin Pupkov

    Stateful bean fail to deploy - JBoss 5.1.0.GA

    Konstantin Pupkov Newbie

      JBoss samples can be deployed without error. However my classes failed to load.

      package connection.bean;
      
      import java.util.Collection;
      import java.util.HashMap;
      
      public interface DocumentFacade {
      
       Collection getProjectNameByLogin(String login);
      
       String getRM(String projectName);
      
       HashMap getCreatives(String login);
      
       byte[] getArchiveByProjectName(String projectName);
      }
      

      Implementation:
      package connection.bean;
      
      import java.io.ByteArrayOutputStream;
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.Arrays;
      import java.util.Collection;
      import java.util.Collections;
      import java.util.HashMap;
      import java.util.HashSet;
      import java.util.Iterator;
      import java.util.List;
      
      import javax.ejb.Stateful;
      import javax.ejb.Remote;
      import javax.ejb.Remove;
      import javax.persistence.PersistenceContext;
      
      @Stateful
      @Remote(DocumentFacade.class)
      public class DocumentFacadeBean implements DocumentFacade,Serializable {
       @PersistenceContext
       private UserFacade user = null;
      
       public Collection getProjectNameByLogin(String login) {
       List list = new ArrayList();
       // FIXME homeProject
       Collection col = null;// homeProject.getByLogin(login);
       Iterator itr = col.iterator();
       while (itr.hasNext()) {
       String name = (String) itr.next();
       list.add(name);
       }
       return list;
       }
      
      
       public String getRM(String projectName) {
       FileInputStream fis = null;
       try {
       fis = new FileInputStream("rm" + projectName.toUpperCase() + ".xml");
       } catch (FileNotFoundException ex) {
       return "";
       }
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       byte b[] = new byte[1024];
       int r = -1;
       try {
       if (fis != null) {
       while ((r = fis.read(b)) != -1) {
       baos.write(b, 0, r);
       }
       }
       fis.close();
       return baos.toString();
       } catch (Exception e) {
       return "";
       }
       }
      
      
       public java.util.HashMap<String, byte[]> getCreatives(String login) {
       HashMap<String, byte[]> map = new HashMap<String, byte[]>();
       Collection col = null;// homeProject.getByLogin(login);
       Iterator itr = col.iterator();
       while (itr.hasNext()) {
       String name = (String) itr.next();
       byte[] b = null;//getArchiveByLogin(login, name);
       map.put(name, b);
       }
       return map;
       }
      
      
       public byte[] getArchiveByProjectName(String projectName) {
       return null;
       }
      
      }
      


      error:
      2009-06-21 10:17:27,548 DEBUG [org.jboss.ejb3.session.ProxyDeployer] (main) default remote binding has jndiName of DocumentFacadeBean/remote
      2009-06-21 10:17:27,549 DEBUG [org.jboss.ejb3.Ejb3Registry] (main) Unregistered container jboss.j2ee:jar=dfserver.jar,name=DocumentFacadeBean,service=EJB3,VMID=583c10bfdbd326ba:da2fe9b:12203d1cd17:-7ff9
      2009-06-21 10:17:27,549 DEBUG [org.jboss.ejb3.Ejb3Registry] (main) Unregistered container jboss.j2ee:jar=dfserver.jar,name=UserFacadeBean,service=EJB3,VMID=583c10bfdbd326ba:da2fe9b:12203d1cd17:-7ff9
      2009-06-21 10:17:27,549 DEBUG [org.jboss.ejb3.Ejb3Deployment] (main) error trying to stop ejb deployment: null
      javax.management.RuntimeOperationsException
       at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:512)
       at org.jboss.mx.server.MBeanServerImpl.unregisterMBean(MBeanServerImpl.java:383)
       at org.jboss.ejb3.Ejb3Deployment.unregisterDeployment(Ejb3Deployment.java:440)
       at org.jboss.ejb3.Ejb3Deployment.destroy(Ejb3Deployment.java:747)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:501)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:182)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)
       at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
       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.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)
      Caused by: java.lang.IllegalArgumentException: null object name
       ... 39 more
      2009-06-21 10:17:27,549 DEBUG [org.jboss.ejb3.deployers.Ejb3Deployer] (main) Error during deploy: vfszip:/jboss/server/default/deploy/dfserver.jar/
      org.jboss.deployers.spi.DeploymentException: Error deploying dfserver.jar: Error creating ejb container DocumentFacadeBean: Container jboss.j2ee:jar=dfserver.jar,name=DocumentFacadeBean,service=EJB3,VMID=583c10bfdbd326ba:da2fe9b:12203d1cd17:-7ff9 + is already registered
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)
       at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
       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.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)
      Caused by: org.jboss.deployers.spi.DeploymentException: Error creating ejb container DocumentFacadeBean: Container jboss.j2ee:jar=dfserver.jar,name=DocumentFacadeBean,service=EJB3,VMID=583c10bfdbd326ba:da2fe9b:12203d1cd17:-7ff9 + is already registered
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:732)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:669)
       at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:651)
       at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:614)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:491)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:182)
       ... 33 more
      Caused by: java.lang.IllegalStateException: Container jboss.j2ee:jar=dfserver.jar,name=DocumentFacadeBean,service=EJB3,VMID=583c10bfdbd326ba:da2fe9b:12203d1cd17:-7ff9 + is already registered
       at org.jboss.ejb3.Ejb3Registry.register(Ejb3Registry.java:128)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:728)
       ... 38 more


      Please advise how to fix it.