如果您想了解java.lang.IllegalStateExceptioninES+ZipkinEnvironment的相关知识,那么本文是一篇不可错过的文章,我们将为您提供关于###Errorque
如果您想了解java.lang.IllegalStateException in ES + Zipkin Environment的相关知识,那么本文是一篇不可错过的文章,我们将为您提供关于### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String ### Cause: java.lang.IllegalArgumentException: ...、Android 8.0:java.lang.IllegalStateException:不允许启动服务 Intent、Android 8.0:java.lang.IllegalStateException:不允许启动服务Intent、android – rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion)的有价值的信息。
本文目录一览:- java.lang.IllegalStateException in ES + Zipkin Environment
- ### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String ### Cause: java.lang.IllegalArgumentException: ...
- Android 8.0:java.lang.IllegalStateException:不允许启动服务 Intent
- Android 8.0:java.lang.IllegalStateException:不允许启动服务Intent
- android – rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion)
java.lang.IllegalStateException in ES + Zipkin Environment
java.lang.IllegalStateException in ES + Zipkin Environment
Issue
When I integrate Spring Cloud Slueth + Kafka + OpenZipkin + Elasticsearch, ES is the storage of OpenZipkin, I met this error when Openzipkin write trace log to ES using "zipkin-autoconfigure-storage-elasticsearch-http".
"error":{"type":"mapper_parsing_exception","reason":"failed to parse [timestamp]","caused_by":{"type":"json_parse_exception","reason":"Numeric value (1523409146837000) out of range of int\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@781cb877; line: 1, column: 616]"}}}}]}
at zipkin2.elasticsearch.internal.HttpBulkIndexer$CheckForErrors.convert(HttpBulkIndexer.java:74)
at zipkin2.elasticsearch.internal.HttpBulkIndexer$CheckForErrors.convert(HttpBulkIndexer.java:69)
at zipkin2.elasticsearch.internal.client.HttpCall.parseResponse(HttpCall.java:148)
at zipkin2.elasticsearch.internal.client.HttpCall$V2CallbackAdapter.onResponse(HttpCall.java:125)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This is caused by ES convert JSON integer/long number field to ES integer field in my environment.
By default, ES dynamic
field mapping is enabled, some simple rules are used to determine which datatype the field should have:
JSON datatype
Elasticsearch datatype
null
No field is added.
true
or false
boolean
field
floating point number
float
field
integer
long
field
object
object
field
array
Depends on the first non-null
value in the array.
string
Either a date
field (if the value passes date detection), a double
or long
field (if the value passes numeric detection) or a text
field, with a keyword
sub-field.
Please refer https://www.elastic.co/guide/en/elasticsearch/reference/master/dynamic-field-mapping.html#numeric-detection
So, by default, ES will map the JSON integer/long to ES long, the default rule must be override in my invironment.
Through checking the Dynamic templates configuration by "GET /_template" in kibana dev tool console, I find there is a template for other usage as below
{
"log-index-template": {
"order": 0,
"version": 1,
"template": "*",
"settings": {
"index": {
"number_of_shards": "6",
"number_of_replicas": "2",
"refresh_interval": "5s"
}
},
"mappings": {
"_default_": {
"dynamic_templates": [
{
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "integer"
}
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
],
"properties": {
"@timestamp": {
"include_in_all": false,
"type": "date"
},
"@version": {
"include_in_all": false,
"type": "keyword"
}
},
"_all": {
"enabled": true,
"norms": false
}
}
},
"aliases": {}
}
}
It is this template caused the issue.
Fix
Option1: Change "template": "*" to "template": "log*" to make it only affect log* index so that zipkin* index not affected by it.
Option2: Remove the defined mapping "long" to "int" setting.
### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String ### Cause: java.lang.IllegalArgumentException: ...
### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String
### Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String] with root cause
java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String
at org.apache.ibatis.ognl.OgnlOps.compareWithConversion(OgnlOps.java:92)
at org.apache.ibatis.ognl.OgnlOps.isEqual(OgnlOps.java:142)
at org.apache.ibatis.ognl.OgnlOps.equal(OgnlOps.java:794)
at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:53)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)
at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:61)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:494)
......
在MVC开发中习惯使用原有的类作为传参方式:
javaBean:
该javaBean上建立扩展类:
数据库中,blog表和blogType表存在外键关系,所以在blog类的实现上,要建立一个blogType的类做属性。
在该查询中,显示的异常信息可知,invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String,不能比较(blogType和String)
sql语句的拼接中,判断该类是否为空就行了,我就照着前面的一路CV,从而忽略了这个错误(根本是没注意到这样的问题)。
所以这里要注意啊:代码套路深,CV需谨慎啊。CV自己的代码都能坑死自己啊。
日常报错ing,吸取更多的教训,写出更优雅的代码,同时希望能帮助到同是坎坷路上的码友们。
Android 8.0:java.lang.IllegalStateException:不允许启动服务 Intent
在应用程序启动时,应用程序启动应该执行某些网络任务的服务。以 API 级别 26 为目标后,我的应用程序无法在后台在 Android 8.0 上启动服务。
原因:java.lang.IllegalStateException:不允许启动服务 Intent {
cmp=my.app.tt/com.my.service }:应用处于后台 uid UidRecord{90372b1 u0a136 CEM idle
procs:1 seq(0,0 ,0)}
据我了解,它与:
后台执行限制有关
如果面向 Android 8.0 的应用尝试在不允许创建后台服务的情况下使用该方法,则 startService() 方法现在会引发
IllegalStateException。
“ 在不允许的情况下 ”-实际上是什么意思?以及如何解决它。我不想将我的服务设置为“前台”
答案1
小编典典允许的情况是临时白名单,其中后台服务的行为与 Android O 之前的行为相同。
在某些情况下,后台应用程序会被置于临时白名单中几分钟。当应用在白名单中时,它可以不受限制地启动服务,并且允许其后台服务运行。当应用处理用户可见的任务时,应用会被列入白名单,例如:
- 处理高优先级 Firebase 云消息传递 (FCM) 消息。
- 接收广播,例如 SMS/MMS 消息。
- 从通知执行 PendingIntent。
- 在 VPN 应用程序将自身提升到前台之前启动 VpnService。
所以换句话说,如果您的后台服务不符合白名单要求,您必须使用新的JobScheduler。它与后台服务基本相同,但它会定期调用,而不是在后台连续运行。
如果您使用的是 IntentService,则可以更改为 JobIntentService。请参阅下面的的回答。
最好的方法是使用JobIntentService,它使用新的 JobScheduler for Oreo 或旧服务(如果不可用)。
在您的清单中声明:
<service android:name=".YourService" android:permission="android.permission.BIND_JOB_SERVICE"/>
在您的服务中,您必须将 onHandleIntent 替换为 onHandleWork:
public class YourService extends JobIntentService { public static final int JOB_ID = 1; public static void enqueueWork(Context context, Intent work) { enqueueWork(context, YourService.class, JOB_ID, work); } @Override protected void onHandleWork(@NonNull Intent intent) { // your code }}
然后你开始你的服务:
YourService.enqueueWork(context, new Intent());
Android 8.0:java.lang.IllegalStateException:不允许启动服务Intent
在应用程序启动时,应用程序启动应该执行某些网络任务的服务.
在针对API级别26后,我的应用程序无法在后台启动Android 8.0上的服务.
Caused by: java.lang.IllegalStateException: Not allowed to start
service Intent {
cmp=my.app.tt/com.my.service
}: app is in background uid UidRecord{90372b1 u0a136 CEM idle procs:1
seq(0,0,0)}
据我所知,它涉及到:
Background execution limits
The startService() method Now throws an IllegalStateException if an
app targeting Android 8.0 tries to use that method in a situation when
it isn’t permitted to create background services.
“在不允许的情况下” – 它实际意味着什么?以及如何解决它.我不想把我的服务设置为“前景”
解决方法:
允许的情况是临时白名单,其中后台服务的行为与Android O之前相同.
Under certain circumstances, a background app is placed on a temporary whitelist for several minutes. While an app is on the whitelist, it can launch services without limitation, and its background services are permitted to run. An app is placed on the whitelist when it handles a task that’s visible to the user, such as:
- Handling a high-priority Firebase Cloud Messaging (FCM) message.
- Receiving a broadcast, such as an SMS/MMS message.
- Executing a PendingIntent from a notification.
- Starting a VpnService before the VPN app promotes itself to the foreground.
资料来源:https://developer.android.com/about/versions/oreo/background.html
换句话说,如果您的后台服务不符合白名单要求,则必须使用新的JobScheduler.它与后台服务基本相同,但它会定期调用,而不是连续在后台运行.
如果您使用的是IntentService,则可以更改为JobIntentService.见@ kosev的answer below.
android – rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion)
嗨我正在使用以下代码,但有时应用程序崩溃与错误:
java.lang.IllegalArgumentException in startActivity(slideactivity, bndlanimation);
if (android.os.Build.VERSION.SDK_INT >= 16) {
Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slide_in, R.anim.slide_out).toBundle();
startActivity(slideactivity, bndlanimation);
} else
startActivity(slideactivity);
finish();
这是崩溃日志
java.lang.IllegalArgumentException 1 at
android.os.Parcel.readException(Parcel.java:1553) 2 at
android.os.Parcel.readException(Parcel.java:1499) 3 at
android.app.ActivityManagerProxy.isTopOfTask(ActivityManagerNative.java:4465)
4 at android.app.Activity.isTopOfTask(Activity.java:5361) 5 at
android.app.Activity.startActivityForResult(Activity.java:3770) 6 at
android.app.Activity.startActivity(Activity.java:4003) 7 at
com.tapcibo.tapcibo.uifragment.LaunchActivity.a(SourceFile:105)
解决方法:
如果您使用的是ActivityCompat.startActivity(),请尝试使用ActivityOptionsCompat而不是ActivityOptions.
同样使用ActivityOptionsCompat.makeSceneTransitionAnimation()来制作动画选项.
我们今天的关于java.lang.IllegalStateException in ES + Zipkin Environment的分享就到这里,谢谢您的阅读,如果想了解更多关于### Error querying database. Cause: java.lang.IllegalArgumentException: invalid comparison: cn.xiaojian.blog.po.BlogType and java.lang.String ### Cause: java.lang.IllegalArgumentException: ...、Android 8.0:java.lang.IllegalStateException:不允许启动服务 Intent、Android 8.0:java.lang.IllegalStateException:不允许启动服务Intent、android – rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion)的相关信息,可以在本站进行搜索。
本文标签: