-
1. Re: Injecting web service problem
kcbabo Sep 13, 2013 8:08 AM (in response to lostvicking)The component service and reference interfaces for bean component must be Java interfaces. I would expect to see an error in the log notifying you of this during deployment, so there may be a gap in the deployment validation logic in Bean component. Did you create this app using the tooling? That should only allow you to use Java interfaces. Which version of SY are you using?
-
2. Re: Injecting web service problem
boanergesza11 Sep 16, 2013 4:23 AM (in response to kcbabo)Hi Keith;
Me and Vic are working on the same team here.
We had our service configured like this:
REST binding --> SaleBean -->Base24Bean --> SOAP reference
We were using the Base24Bean in SaleBean using @reference. However what we found was that the @inject @reference to the SOAP reference in the base24bean did not initialize (we constantly got a nullpointer exception when we tried to used it). We then wrote a small app separate form our main project to test that the soap webservice we were trying to call actually worked in switchyard (which it did).
Over the weekend I had a brainwave. The main difference from our test app and the main app was that we had one bean using the soap reference in test app, but in the main app we accessed it through a reference. So we changed it so that we accessed the soap reference directly from the first bean...wouldn't you know it that worked!
So it seems like switchyard is not initializing the references in the second bean, when the second bean has a soap webservice as reference. Its either that, or we are not configuring it right.
-
3. Re: Injecting web service problem
boanergesza11 Sep 17, 2013 6:50 AM (in response to kcbabo)Hi Keith;
I realise my ramblings above might not have made any sense. I have a project that could help explain our problem. Its built on the order service example you posted a while back.
See attached zip file
-
sample.zip 108.7 KB
-
-
4. Re: Re: Injecting web service problem
synclpz Sep 17, 2013 1:52 PM (in response to boanergesza11)You got error in your OrderServiceProxyBean.java:
@Reference private OrderServiceBean orderServiceBean;
should be
@Reference @Inject private OrderService orderServiceBean;
Notice @Inject and OrderService instead of OrderServiceBean.
Try it, may be it helps.
-
5. Re: Injecting web service problem
kcbabo Sep 17, 2013 4:15 PM (in response to synclpz)Yep, @Inject is required.
-
6. Re: Injecting web service problem
boanergesza11 Sep 18, 2013 3:24 AM (in response to kcbabo)Yep, that did the trick! Thanks guys (Crucially, we also had to use the interface as the reference, and not the bean itself)
-
7. Re: Injecting web service problem
ramandeep Nov 30, 2015 9:18 AM (in response to lostvicking)Hi All , I am facing a similar Issue . I am getting NPE while injecting reference to bean .Detail are on below thread
Could you please help me resolve it .
https://developer.jboss.org/message/946689#946689
Any help would be highly appreciated .
Thanks
Raman
-
8. Re: Injecting web service problem
igarashitm Nov 30, 2015 8:21 PM (in response to ramandeep)Do you have beans.xml in META-INF? Starting from our rest-binding quickstart would help you - modify the bean impl in that quickstart as you like, then compare with your application.
-
9. Re: Injecting web service problem
ramandeep Dec 1, 2015 5:51 AM (in response to igarashitm)I have beans.xml in META-INF folder it is empty xml file . I compared it with the REST binding quick start and it was same.
Do you think is there something else which I am missing
-
10. Re: Injecting web service problem
ramandeep Dec 1, 2015 6:14 AM (in response to ramandeep)Also II have below warning messages when I deploy the project
16:31:48,974 WARN [org.jboss.weld.Validator] (weld-worker-2) WELD-001473: javax.enterprise.inject.spi.Bean implementation org.switchyard.component.bean.internal.message.MessageBean@51940b8d declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
16:31:48,975 WARN [org.jboss.weld.Validator] (weld-worker-2) WELD-001473: javax.enterprise.inject.spi.Bean implementation org.switchyard.component.bean.internal.exchange.ExchangeBean@15c43dd9 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
16:31:48,974 WARN [org.jboss.weld.Validator] (weld-worker-1) WELD-001473: javax.enterprise.inject.spi.Bean implementation org.switchyard.component.bean.internal.context.ContextBean@77690521 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
16:31:49,355 WARN [org.jboss.weld.Validator] (weld-worker-2) WELD-001473: javax.enterprise.inject.spi.Bean implementation org.switchyard.component.bean.ClientProxyBean@18d4c3db declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
16:31:49,371 WARN [org.jboss.weld.Validator] (weld-worker-1) WELD-001473: javax.enterprise.inject.spi.Bean implementation org.switchyard.component.bean.deploy.BeanDeploymentMetaDataCDIBean@28b4b11b declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.