[jboss-user] [Microcontainer] - Service POJO JNDI Binding Problem

ralfsteppacher do-not-reply at jboss.com
Fri Jan 16 05:27:32 EST 2009


Hi there,

I am using POJO Services to initialize different parts of an application that is deployed in JBoss AS 5. I got the Service POJOs as such working just fine, but now I have a problem making some of them accessible to "unmanaged" code that is deployed in the same AS instance.
>From what I could find online the only way to do that is to add a JNDI binding aspect to the service POJO.

My first question would be, is that really the way to do it? Or is there a better way for local client code to obtain a reference to the service?

I used the SimpleBean AOP example from the microcontainer documentation as a template but when I deploy this in AS I get an error during server startup complaining that there is already an AspectManager bean installed:


  | org.jboss.deployers.spi.DeploymentException: Error deploying: AspectManager
  | 	at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
  | 	at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:125)
  | 	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.doInstallParentFirst(DeployersImpl.java:1210)
  | 	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:1598)
  | 	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
  | 	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
  | 	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:545)
  | 	at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
  | 	at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
  | 	at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
  | 	at org.jboss.Main.boot(Main.java:209)
  | 	at org.jboss.Main$1.run(Main.java:547)
  | 	at java.lang.Thread.run(Unknown Source)
  | Caused by: java.lang.IllegalStateException: AspectManager is already installed.
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:716)
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
  | 	at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
  | 	... 24 more
  | 


I removed the following section from the deployment descriptor:


  | <bean name="AspectManager" class="org.jboss.aop.AspectManager">
  | 	<constructor factoryClass="org.jboss.aop.AspectManager"
  | 		factoryMethod="instance" />
  | </bean>
  | 


But that yields a different error on server startup:


  | java.lang.RuntimeException: Error configuring property: manager for JndiAspect
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
  | 	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)
  | ...
  | Caused by: java.lang.IllegalArgumentException: Wrong arguments. setManager for target org.jboss.aop.microcontainer.beans.Aspect at db09a3 expected=[org.jboss.aop.AspectManager] actual=[org.jboss.aop.deployers.AspectManagerJDK5]
  | 	at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
  | 	at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:69)
  | 	at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
  | 	at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143)
  | 	at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177)
  | 11:22:14,044 ERROR [AbstractKernelController] Error installing to Configured: name=JndiIntroduction state=Instantiated
  | java.lang.RuntimeException: Error configuring property: manager for JndiIntroduction
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
  | 	at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
  | 	at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
  | 	at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
  | ...
  | Caused by: java.lang.IllegalArgumentException: Wrong arguments. setManager for target org.jboss.aop.microcontainer.beans.IntroductionBinding at 13730e0 expected=[org.jboss.aop.AspectManager] actual=[org.jboss.aop.deployers.AspectManagerJDK5]
  | 	at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
  | 	at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:69)
  | 	at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
  | 	at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143)
  | 	at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177)
  | ...
  | 

I read that org.jboss.aop.deployers.AspectManagerJDK5 is what has to be used with AS 5.

Any help on how to do service lookup differently or how to solve the above problem is greatly appreciated!


Thanks
Ralf

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4202383#4202383

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4202383



More information about the jboss-user mailing list