Comments (7)
Can you please provide a code snippet? It's difficult to help debug the issue without seeing your implementation, as InvocationTargetException is a really common error related to method invocation.
Thanks,
from actions-on-google-java.
There are two classes:
- IntentMapping.java
@ForIntent("sign_in")
public ActionResponse getSignInStatus(ActionRequest request) {
LOGGER.debug("Request received from welcome method in getSignInStatus");
ResponseBuilder responseBuilder = getResponseBuilder(request);
LOGGER.debug("Check if user has signed In or not");
if (request.isSignInGranted()) {
LOGGER.debug("The user has signed in");
LOGGER.debug("Getting User Profile");
GoogleIdToken.Payload profile = getUserProfile(request.getUser().getIdToken());
LOGGER.debug("User has linked from email id "+ profile.getEmail());
email = profile.getEmail();
firstName =(String) profile.get("given_name");
lastName = (String) profile.get("family_name");
String responseFromService = getDataForUser.getUserData(email, firstName, lastName);
responseBuilder.add(
"Hey "
+ profile.get("given_name")
+ " How can I help you with my remembering skills");
} else {
LOGGER.debug("The user has not signed in");
LOGGER.debug("Returning response -- User can come again when he/she wants to sign in & continue");
responseBuilder.add("Ohh! I won't be able to help you, but Amico can keep your things safe & accessible anytime anywhere. Hope to see you soon.").endConversation();
}
return responseBuilder.build();
}
- GetDataForUser.java
public String getUserData(String email, String firstName, String lastName) {
LOGGER.debug("Arguments received are -- " +email+ ", "+firstName+" , "+lastName);
return "Let's see the user's last name"+lastName;
}
I want to pass the user profile details such as email, firstname, lastname from getSignInStatus class IntentMapping.java to getUserData classGetDataForUser.java
from actions-on-google-java.
Can you also provide the full stacktrace?
from actions-on-google-java.
2019-04-11 00:29:03 [http-nio-8080-exec-7] DEBUG c.v.a.controller.IntentController - Request received from Main Controller in Wecome Intent
2019-04-11 00:29:03 [http-nio-8080-exec-7] DEBUG c.v.a.controller.IntentController - Sending Request to getSignInStatus method to check if user has signed In or not
2019-04-11 00:29:05 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - Request received from welcome method in getSignInStatus
2019-04-11 00:29:05 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - Check if user has signed In or not
2019-04-11 00:29:05 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - The user has signed in
2019-04-11 00:29:05 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - Getting User Profile
2019-04-11 00:29:07 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - User has linked from email id [email protected]
2019-04-11 00:29:07 [http-nio-8080-exec-8] DEBUG c.v.a.controller.IntentController - Sending request to GetDataForUser-getUserData method passing profile details
**java.lang.reflect.InvocationTargetException**
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.actions.api.DefaultApp.routeRequest(DefaultApp.kt:79)
at com.google.actions.api.DefaultApp.handleRequest(DefaultApp.kt:60)
at com.voiceapp.amico.controller.MainController.webhookFunction(MainController.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:111)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.voiceapp.amico.controller.IntentController.getSignInStatus(IntentController.java:103)
... 73 more
from actions-on-google-java.
Caused by: java.lang.NullPointerException
at com.voiceapp.amico.controller.IntentController.getSignInStatus(IntentController.java:103)
... 73 more
Looks like you're receiving a NullPointerException from line 103 in your intent controller class.
I can't tell what line that is from the code snippet you provided.
from actions-on-google-java.
This is line number 73:
String responseFromService = getDataForUser.getUserData(email, firstName, lastName);
This is where I am passing the user's details to a function from IntentController class to GetDataOfUser class.
I want to save user's data in my database after Account linking - Google Sign-In
from actions-on-google-java.
Highly recommend checking out the Google Sign In and Firestore sample up on Github.
Closing due to no direct issue with the client library itself. This is a general question and is better suited for Stack Overflow -- Github issues are for reporting bugs contained in Actions on Google samples or client libraries, thank you for understanding.
from actions-on-google-java.
Related Issues (20)
- Allow deserializing a request and serializing a response using streams HOT 5
- Support noInputPrompts HOT 3
- vendored googleapis proto cause duplicate-dependency-class issues
- consider dropping JSONObject from the smarthome API surface HOT 1
- SyncResponse.Payload is missing errorCode
- Smarthome integration should expose DisconnectResponse HOT 3
- report state need a Integer value type HOT 4
- Intermittent error while while calling reportState in Java HOT 1
- Smarthome integration should allow setting arbitrary data on ExecuteResponse HOT 1
- Not able play video from hls direact link into chromecast using google smart home action
- Missing features on java AoG library
- Regarding the 'NOT_FOUND: Requested Entity was not Found' error log
- Exception when the server reports the status
- How to enrich messages with content? HOT 4
- ManagedChannelImpl was not shutdown properly HOT 3
- Support for Actions on Google Console HOT 3
- why there is no field `notificationSupportedByAgent` ? HOT 4
- German umlauts (ä, ö and ü) not properly displayed and spoken. HOT 3
- FATAL EXCEPTION: java.lang.AssertionError getResourceResolver after gradle and kotlin version updated in Android project
- Security Policy violation Binary Artifacts HOT 28
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actions-on-google-java.