6 Replies Latest reply on Jan 31, 2011 2:11 PM by meetoblivion

    Resource method definitions

    meetoblivion

      I've run into a wall just now.

       

      For code I'm beta testing in seam, I definited an interface like this:

       

      public interface MappingInterface {

          @Resource(mappedName="jms/LongT")

          public void mapLongsToTopic(@Observes Long id);

      }

       

      Which Switchboard is rejecting in that it can't inject the resource defined in the method in to the argument.  I would argue though that it shouldn't be attempting to process the injection point.  The exception I'm getting looks like this:

       

      2011-01-29 20:56:53,023 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Real: name=vfs:///apps/jboss/jboss-6.0.0.Final/server/all/deploy/JMSManagingApp.war state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error during deploy: vfs:///apps/jboss/jboss-6.0.0.Final/server/all/deploy/JMSManagingApp.war

          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.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) [:0.2.2]

          at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:240) [:0.2.2]

          at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) [:0.2.2]

          at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:57) [:0.2.2]

          at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) [:0.2.2]

          at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:95) [:0.2.2]

          at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) [:0.2.2]

          at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) [:0.2.2]

          at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) [:0.2.2]

          at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) [:0.2.2]

          at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) [:0.2.2]

          at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) [:0.2.2]

          at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) [:0.2.2]

          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_22]

          at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [:1.6.0_22]

          at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [:1.6.0_22]

          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [:1.6.0_22]

          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) [:1.6.0_22]

          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) [:1.6.0_22]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]

      Caused by: java.lang.NumberFormatException: For input string: "jms/LongT"

          at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) [:1.6.0_22]

          at java.lang.Long.parseLong(Long.java:410) [:1.6.0_22]

          at java.lang.Long.<init>(Long.java:678) [:1.6.0_22]

          at org.jboss.switchboard.mc.resource.provider.EnvEntryResourceProvider.getEnvEntryValue(EnvEntryResourceProvider.java:125) [:1.0.0-alpha-15]

          at org.jboss.switchboard.mc.resource.provider.EnvEntryResourceProvider.provide(EnvEntryResourceProvider.java:76) [:1.0.0-alpha-15]

          at org.jboss.switchboard.mc.resource.provider.EnvEntryResourceProvider.provide(EnvEntryResourceProvider.java:44) [:1.0.0-alpha-15]

          at org.jboss.switchboard.mc.JndiEnvironmentProcessor.process(JndiEnvironmentProcessor.java:68) [:1.0.0-alpha-15]

          at org.jboss.switchboard.mc.deployer.AbstractSwitchBoardDeployer.process(AbstractSwitchBoardDeployer.java:119) [:1.0.0-alpha-15]

          at org.jboss.switchboard.mc.deployer.WebEnvironmentSwitchBoardDeployer.internalDeploy(WebEnvironmentSwitchBoardDeployer.java:66) [:1.0.0-alpha-15]

          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]

          ... 37 more

        • 1. Resource method definitions
          jaikiran

          John Ament wrote:

           

          I've run into a wall just now.

           

          For code I'm beta testing in seam, I definited an interface like this:

           

          public interface MappingInterface {

              @Resource(mappedName="jms/LongT")

              public void mapLongsToTopic(@Observes Long id);

          }

           

          Which Switchboard is rejecting in that it can't inject the resource defined in the method in to the argument.  I would argue though that it shouldn't be attempting to process the injection point. 

          Hmm, you mean it's processing a @Resource on the method of an interface? By the way, why do you have it there? If you don't want it to be a injection point then have it the class level of the implementing class.

          • 2. Resource method definitions
            nickarls

            Let me try reading Johns mind:

             

            "I'm writing a portable CDI extension and I thought it would be a good idea to recycle known annotations. Apparently it wasn't and now I'm asking what the spec say about resource annotations in odd places, should they be ignored or should exceptions be thrown?" ;-)

            • 3. Resource method definitions
              jaikiran

              Nicklas Karlsson wrote:

               

              Apparently it wasn't and now I'm asking what the spec say about resource annotations in odd places, should they be ignored or should exceptions be thrown?" ;-)

              The Java EE spec talks about the (container managed) classes and not the interfaces. So they should be ignored on the interfaces.

              • 4. Resource method definitions
                meetoblivion

                I believe Jaikiran hit my point on the head.  In the case I'm working on, there will never be a concrete implementation of this interface in code.  I could hear arguments for JBoss AS needing to validate the interface, but an env-entry of the resource mapped name would never be mapped to a long.  I thought that interfaces would only get scanned if there was an impl managed object that used it?

                • 5. Resource method definitions
                  jaikiran
                  • 6. Resource method definitions
                    meetoblivion