The right way to get the selector for your namespace is to use the API
presented by org.jboss.as.naming.context.NamespaceContextSelector, which
lets you push/pop contexts into the current thread. It should go
without saying that you should pop any contexts you push before
returning from your method, but I'll say it anyway. :-)
In order to acquire your JavaEE namespace you have to know what EE
component, module, and application you're executing in the context of.
On 04/13/2011 07:59 AM, Magesh Kumar Bojan wrote:
I am writing a deployer for SwitchYard[1], basically migrating the
AS6 code to AS7. I have created some basic Subsystem code that deploys the artifact (a jar
file containing switchyard.xml). Now in order to integrate with Weld (the one and only
implementation, that we have in SwitchYard), I would like to migrate the AS6 deployer code
to AS7. While doing so I encounter the following error:
Caused by: javax.naming.NamingException: Failed to get context with name comp
at
org.jboss.as.naming.context.NamespaceObjectFactory.getObjectInstance(NamespaceObjectFactory.java:71)
at org.jboss.as.naming.NamingContext.getObjectInstance(NamingContext.java:470)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:201)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:211)
at javax.naming.InitialContext.lookup(Unknown Source)
at
org.switchyard.component.bean.deploy.BeanDeploymentMetaData.getJavaComp(BeanDeploymentMetaData.java:146)
I know the code says that the NamespaceContextSelector is null. Is this by design? What
should I do to get the JNDI namespace? I transformed the code to use
org.jboss.msc.service.Service and it still doesn't help. Is this a *right* way to do
stuff? Do you have any advice on how to proceed with this naming issue?
I could see these dependencies in my app that was compiled from[4], it shows that I have
a BeanManager @java:module/BeanManager, just the lookup fails.
service jboss.deployment.unit."m1app-0.1.0-SNAPSHOT.jar".beanmanager,
service jboss.deployment.unit."m1app-0.1.0-SNAPSHOT.jar".namespaceselector,
service
jboss.naming.context.java.module."m1app-0.1.0-SNAPSHOT"."m1app-0.1.0-SNAPSHOT".ModuleName,
service
jboss.naming.context.java.module."m1app-0.1.0-SNAPSHOT"."m1app-0.1.0-SNAPSHOT".BeanManager
The source for BeanDeploymentMetaData is here[2] and the source for the SwitchYard
deployer stuff is here[3].
[1]
http://www.jboss.org/switchyard
[2]
https://github.com/jboss-switchyard/components/tree/master/bean
[3]
https://github.com/mageshbk/switchyard-as7-extension
[4]
https://github.com/jboss-switchyard/quickstarts
cheers,
Magesh
_______________________________________________
jboss-as7-dev mailing list
jboss-as7-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
--
- DML