JBoss Community

Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

created by rosanero4ever in EJB3 - View the full discussion

I'm using netbeans 7 and JBoss 6 and I'm looking for a solution in these days about the error pasted below when I deploy mi EJB 3 bean using @Resource annotation.

It seems an error caused by a bad position of the jndi.properties in the ear structure. I put this file in the classpath of the project, i.e. the src folder. I also used the conf folder of the ear but the problem still occurs.

I hope anyone can help me to understand the right way.

Thanks in advance

 

 

The EJB code (taken from the book "EJB in Action") and the error are the following:

 

 

 

  @Stateless public class PlaceOrderBean implements PlaceOrderBeanLocal

    {

 

 

    @Resource(name = "jms/QueueConnectionFactory")

    private ConnectionFactory connectionFactory; 

   

 

 

    private Long bidderId;

    private List();

    }

 

 

 

 

    private void billOrder(Order order) {

        try {

            Connection connection = connectionFactory.createConnection();

            Session session = connection.createSession(false,

                    Session.AUTO_ACKNOWLEDGE);

            MessageProducer producer = session.createProducer(billingQueue);

            ObjectMessage message = session.createObjectMessage();

            message.setObject(order);

            producer.send(message);

            producer.close();

            session.close();

            connection.close();

        } catch (Exception e) {

            e.printStackTrace();

        }

       

    }

 

 

 

 

    @Remove

    public Long confirmOrder() {

        Order order = new Order();

        order.setBidderId(bidderId);

        order.setItems(items);

        order.setShippingInfo(shippingInfo);

        order.setBillingInfo(billingInfo);

        saveOrder(order);

        billOrder(order);

        return order.getOrderId();

    }

 

 

 

    /* OTHER METHODS */

 

 

    }

 

 

 

 

The error is :

 

 

   

16:03:23,296 ERROR org.jboss.kernel.plugins.dependency.AbstractKernelController Error

 

 

    installing to Real: name=vfs:///D:/jboss6/server/default/deploy/prova2.ear state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error during deploy: org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData.PlaceOrderBean

              at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:185) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1603) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) :2.2.0.GA

              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) jboss-dependency.jar:2.2.0.GA

              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) jboss-dependency.jar:2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) :2.2.0.GA

              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) :2.2.0.GA

              at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) :6.0.0.Final

              at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:240) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:57) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:95) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.lang.Thread.run(Thread.java:722) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

    Caused by: java.lang.RuntimeException: Neither any mapped-name/lookup/jndi-name specified nor any ResourceProvider could process resource-ref named env/jms/QueueConnectionFactory of type javax.jms.ConnectionFactory

              at org.jboss.switchboard.mc.resource.provider.ResourceRefResourceProviderDelegator.provide(ResourceRefResourceProviderDelegator.java:125) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.switchboard.mc.resource.provider.ResourceRefResourceProviderDelegator.provide(ResourceRefResourceProviderDelegator.java:44) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.switchboard.mc.JndiEnvironmentProcessor.process(JndiEnvironmentProcessor.java:68) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.switchboard.mc.deployer.AbstractSwitchBoardDeployer.process(AbstractSwitchBoardDeployer.java:119) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.switchboard.mc.deployer.EJBEnvironmentSwitchBoardDeployer.internalDeploy(EJBEnvironmentSwitchBoardDeployer.java:87) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) :2.2.0.GA

              ... 38 more

   

    16:03:23,484 WARN  org.jboss.profileservice.deployment.hotdeploy.HDScanner Scan failed: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

   

   

      • DEPLOYMENTS IN ERROR: Name -> Error

   

    vfs:///D:/jboss6/server/default/deploy/prova2.ear -> org.jboss.deployers.spi.DeploymentException: Error during deploy: org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData.PlaceOrderBean

   

   

    DEPLOYMENTS IN ERROR:

      Deployment "vfs:///D:/jboss6/server/default/deploy/prova2.ear" is in error due to the following reason(s): java.lang.RuntimeException: Neither any mapped-name/lookup/jndi-name specified nor any ResourceProvider could process resource-ref named env/jms/QueueConnectionFactory of type javax.jms.ConnectionFactory

   

              at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370) :2.2.0.GA

              at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316) :2.2.0.GA

              at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968) :2.2.0.GA

              at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:82) :6.0.0.Final

              at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.checkComplete(ProfileControllerContext.java:138) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:246) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:57) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:95) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

              at java.lang.Thread.run(Thread.java:722) Error deploying EJB on JBoss 6 using @Resource annotation and jndi.properties

 

Reply to this message by going to Community

Start a new discussion in EJB3 at Community