Getting "No Data Found"

26 views
Skip to first unread message

bipin. sutariya

unread,
Feb 17, 2011, 1:28:27 AM2/17/11
to Janrain4j
Hi there,

I am developing one rest api using janrain4j.

I have generated token with demo application from janrain4j and passes
it to my rest api.

But it is giving me "No Data found" error.

Here is code from my application. I am using spring for this project.
Any help would be appreciate.

@Autowired
private EngageService engageService;

Method details:

System.out.println(engageService.allMappings().getResponseAsJSON());
UserDataResponse response = engageService.authInfo(token);

User user = new User();

Address address = new Address();

address.setCountry(response.getProfile().getAddress().getCountry());

address.setLocality(response.getProfile().getAddress().getLocality());

address.setPostalCode(response.getProfile().getAddress().getPostalCode());
address.setRegion(response.getProfile().getAddress().getRegion());

address.setStreetAddress(response.getProfile().getAddress().getStreetAddress());

user.setAddress(address);

user.setBrithDate(response.getProfile().getBirthday());
user.setDisplayName(response.getProfile().getDisplayName());

user.setFamilyName(response.getProfile().getName().getFamilyName());

user.setFormattedName(response.getProfile().getName().getFormatted());
user.setGender(response.getProfile().getGender());
user.setGivenName(response.getProfile().getName().getGivenName());
user.setHomePage(response.getProfile().getUrl());

user.setPreffredUserName(response.getProfile().getPreferredUsername());
user.setProfilePhoto(response.getProfile().getPhoto());
user.setVerifiedEmail(response.getProfile().getVerifiedEmail());

return user;

Thank in advance

Marcel Overdijk

unread,
Feb 17, 2011, 3:18:13 PM2/17/11
to Janrain4j
Hi,

If I understand correctly your engageService.authInfo(token) call
gives back a ErrorResponeException with "No Data found"?

This is a error received from Janrain and just passed through
Janrain4j...

Can you enable debug logging and post the debug information of the
request Janrain4j is sending to Janrain and the response got back.
Everything is logged in detail.

Cheers,
Marcel

On Feb 17, 7:28 am, "bipin. sutariya" <bipin.sutar...@gmail.com>
wrote:

bipin. sutariya

unread,
Feb 18, 2011, 1:21:38 AM2/18/11
to Janrain4j
Hello Marcel,

Thanks for your reply.

Here is logs from my catalina.out

01:25:02,457 DEBUG
[com.googlecode.janrain4j.springframework.security.JanrainAuthenticationFilter]
- Request is to process authentication
01:25:02,473 DEBUG
[com.googlecode.janrain4j.api.engage.EngageServiceImpl] - Janrain
Engage request: auth_info
url: https://rpxnow.com/api/v2/auth_info
parameters: [
token: 8d4b9dfe0a85e92a2b737a13b5b27b791895c5ff
extended: true
format: json
apiKey: dfd1fcf8bad795c0e20b93f194f48ecb20282c27
]
01:25:02,480 DEBUG
[com.googlecode.janrain4j.springframework.security.JanrainAuthenticationFilter]
- Authentication request failed:
org.springframework.security.authentication.AuthenticationServiceException:
Unable to retrieve Janrain user information
01:25:02,480 DEBUG
[com.googlecode.janrain4j.springframework.security.JanrainAuthenticationFilter]
- Updated SecurityContextHolder to contain null Authentication
01:25:02,480 DEBUG
[com.googlecode.janrain4j.springframework.security.JanrainAuthenticationFilter]
- Delegating to authentication failure
handlerorg.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler@fd2b1
Message has been deleted

Marcel Overdijk

unread,
Feb 18, 2011, 4:25:32 AM2/18/11
to Janrain4j
Hi,

This is difficult for me to troubleshoot.
Would you be able to share your code?


On Feb 18, 7:21 am, "bipin. sutariya" <bipin.sutar...@gmail.com>
Message has been deleted

bipin. sutariya

unread,
Feb 19, 2011, 1:48:40 AM2/19/11
to Janrain4j
Hi,
Following is my code :
Method:
public User getUser() throws Exception
{
System.out.println("TOKEN : "+token);
if(token!=null)
{
try
{
UserDataResponse response =
engageService.authInfo(token);
User user = new User();
Address address = new Address();
address.setCountry(response.getProfile().getAddress().getCountry());
address.setLocality(response.getProfile().getAddress().getLocality());
address.setPostalCode(response.getProfile().getAddress().getPostalCode());

address.setRegion(response.getProfile().getAddress().getRegion());
address.setStreetAddress(response.getProfile().getAddress().getStreetAddres
s());
user.setAddress(address);

user.setBrithDate(response.getProfile().getBirthday());

user.setDisplayName(response.getProfile().getDisplayName());
user.setFamilyName(response.getProfile().getName().getFamilyName());
user.setFormattedName(response.getProfile().getName().getFormatted());

user.setGender(response.getProfile().getGender());

user.setGivenName(response.getProfile().getName().getGivenName());

user.setHomePage(response.getProfile().getUrl());
user.setPreffredUserName(response.getProfile().getPreferredUsername());

user.setProfilePhoto(response.getProfile().getPhoto());

user.setVerifiedEmail(response.getProfile().getVerifiedEmail());
return user;
} catch (EngageFailureException e) {
throw new Exception(e);
} catch (ErrorResponeException e) {
throw new Exception(e);
}
}
else
{
throw new Exception("token not found");
}
}
}

applictionContext-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/
beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigur
er">
<property name="locations">
<list>
<value>classpath:config.properties</
value>
</list>
</property>
</bean>
<!--
===================================================================
--

<!-- Session Level Beans -->
<!--
===================================================================
--

<!--
===================================================================
--

<!-- Managers: For accessing DAOs -->
<!--
===================================================================
--

<context:component-scan
base-
package="com.googlecode.janrain4j.samples.springframework.basic">
<context:exclude-filter
expression="org.springframework.stereotype.Controller"
type="annotation" />
</context:component-scan>
<bean
class="com.googlecode.janrain4j.springframework.Janrain4jConfigurer"
p:apiKey="${janrain.apiKey}" p:applicationID="$
{janrain.applicationID}"
p:applicationDomain="${janrain.applicationDomain}"
p:tokenUrl="$
{janrain.tokenUrl}" />
<bean
class="com.googlecode.janrain4j.springframework.EngageServiceFactoryBean" /

<bean class="com.demo.service.impl.FacebookServiceImpl"
id="facebookService">
</bean>
</beans>
config.properties
janrain.apiKey = dfd1fcf8bad795c0e20b93f194f48ecb20282c27
janrain.applicationID = pamokjjmoajnecljpggd
janrain.applicationDomain = https://bipin.rpxnow.com/
janrain.tokenUrl = http://localhost:8080/token

Please let me know if you need more data from my side.

It would appreciate if you give me some code using above api_key and
application_id.

On Feb 18, 2:25 pm, Marcel Overdijk <marceloverd...@gmail.com> wrote:
> Hi,
>

bipin. sutariya

unread,
Feb 18, 2011, 1:33:28 AM2/18/11
to Janrain4j
Hi Marcel,

Here is more details

Here is another error from web page. Actually my idea is to develop
REST API which accept token from user. I am using demo application
from janrain to generate token. If i use same API key as in demo
application I can get user information on user_data page. But if i
use
my API key and all I am getting following error.
java.lang.NullPointerException: No API environment is registered for
this thread.
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(Datas
toreApiHelper.java:
108)
com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamesp
ace(DatastoreApiHelper.java:
118)
com.google.appengine.api.datastore.Key.<init>(Key.java:104)
com.google.appengine.api.datastore.Key.<init>(Key.java:88)
com.google.appengine.api.datastore.Key.<init>(Key.java:84)
com.google.appengine.api.datastore.Entity.<init>(Entity.java:
115)
com.google.appengine.api.datastore.Entity.<init>(Entity.java:
96)
com.googlecode.janrain4j.samples.demo.DemoUserDetailsService.loadUserDetail
s(DemoUserDetailsService.java:
76)
com.googlecode.janrain4j.springframework.security.JanrainAuthenticationProv
ider.authenticate(JanrainAuthenticationProvider.java:
54)
org.springframework.security.authentication.ProviderManager.doAuthenticatio
n(ProviderManager.java:
130)
org.springframework.security.authentication.AbstractAuthenticationManager.a
uthenticate(AbstractAuthenticationManager.java:
48)
com.googlecode.janrain4j.springframework.security.JanrainAuthenticationFilt
er.attemptAuthentication(JanrainAuthenticationFilter.java:
68)
org.springframework.security.web.authentication.AbstractAuthenticationProce
ssingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:
199)
org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilte
r(LogoutFilter.java:
105)
org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.context.SecurityContextPersistenceFilter.d
oFilter(SecurityContextPersistenceFilter.java:
79)
org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy .java:
169)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(Delegat
ingFilterProxy.java:
237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFil
terProxy.java:
167)
com.googlecode.janrain4j.samples.demo.FlashScopeFilter.doFilterInternal(Fla
shScopeFilter.java:
27)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequest
Filter.java:
76)
I printed token at Sys.out. If I pass that token to my REST API i am
getting no data found error as follows
<testcase time="3.251"
classname="com.sifr.twentyat.FacebookServiceImplTest"
name="testGetUser">
-
<error
message="com.googlecode.janrain4j.api.engage.ErrorResponeException:
Data not found" type="com.demo.MyException">
com.demo.MyException:
com.googlecode.janrain4j.api.engage.ErrorResponeException: Data not
found
at
com.demo.FacebookServiceImpl.getUser(FacebookServiceImpl.java:72)
at
com.demo.FacebookServiceImplTest.testGetUser(FacebookServiceImplTest.java:
27)
Caused by: com.googlecode.janrain4j.api.engage.ErrorResponeException:
Data not found
at
com.googlecode.janrain4j.api.engage.EngageServiceImpl.apiCall(EngageService
Impl.java:
294)
at
com.googlecode.janrain4j.api.engage.EngageServiceImpl.authInfo(EngageServic
eImpl.java:
102)
at
com.googlecode.janrain4j.api.engage.EngageServiceImpl.authInfo(EngageServic
eImpl.java:
95)
at
com.demo.FacebookServiceImpl.getUser(FacebookServiceImpl.java:43)
... 30 more
</error>
<system-out>TOKEN : 8d4b9dfe0a85e92a2b737a13b5b27b791895c5ff</system-
out>

On Feb 18, 1:18 am, Marcel Overdijk <marceloverd...@gmail.com> wrote:

Marcel Overdijk

unread,
Feb 19, 2011, 3:29:29 AM2/19/11
to Janrain4j
About the

> java.lang.NullPointerException: No API environment is registered for
> this thread.

Do you get this when running the app or when executing junit tests?
Because I see some 'testcase' references below...
This NullPointerException has nothing to do with Janrain4j but related
to Google App Engine unittesting. You might want to take a look at
http://code.google.com/appengine/docs/java/tools/localunittesting.html

You might also want to try the basic servlet example with your own
apikey
http://code.google.com/p/janrain4j/source/browse/#svn%2Ftrunk%2Fsamples%2Fservlets-basic
This to make sure nothing is wrong with your apikey.

I guess at the moment you copied the demo app and made some
modifications?


On Feb 18, 7:33 am, "bipin. sutariya" <bipin.sutar...@gmail.com>

Marcel Overdijk

unread,
Feb 23, 2011, 3:13:58 PM2/23/11
to Janrain4j
Hi,

Do you need some support or did you fixed the problem?
Please let me know.

Cheers,
Marcel

On Feb 18, 7:33 am, "bipin. sutariya" <bipin.sutar...@gmail.com>

bipin. sutariya

unread,
Apr 11, 2011, 4:00:30 AM4/11/11
to Janrain4j
Hi Sorry for late reply. But solve this issue...I am not sure what was
causing that problem...but somehow it get resolved.....Thanks for your
replys....
Reply all
Reply to author
Forward
0 new messages