Discussion:
[seam-dev] Seam JCR and multiple repos
Ove Ranheim
2012-01-08 22:29:42 UTC
Permalink
Hi,

I'm trying to connect to two different JCR (ModeShape) repos in my app, but based on current documentation and some testing, I'm not able to figure it out.

Producer bean:

@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositorySessionQualifer
public Map<String, String> produceJcrConfig(@Resource("contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() + "?repositoryName=ContentRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}

@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositoryEmailSessionQualifer
public Map<String, String> produceJcrConfig2(@Resource("contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() + "?repositoryName=EmailRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}


Other bean:

@Inject
@RepositorySessionQualifer
private Instance<Session> sessionInstance;


Exception:

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name jcrRepositoryConfigMap resolves to beans [Producer Method [Map<String, String>] with qualifiers [@Any @RepositorySessionQualifer @Named] declared as [[method] @Produces @Named @RepositorySessionQualifer public com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig(URL)], Producer Method [Map<String, String>] with qualifiers [@Any @RepositoryEmailSessionQualifer @Named] declared as [[method] @Produces @Named @RepositoryEmailSessionQualifer public com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig2(URL)]]

What would be the correct way to wire up correctly?

Ove
John D. Ament
2012-01-08 22:42:04 UTC
Permalink
Hi Ove,

Looks like the issue is that you are using the same name for both beans.
Do they need to be named?

John
Post by Ove Ranheim
Hi,
I'm trying to connect to two different JCR (ModeShape) repos in my app,
but based on current documentation and some testing, I'm not able to figure
it out.
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositorySessionQualifer
"contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() +
"?repositoryName=ContentRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositoryEmailSessionQualifer
"contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() +
"?repositoryName=EmailRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Inject
@RepositorySessionQualifer
private Instance<Session> sessionInstance;
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean
name is ambiguous. Name jcrRepositoryConfigMap resolves to beans [Producer
@RepositorySessionQualifer @Named] declared as [[method] @Produces @Named
@RepositorySessionQualifer public
com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig(URL)],
@RepositoryEmailSessionQualifer @Named] declared as [[method] @Produces
@Named @RepositoryEmailSessionQualifer public
com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig2(URL)]]
What would be the correct way to wire up correctly?
Ove
_______________________________________________
seam-dev mailing list
https://lists.jboss.org/mailman/listinfo/seam-dev
Ove Ranheim
2012-01-08 22:47:07 UTC
Permalink
Hi John,

Good point :) They don't need to be named (I'm not sure why I did that). After removing it, I get a new exception and modeshape.xml is afais correctly configured.

Ove

23:44:00,713 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."test.war".component.ContentFaqRepositoryStartup.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".component.ContentFaqRepositoryStartup.START: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_29]
Caused by: java.lang.IllegalStateException: Failed to construct component instance
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:154)
at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:77)
at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:123)
at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:136)
at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
Caused by: javax.ejb.EJBException: org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [interface javax.jcr.Session]; Bindings: [@com.parts.content.qualifier.RepositorySessionQualifer()]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:160)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:213)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:313)
at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:56)
at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:42)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:152)
... 9 more
Caused by: org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [interface javax.jcr.Session]; Bindings: [@com.parts.content.qualifier.RepositorySessionQualifer()]
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:812)
at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:108)
at com.parts.content.faq.metadata.ContentFaqRepositoryStartup.initializeRoot(ContentFaqRepositoryStartup.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]
at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:70)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:53)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor$CustomSessionInvocationContext.proceed(SessionInvocationContextInterceptor.java:126)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:211)
... 19 more
Post by John D. Ament
Hi Ove,
Looks like the issue is that you are using the same name for both beans. Do they need to be named?
John
Hi,
I'm trying to connect to two different JCR (ModeShape) repos in my app, but based on current documentation and some testing, I'm not able to figure it out.
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositorySessionQualifer
String modeshapeUrl = url.toExternalForm() + "?repositoryName=ContentRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositoryEmailSessionQualifer
String modeshapeUrl = url.toExternalForm() + "?repositoryName=EmailRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Inject
@RepositorySessionQualifer
private Instance<Session> sessionInstance;
What would be the correct way to wire up correctly?
Ove
_______________________________________________
seam-dev mailing list
https://lists.jboss.org/mailman/listinfo/seam-dev
John D. Ament
2012-01-08 22:55:32 UTC
Permalink
Ove,

I see you defined RepositorySessionQualifer, but did you create a producer
for it? I only see producers for config.

John
Post by Ove Ranheim
Hi John,
Good point :) They don't need to be named (I'm not sure why I did that).
After removing it, I get a new exception and modeshape.xml is afais
correctly configured.
Ove
23:44:00,713 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8)
MSC00001: Failed to start service
org.jboss.msc.service.StartException in service
Failed to start service
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[:1.6.0_29]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[:1.6.0_29]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_29]
Caused by: java.lang.IllegalStateException: Failed to construct component instance
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:154)
at
org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:77)
at
org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:123)
at
org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:136)
at
org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
[jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308
Unable to resolve any beans for Types: [interface javax.jcr.Session];
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:160)
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:213)
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:313)
at
org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:56)
at
org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:42)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:152)
... 9 more
WELD-001308 Unable to resolve any beans for Types: [interface
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:812)
at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:108)
at
com.parts.content.faq.metadata.ContentFaqRepositoryStartup.initializeRoot(ContentFaqRepositoryStartup.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_29]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_29]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_29]
at
org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:70)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:53)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
at
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
[jboss-invocation-1.1.0.Final.jar:1.1.0.Final]
at
org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor$CustomSessionInvocationContext.proceed(SessionInvocationContextInterceptor.java:126)
at
org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:211)
... 19 more
Hi Ove,
Looks like the issue is that you are using the same name for both beans.
Do they need to be named?
John
Post by Ove Ranheim
Hi,
I'm trying to connect to two different JCR (ModeShape) repos in my app,
but based on current documentation and some testing, I'm not able to figure
it out.
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositorySessionQualifer
"contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() +
"?repositoryName=ContentRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositoryEmailSessionQualifer
"contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() +
"?repositoryName=EmailRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Inject
@RepositorySessionQualifer
private Instance<Session> sessionInstance;
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414
Bean name is ambiguous. Name jcrRepositoryConfigMap resolves to beans
@RepositorySessionQualifer @Named] declared as [[method] @Produces @Named
@RepositorySessionQualifer public
com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig(URL)],
@RepositoryEmailSessionQualifer @Named] declared as [[method] @Produces
@Named @RepositoryEmailSessionQualifer public
com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig2(URL)]]
What would be the correct way to wire up correctly?
Ove
_______________________________________________
seam-dev mailing list
https://lists.jboss.org/mailman/listinfo/seam-dev
Loading...