- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
当我使用 curl
查询时,logz.io 就像魅力一样:
curl -XPOST 'https://api.logz.io/v1/query' --header "X-USER-TOKEN : VALID_TOKEN" --header "Content-Type: application/json" -d '{"queryString" : "query","timestamp" : {"gte":1482157546000}}'
但是当我尝试用 JAVA 8 执行相同的操作时,
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
来 self 的 grails 2.5.4 应用:
String baseUrl = "https://api.logz.io/v1/"
String query = "query"
String apiKey = "VALID_TOKEN"
withHttp(uri: baseUrl) {
def bodyContent = [
queryString: query
]
def json = post(path: 'query', body: bodyContent) {
headers.'X-USER-TOKEN' = apiKey
}
return json
}
我有:
| Error 2016-12-26 18:41:06,144 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver - SSLHandshakeException occurred when processing request: [GET] /cms/offer/findWhoEditedAllocationItems/14787265
Received fatal alert: handshake_failure. Stacktrace follows:
Message: Received fatal alert: handshake_failure
Line | Method
->> 192 | getSSLException in sun.security.ssl.Alerts
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 154 | getSSLException in ''
| 2023 | recvAlert . . . . . . . . . . . in sun.security.ssl.SSLSocketImpl
| 1125 | readRecord in ''
| 1375 | performInitialHandshake . . . . in ''
| 1403 | startHandshake in ''
| 1387 | startHandshake . . . . . . . . in ''
| 553 | connectSocket in org.apache.http.conn.ssl.SSLSocketFactory
| 412 | connectSocket . . . . . . . . . in ''
| 179 | openConnection in org.apache.http.impl.conn.DefaultClientConnectionOperator
| 328 | open . . . . . . . . . . . . . in org.apache.http.impl.conn.ManagedClientConnectionImpl
| 612 | tryConnect in org.apache.http.impl.client.DefaultRequestDirector
| 447 | execute . . . . . . . . . . . . in ''
| 884 | doExecute in org.apache.http.impl.client.AbstractHttpClient
| 82 | execute . . . . . . . . . . . . in org.apache.http.impl.client.CloseableHttpClient
| 55 | execute in ''
| 477 | doRequest . . . . . . . . . . . in groovyx.net.http.HTTPBuilder
| 359 | post in ''
| -2 | invoke0 . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke in ''
| 43 | invoke . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke in java.lang.reflect.Method
| 1426 | jlrMethodInvoke . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke . . . . . . . . in groovy.lang.MetaMethod
| 1210 | invokeMethod in groovy.lang.MetaClassImpl
| 1123 | invokeMethod . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod in groovy.lang.MetaClassImpl
| 1122 | invokeMethod . . . . . . . . . in ''
| 1123 | invokeMethod in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 69 | callCurrent in org.codehaus.groovy.runtime.callsite.PogoMetaClassSite
| 52 | defaultCallCurrent . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 154 | callCurrent in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 174 | callCurrent . . . . . . . . . . in ''
| 24 | doCall in com.example.logz.LogzService$__tt__getResultFromQuery_closure3
| -1 | doCall . . . . . . . . . . . . in ''
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1426 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 210 | invoke . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce
| 71 | call in org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite
| 48 | defaultCall . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 113 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 117 | call . . . . . . . . . . . . . in ''
| 93 | doCall in RestGrailsPlugin$_closure4
| -2 | invoke0 . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke in ''
| 43 | invoke . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke in java.lang.reflect.Method
| 1426 | jlrMethodInvoke . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke . . . . . . . . in groovy.lang.MetaMethod
| 1210 | invokeMethod in groovy.lang.MetaClassImpl
| 1123 | invokeMethod . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod in groovy.lang.MetaClassImpl
| 1084 | invokeMethod . . . . . . . . . in ''
| 1123 | invokeMethod in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 917 | invokePogoMethod in org.codehaus.groovy.runtime.InvokerHelper
| 900 | invokeMethod . . . . . . . . . in ''
| 189 | invoke in org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod$AnonymousMetaMethod
| 251 | invoke . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce
| 59 | callCurrent in org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite
| 52 | defaultCallCurrent . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 154 | callCurrent in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 174 | callCurrent . . . . . . . . . . in ''
| 20 | $tt__getResultFromQuery in com.example.logz.LogzService
| -1 | doCall . . . . . . . . . . . . in com.example.logz.LogzService$_getResultFromQuery_closure1
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1426 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke in groovy.lang.MetaMethod
| 1210 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 1123 | invokeMethod in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 426 | call in groovy.lang.Closure
| -1 | call . . . . . . . . . . . . . in com.example.logz.LogzService$_getResultFromQuery_closure1
| 442 | call in groovy.lang.Closure
| -1 | call . . . . . . . . . . . . . in com.example.logz.LogzService$_getResultFromQuery_closure1
| 90 | doInTransaction in org.codehaus.groovy.grails.orm.support.GrailsTransactionTemplate$2
| 133 | execute . . . . . . . . . . . . in org.springframework.transaction.support.TransactionTemplate
| 87 | execute in org.codehaus.groovy.grails.orm.support.GrailsTransactionTemplate
| -1 | getResultFromQuery . . . . . . in com.example.logz.LogzService
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1426 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 325 | doMethodInvoke in groovy.lang.MetaMethod
| -1 | call . . . . . . . . . . . . . in groovy.lang.MetaMethod$doMethodInvoke$0
| 48 | defaultCall in org.codehaus.groovy.runtime.callsite.CallSiteArray
| -1 | call . . . . . . . . . . . . . in groovy.lang.MetaMethod$doMethodInvoke$0
| 184 | doCall in GrailsMelodyGrailsPlugin$_closure4$_closure16$_closure17
| -1 | invoke . . . . . . . . . . . . in sun.reflect.GeneratedMethodAccessor399
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1426 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 93 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 84 | invoke in org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod
| 1121 | invokeMethod . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 1019 | invokeMethod in groovy.lang.MetaClassImpl
| 42 | call . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.PogoMetaClassSite
| 48 | defaultCall in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 113 | call . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 125 | call in ''
| 161 | findWhoEditedAllocationItems . in com.example.sale.OfferController
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1426 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 154 | invoke . . . . . . . . . . . . in org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper
| 375 | handleAction in org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper
| 252 | executeAction . . . . . . . . . in ''
| 205 | handleURI in ''
| 126 | handleURI . . . . . . . . . . . in ''
| 72 | handleRequest in org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController
| 50 | handle . . . . . . . . . . . . in org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
| 347 | doDispatch in org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet
| 893 | doService . . . . . . . . . . . in org.springframework.web.servlet.DispatcherServlet
| 967 | processRequest in org.springframework.web.servlet.FrameworkServlet
| 858 | doGet . . . . . . . . . . . . . in ''
| 620 | service in javax.servlet.http.HttpServlet
| 843 | service . . . . . . . . . . . . in org.springframework.web.servlet.FrameworkServlet
| 727 | service in javax.servlet.http.HttpServlet
| 303 | internalDoFilter . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 52 | doFilter . . . . . . . . . . . in org.apache.tomcat.websocket.server.WsFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 101 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 101 | doFilter . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 101 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 748 | invoke . . . . . . . . . . . . in org.apache.catalina.core.ApplicationDispatcher
| 486 | processRequest in ''
| 411 | doForward . . . . . . . . . . . in ''
| 338 | forward in ''
| -2 | invoke0 . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 62 | invoke in ''
| 43 | invoke . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 498 | invoke in java.lang.reflect.Method
| 1426 | jlrMethodInvoke . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 150 | invoke in net.bull.javamelody.JspWrapper
| 285 | invoke . . . . . . . . . . . . in net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler
| -1 | forward in com.sun.proxy.$Proxy49
| 178 | forwardRequestForUrlMappingInfo in org.codehaus.groovy.grails.web.mapping.UrlMappingUtils
| 144 | forwardRequestForUrlMappingInfo in ''
| 135 | forwardRequestForUrlMappingInfo in ''
| 216 | doFilterInternal in org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter
| 107 | doFilter . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 198 | doFilter in net.bull.javamelody.MonitoringFilter
| 176 | doFilter . . . . . . . . . . . in ''
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 69 | doFilterInternal in org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter
| 107 | doFilter . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 67 | doFilterInternal in org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter
| 107 | doFilter . . . . . . . . . . . in org.springframework.web.filter.OncePerRequestFilter
| 241 | internalDoFilter in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter . . . . . . . . . . . in ''
| 449 | executeChain in org.apache.shiro.web.servlet.AbstractShiroFilter
| 365 | call . . . . . . . . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter$1
| 90 | doCall in org.apache.shiro.subject.support.SubjectCallable
| 83 | call . . . . . . . . . . . . . in ''
| 383 | execute in org.apache.shiro.subject.support.DelegatingSubject
| 362 | doFilterInternal . . . . . . . in org.apache.shiro.web.servlet.AbstractShiroFilter
| 125 | doFilter in org.apache.shiro.web.servlet.OncePerRequestFilter
| 344 | invokeDelegate . . . . . . . . in org.springframework.web.filter.DelegatingFilterProxy
| 261 | doFilter in ''
| 241 | internalDoFilter . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 85 | doFilterInternal . . . . . . . in org.springframework.web.filter.CharacterEncodingFilter
| 107 | doFilter in org.springframework.web.filter.OncePerRequestFilter
| 344 | invokeDelegate . . . . . . . . in org.springframework.web.filter.DelegatingFilterProxy
| 261 | doFilter in ''
| 241 | internalDoFilter . . . . . . . in org.apache.catalina.core.ApplicationFilterChain
| 208 | doFilter in ''
| 220 | invoke . . . . . . . . . . . . in org.apache.catalina.core.StandardWrapperValve
| 122 | invoke in org.apache.catalina.core.StandardContextValve
| 171 | invoke . . . . . . . . . . . . in org.apache.catalina.core.StandardHostValve
| 103 | invoke in org.apache.catalina.valves.ErrorReportValve
| 116 | invoke . . . . . . . . . . . . in org.apache.catalina.core.StandardEngineValve
| 408 | service in org.apache.catalina.connector.CoyoteAdapter
| 1070 | process . . . . . . . . . . . . in org.apache.coyote.http11.AbstractHttp11Processor
| 611 | process in org.apache.coyote.AbstractProtocol$AbstractConnectionHandler
| 316 | run . . . . . . . . . . . . . . in org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 61 | run in org.apache.tomcat.util.threads.TaskThread$WrappingRunnable
^ 745 | run . . . . . . . . . . . . . . in java.lang.Thread
我也尝试在启动应用程序时添加标志:-Ddeployment.security.TLSv1.2=true
但它仍然返回相同的错误。
api.logz.io
服务器的统计信息看起来正常:https://www.ssllabs.com/ssltest/analyze.html?d=api.logz.io
如何使用此 API?
最佳答案
正如支持 channel 中的回答,以下 java 8 代码正在运行:
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
public class Main {
public static void main(String[] args) throws IOException {
String token = "XXX";
String url = "https://api.logz.io/v1/query";
String query = "{ \"queryString\": \"*\" }";
URL myurl = new URL(url);
HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-length", String.valueOf(query.length()));
con.setRequestProperty("Content-Type","application/json");
con.setRequestProperty("X-USER-TOKEN",token);
con.setDoOutput(true);
con.setDoInput(true);
DataOutputStream output = new DataOutputStream(con.getOutputStream());
output.writeBytes(query);
output.close();
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuilder sb = new StringBuilder();
reader.lines().forEach(sb::append);
System.out.println(sb.toString());
}
}
所以我认为问题出在 grails 上,而不是 Java 8
关于ssl - 来自 grails 应用程序的 handshake_failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41337467/
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我们正在尝试使用 https://grails.org/plugin/jms用于 jms 集成。但我们无法解决它。 环顾四周,我能够验证它是否存在于这个 repo 中: http://repo.gra
我有许多集成测试在grails 3中失败(而在grails 2中通过),因为它无法解析导入: grails.test.MockUtils grails.test.Grails模拟 我找不到有关应如何迁
有没有办法在 Grails 站点上发生 Grails 错误时向自己发送详细信息? 设置它的最佳方法是什么?在一个地方? (试图保持干燥) 我想包括产生错误的 URL。 最佳答案 . 如果您打算捕获项目
我有一个 grails 应用程序,其中包含一些被序列化为 JSON 的域对象。在另一个 java/groovy 项目中,我想使用这些域对象。如果我发布一个插件,看起来只有其他 grails 应用程序可
我正在尝试为 Grails 编写一个插件,该插件将根据我们在遗留数据库中设计的特殊 View 自动生成我的域类。我基本上只是想节省一些时间手动编写使域类工作所需的所有映射内容。 我是否可以从自定义 A
我正在尝试编写一个可以在多个 Grails 应用程序中重用的插件。该插件基本上应该是 spring security core 的包装器和 ldap 插件。 这意味着它应该包含: 用户/角色的域类 S
我有一个应用程序,我在其中使用 Spring Security 和 grails 旋律。我计划在生产环境中运行 grails melody,但不希望访问者访问它。我应该如何做到这一点?我尝试在 gra
我只是继承了一个现有的应用程序,而我注意到的第一件事是我必须在每个“grails run-app”之前进行“grails clean”操作,否则会出错。创建该项目的人说,他们还有其他几个具有类似设置的
我有一个自定义 toString我的枚举中的方法: enum TaxRate implements Serializable { RATE23(23.0), ... priva
我正在创建一个 Grails 插件作为复杂产品的包装器。该产品对其他产品(如 hibernate)有很多依赖性。问题是,grails 有一些相同的依赖项,但版本不同。 例如。 Grails -> 休眠
当我掉进 grails 服务的兔子洞时,我目前正在将业务逻辑从 Controller 方法转移到服务。我的服务中有以下方法: Job closeJobOpportunity(Job op, Emplo
我只收到默认验证器消息。我究竟做错了什么? class Questao { static hasMany = [alternativas:Alternativa] static constraints
Closed. This question needs to be more focused 。它目前不接受答案。 想改善这个问题吗?更新问题,使其仅通过 editing this post 关注一个
特定版本的 Grails 支持多长时间?一般的 VMWare 支持策略似乎是支持当前版本和一个版本。我无法找到任何关于支持多长时间版本的 Grails 特定信息,通用 VMWare 策略是否适用? 最
我有一个通过 grails 交互模式运行的 grails 应用程序。此应用程序包含服务、tagLibs、gsps 等,但最重要的是它包含 src/groovy 文件夹中的 groovy 文件。 这些
LinkedIn 的人们一直在以一种有趣的方式使用 Play 来处理需要由许多不同组件组成的页面:http://engineering.linkedin.com/play/composable-and
我在 Grails 应用程序中使用 Servlet 3.0 异步渲染。我收到以下错误。 | Error 2014-04-29 11:10:24,125 [Actor Thread 28] ERROR
我看了Controller.groovy源代码,看起来 CRUD 操作不是事务性的(至少是明确的)。 如果我是对的,这是否意味着不应该在生产中按原样使用动态脚手架?有没有办法使它具有事务性(即我可以修
我如何基本上对字符串数据类型字段执行唯一约束。 class User{ String username String Email static hasMany = [roles:Roles
我是一名优秀的程序员,十分优秀!