我创建了一个默认的GWT项目,尝试使用CouchDB作为我的数据库,使用简单的条目在数据库中创建文档.以前我们使用CouchDB 1.6即蒲团作为UI.现在,最近尝试使用CouchDB 2.0即Fauxton作为UI.
问题:-
无法在CouchDB 2.0中创建文档.
服务器端代码: -
public String greetServer(String input) throws IllegalArgumentException {
// Verify that the input is valid.
System.out.println(input);
Session session=new Session("192.168.1.48",5984);
Database db=session.getDatabase("testing");
Document doc=new Document();
doc.put("name", input);
db.saveDocument(doc);
return "Hello, " + input;
}
Run Code Online (Sandbox Code Playgroud)
例外:-
2017-02-22 17:23:41.147:WARN:/:qtp10750155-45: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.dbconnect.client.GreetingService.greetServer(java.lang.String) throws java.lang.IllegalArgumentException' threw an unexpected exception: net.sf.json.JSONException: JSONObject["update_seq"] is not a number.
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:416)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:605)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:333)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:303)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) …Run Code Online (Sandbox Code Playgroud) 我需要以编程方式重新创建jps工具的功能.我需要找出所有Java运行进程及其id,以便我可以附加到该进程(类似于JConsole所做的).
我认为VirtualMachine API会有所帮助,但是当我运行以下内容时没有得到预期的结果
public class ProcessList {
public static void main(String[] args){
List<VirtualMachineDescriptor> vms = VirtualMachine.list();
for(VirtualMachineDescriptor vm : vms){
System.out.println (vm.id());
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行上面的代码时,它只返回一个ID,但是当我在同一台机器上运行jps时,我会看到其他几个进程.
有没有办法使用Java api将图像文件存储在firebase中以用于Android应用程序?
我已经读过这个帖子我可以使用Java API将图像文件存储在firebase中,但仍然没有答案.我知道有一个正式的API,称为firepano这里是链接https://github.com/firebase/firepano但它是为Javascript库.
Java库是否有任何解决方案?
我使用Elasticsearch Java API创建了一个Java文件.在NetBeans中,一切正常.
但是,我开始收到以下错误:
org/elasticsearch/plugins/PluginsService.java:342:in `loadBundles': java.lang.IllegalStateException: failed to load bundle [file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-core-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/license/license-plugin-api-2.0.0.jar, file:/D:/ELK-2.0/elasticsearch-2.0.0/plugins/marvel-agent/marvel-agent-2.0.0.jar] due to jar hell
from org/elasticsearch/plugins/PluginsService.java:113:in `<init>'
from org/elasticsearch/node/Node.java:144:in `<init>'
from org/elasticsearch/node/NodeBuilder.java:145:in `build'
from spamdetection/SpamDetection.java:63:in `client'
from spamdetection/SpamDetection.java:30:in `SpammerDetector'
from java/lang/reflect/Method.java:497:in `invoke'
from spam.rb:53:in `(root)'
from spam.rb:53:in `(root)'
Caused by:
JarHell.java:120:in `parseClassPath': java.lang.IllegalStateException: Classpath should not contain empty elements! (outdated shell script from a previous version?) classpath=''
from JarHell.java:95:in `parseClassPath'
from PluginsService.java:338:in `loadBundles'
from PluginsService.java:113:in `<init>'
from Node.java:144:in `<init>'
from NodeBuilder.java:145:in `build'
from SpamDetection.java:63:in `client' …Run Code Online (Sandbox Code Playgroud) 是否有一个很好的资源来获得标准API函数的运行时间?在尝试优化程序时,这有点令人困惑.我知道Java并不是特别快速但我似乎根本找不到这方面的信息.
示例问题:如果我在文件中查找某个令牌,则使用string.contains(...)扫描每一行会更快或者引入说100行左右的行将它们放到本地字符串中它们执行包含块.
你能指出我从一个充分利用枚举的官方Java API开始上课吗?我找不到任何具体的课程.
Java API是否在其类中包含枚举?
我有两个数组
String[] ID1={"19","20","12","13","14"};
String[] ID2={"10","11","12","13","15"};
Run Code Online (Sandbox Code Playgroud)
在比较上面两个数组时,如何得到以下答案.
我想在比较上面两个数组时排除常见元素.
String[] Result={"14","15","19","20","10","11"};
Run Code Online (Sandbox Code Playgroud) 我是ELastic Search的新手.
弹性搜索中的数据在父子模型中.我想使用java api在此数据中执行搜索.
父类型包含作者详细信息,子类型包含书籍详细信息,如书名,图书出版商,图书类别.
在对子详细信息执行搜索时,我还需要获取父详细信息,反之亦然.有时搜索条件将是父类型和子类型.例如,搜索由其撰写author1和输入的书籍Fiction.
我怎么能在java中实现这个?我已经提到了弹性搜索文档,但无法获得解决方案
请帮忙
我正在使用Embedded JavaAPI来实现我的实时应用程序.当一个事务被锁定数据库时,我的另一个ajax调用抛出数据库实例已被其他进程锁定的错误.大部分时间我的电话都是只读的.所以我的问题是:Neo4J JavaAPI中是否存在任何方法,以便我可以将事务锁定为只读,以便其他请求可以从DB获取数据.
dbFactory = new GraphDatabaseFactory();
db= dbFactory.newEmbeddedDatabase(DB_PATH);
tx = db.beginTx();Run Code Online (Sandbox Code Playgroud)
所以在这个db.beginTx()我可以告诉Neo4j它是一个只读模式或类似的东西.
谢谢,
因此,在我的localmachine上使用最新版本的elasticsearch,java客户端节点,不会收到任何关于masternode的信息.并断开连接.
即使使用默认配置,我也尝试了以下代码.它仍然不起作用.
如果我使用TransportClient一切正常.
谁知道发生了什么?
Node node = nodeBuilder()
.clusterName("Scrapper")
.client(true)
.data(false)
.local(false)
.settings(
Settings.builder()
.put("path.home", ".")
.put("name", "JG")
.put("http.enabled", false)
.put("node.master", false)
.put("discovery.zen.ping.multicast.enabled", false)
.put("discovery.zen.ping.unicast.hosts", "127.0.0.1:9300")
.put("network.host", "127.0.0.1")
.put("transport.tcp.port", "9301")
)
.node();
Client client = node.client();
System.out.println("Firing Requests.");
String INDEX = "test_index";
boolean indexExists = client.admin().indices().prepareExists(INDEX).execute().actionGet().isExists();
if (!indexExists) {
client.admin().indices().prepareCreate(INDEX).execute().actionGet();
}
SearchResponse allHits = client.prepareSearch(INDEX)
.addFields("title", "category")
.setQuery(QueryBuilders.matchAllQuery())
.execute().actionGet();
System.out.println("allHits = " + allHits);
Run Code Online (Sandbox Code Playgroud)
Jan 13, 2016 12:28:50 PM org.elasticsearch.node.Node <init>
INFO: [JG] version[2.1.1], pid[33792], build[40e2c53/2015-12-15T13:05:55Z]
Jan 13, …Run Code Online (Sandbox Code Playgroud) java-api ×10
java ×9
android ×1
arrays ×1
couchdb-2.0 ×1
enums ×1
firebase ×1
gwt ×1
java-client ×1
jdk-tools ×1
jmx ×1
neo4j ×1
optimization ×1
runtime ×1
search ×1