我间歇地得到这个错误.
我有一个使用java aws sdk的程序,并将数以千计的小文件加载到s3.我间歇地看到这个错误.
在互联网上快速搜索后找不到任何有用的答案.
请注意,调用程序是单线程的.底层的aws java sdk似乎确实使用了工作线程.
Status Code: 409, AWS Service: Amazon S3, AWS Request ID: 75E16E8DE2193CA6, AWS Error Code: OperationAborted, AWS Error Message: A conflicting conditional operation is currently in progress against this resource. Please try again., S3 Extended Request ID: 0uquw2YEoFamLldm+c/p412Lzd8jHJGFBDz3h7wN+/4I0f6hnGLkPMe+5LZazKnZ
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:552)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:289)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:170)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2648)
at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:578)
at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:503)
Run Code Online (Sandbox Code Playgroud) 我有一个BigDecimal对象,我想将其转换为字符串.问题是我的值得分,我得到一个巨大的数字(长度),我只需要字符串中的原始数字,例如:for
BigDecimal bd = new BigDecimal(10.0001)
System.out.println(bd.toString());
System.out.println(bd.toPlainString());
Run Code Online (Sandbox Code Playgroud)
输出是:
10.000099999999999766941982670687139034271240234375
10.000099999999999766941982670687139034271240234375
Run Code Online (Sandbox Code Playgroud)
我需要输出正好是10.0001字符串中的数字
我在r.conf中激活了ROutputErrors,它可以正常工作.
当我有错误时,我得到了这个:
Oops!!! rApache has something to tell you. View source and read the
HTML comments at the end.
Run Code Online (Sandbox Code Playgroud)
在源代码中我得到了错误.
\n<!--\nError in library(micEconAids) : there is no package called
'micEconAids'\nTraceback:\n5: stop(txt, domain = NA)\n4:
library(micEconAids)\n3: eval(expr, envir, enclos)\n2: eval(i, envir)
\n1: sys.source(file = \"\/var\/www\/r\/test\/25.R\", envir = .rAenv)
\n-->\n
Run Code Online (Sandbox Code Playgroud)
我正在尝试构建一个Web服务,我想直接得到错误.我想在r.conf中这样做
RApacheOutputErrors(TRUE,"<p>","</p>")
Run Code Online (Sandbox Code Playgroud)
但我在重启时遇到此错误:
"Invalid command
'RApacheOutputErrors(TRUE,"<p>","</p>")', perhaps misspelled or
defined by a module not included in the server configuration";
Run Code Online (Sandbox Code Playgroud)
我如何以及在何处使用此指令?
谢谢
我已成功在我的计算机上安装了Apache Juddi v3安装程序(tomcat版本).我现在想要的是发布一个找到WSDL的服务
http://localhost:8080/axis2/services/CmmdcService/wsdl
Run Code Online (Sandbox Code Playgroud)
为此,我创建了一个独立的Java应用程序(从Juddi文档开始),它发布了在上述位置找到的服务.
发布部分看起来没问题,但后来我想查询juddi数据库中的服务,但是应该包含找到的服务的字段总是null(getServiceInfos()).我真的不知道出了什么问题,我没有在互联网上找到任何关于此的好文档或教程.
在这里您可以找到该计划的来源.只需将其归档并转到该./publish文件夹即可.该应用程序在那里找到.
我检查的源代码Object级的,我发现其中的方法声明getClass()为
public final native Class<?> getClass();
Run Code Online (Sandbox Code Playgroud)
而声明hashCode()是
public native int hashCode();
Run Code Online (Sandbox Code Playgroud)
为什么这两个方法native在类中有哪些方法?如何获取这些方法的源代码?
我在Java中使用以下函数将加密的String转换为十六进制格式:
public static String toHex(byte [] buf) {
StringBuffer strbuf = new StringBuffer(buf.length * 2);
int i;
for (i = 0; i < buf.length; i++) {
if (((int) buf[i] & 0xff) < 0x10) {
strbuf.append("0");
}
strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
}
return strbuf.toString();
}
Run Code Online (Sandbox Code Playgroud)
现在我想将该十六进制字符串转换回字节数组.我怎样才能做到这一点?
例如,
(1) Plain Text = 123
(2) Encrypted Text = «h>kq*«¬Mí“~èåZ \}?
(3) Encrypted Text in Hex = f263575e7b00a977a8e9a37e08b9c215feb9bfb2f992b2b8f11e
Run Code Online (Sandbox Code Playgroud)
我可以去(2)到(3),但我怎么走的时候(3)回(2)?
我正在使用hibernate 3.6.7从我的类到oracle表进行映射.我通常不会得到这个例外:
org.hibernate.HibernateException: Unable to access lob stream
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at com.mycompany.TransferFiles.TransferFilesToHadoop(TransferFiles.java:85)
at com.mycompany.TransferJob.execute(TransferJob.java:25)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.hibernate.HibernateException: Unable to access lob stream
at org.hibernate.type.descriptor.java.ClobTypeDescriptor.unwrap(ClobTypeDescriptor.java:117)
at org.hibernate.type.descriptor.java.ClobTypeDescriptor.unwrap(ClobTypeDescriptor.java:46)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$3$1.doBind(ClobTypeDescriptor.java:83)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:283)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:278)
at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:89)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2558)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2494)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2821)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:113)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at com.mycompany.HibernateUtil.getSession(HibernateUtil.java:36)
at com.mycompany.BasicDaoImpl.saveOrUpdate(BasicDaoImpl.java:34)
at com.mycompany.FileCopyRoutine.call(TransferFiles.java:297)
at com.mycompany..FileCopyRoutine.call(TransferFiles.java:225)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) …Run Code Online (Sandbox Code Playgroud) 我有一个工作搜索小部件,并希望添加搜索历史建议.我遵循Android教程(http://developer.android.com/guide/topics/search/adding-recent-query-suggestions.html),虽然搜索仍然有效,但没有显示任何建议.这是我的代码:
内容提供商
package com.mypackage;
import android.content.SearchRecentSuggestionsProvider;
public class SearchHistoryProvider extends SearchRecentSuggestionsProvider {
public final static String AUTHORITY = SearchHistoryProvider.class.getName();
public final static int MODE = DATABASE_MODE_QUERIES;
public SearchHistoryProvider() {
setupSuggestions(AUTHORITY, MODE);
}
}
Run Code Online (Sandbox Code Playgroud)在Manifest中声明提供程序
<provider
android:name=".SearchHistoryProvider"
android:authorities="com.mypackage.SearchHistoryProvider">
</provider>
Run Code Online (Sandbox Code Playgroud)可搜索的配置
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:searchSuggestAuthority="com.mypackage.SearchHistoryProvider"
android:searchSuggestSelection=" ?">
</searchable>
Run Code Online (Sandbox Code Playgroud)将查询保存到内容提供程序(在我的可搜索活动中)
private void handleIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
SearchHistoryProvider.AUTHORITY, SearchHistoryProvider.MODE);
suggestions.saveRecentQuery(query, null);
// Collapse the search view …Run Code Online (Sandbox Code Playgroud)假设我有以下类结构:
class Base {}
class A extends Base {}
class B extends Base {}
class C extends Base {}
Run Code Online (Sandbox Code Playgroud)
我想编写方法,接受A和B的实例,但不接受C的实例.
我可以用Java实现吗?
我知道这不是很好的继承情况(A和B应该有不同于C的共同父级),但我只是好奇用Java方式来处理这样的情况.
编辑:
!!!
我知道更好的继承会解决问题.我只是很好奇,如果Java有一些标准的机制来解决这样的问题.
!