Hendy Irawan created SEAMSOCIAL-32:
--------------------------------------

             Summary: twitter.updateStatus() error: Unable to resolve any beans 
for Types: interface org.jboss.seam.social.oauth.OAuthProvider
                 Key: SEAMSOCIAL-32
                 URL: https://issues.jboss.org/browse/SEAMSOCIAL-32
             Project: Seam Social
          Issue Type: Bug
          Components: Twitter
    Affects Versions: 3.1.0.Final
            Reporter: Hendy Irawan
            Assignee: Antoine Sabot-Durand


I configured beans.xml like :

{code}
<o:TwitterServiceJackson>
        <s:modifies />
        <o:OAuthApplication apiKey="****"
                apiSecret="****" 
callback="http://ceefour.annafi:8080/satukancinta-web/callback.jsf"; />
</o:TwitterServiceJackson>
{code}

But this code:

{code}
@Inject private TwitterService twitter;

public void publishTwitterStatus() {
        String message = getFbStatusMessage();
        log.debug("Updating Twitter status: {}", message);
        twitter.updateStatus(message);
}
{code}

causes:

{code}
Caused by: javax.faces.el.EvaluationException: 
org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to 
resolve any beans for Types: [interface 
org.jboss.seam.social.oauth.OAuthProvider]; Bindings: 
[@javax.enterprise.inject.Any(), @org.jboss.seam.social.Twitter()]
        at 
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
 [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
        at 
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
 [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
        ... 30 more
Caused by: org.jboss.weld.exceptions.UnsatisfiedResolutionException: 
WELD-001308 Unable to resolve any beans for Types: [interface 
org.jboss.seam.social.oauth.OAuthProvider]; Bindings: 
[@javax.enterprise.inject.Any(), @org.jboss.seam.social.Twitter()]
        at 
org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:707) 
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
        at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:96) 
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
        at 
org.jboss.seam.social.oauth.OAuthServiceBase.getProvider(OAuthServiceBase.java:88)
 [seam-social-3.1.0.Final.jar:]
        at 
org.jboss.seam.social.oauth.OAuthServiceBase.sendSignedRequest(OAuthServiceBase.java:139)
 [seam-social-3.1.0.Final.jar:]
        at 
org.jboss.seam.social.twitter.jackson.TwitterServiceJackson.updateStatus(TwitterServiceJackson.java:97)
 [seam-social-twitter-3.1.0.Final.jar:]
        at 
org.jboss.seam.social.twitter.jackson.TwitterServiceJackson.updateStatus(TwitterServiceJackson.java:45)
 [seam-social-twitter-3.1.0.Final.jar:]
        at 
com.satukancinta.ui.admin.UserShowAdmin.publishTwitterStatus(UserShowAdmin.java:262)
 [classes:]
        at 
com.satukancinta.ui.admin.UserShowAdmin$Proxy$_$$_WeldClientProxy.publishTwitterStatus(UserShowAdmin$Proxy$_$$_WeldClientProxy.java)
 [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
[:1.7.0_147-icedtea]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
[:1.7.0_147-icedtea]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [:1.7.0_147-icedtea]
        at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_147-icedtea]
        at org.apache.el.parser.AstValue.invoke(AstValue.java:262) 
[jbossweb-7.0.7.Final.jar:]
        at 
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) 
[jbossweb-7.0.7.Final.jar:]
        at 
org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
 [weld-core-1.1.4.Final.jar:2011-11-22 20:01]
        at 
org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) 
[weld-core-1.1.4.Final.jar:2011-11-22 20:01]
        at 
com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
 [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT]
        at 
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
 [jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
        ... 31 more
{code}

I tried to provide my own OAuthSession but doesn't work: (because the access 
token is already stored, there's no need to re-authorize every time)

{code}
@Produces @RequestScoped @Twitter public OAuthSession getTwitterSession() {
        OAuthSessionImpl session = new 
OAuthSessionImpl(Twitter.class.cast(Annotation.class));
        session.setAccessToken(new OAuthToken() {
                
                @Override
                public String getToken() {
                        return userView.getUser().getTwitterAccessToken();
                }
                
                @Override
                public String getSecret() {
                        return userView.getUser().getTwitterAccessTokenSecret();
                }
        });
        return session;
}
{code}

I can get the Twitter instance but cannot do anything with it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues

Reply via email to