1. org.apache.solr.client.solrj.impl.HttpSolrServer 修改成:org.apache.solr.client.solrj.impl.HttpSolrClient 2. SolrClient solrClient = new CloudSolrClient(zkHost); new方式在新版已经被废弃,采用新版链式赋值法进行建立对象 SolrClient solrClient = new CloudSolrClient.Builder().withZkHost(Arrays.asList(zkHost.split(","))).build(); 3. solrClient = new ConcurrentUpdateSolrClient(url, queueSize, threadCount); 采用链式赋值法 solrClient = new ConcurrentUpdateSolrClient.Builder(url).withQueueSize(queueSize).withThreadCount(threadCount).build(); 4. solrClient = new HttpSolrClient(baseURL); 采用链式赋值法 solrClient = new HttpSolrClient.Builder(baseURL).build(); 5. ClusterState clusterState = zkStateReader.getClusterState(); Map<String, Slice> map = clusterState.getActiveSlicesMap(collection); api已经将getActiveSlicesMap废弃 map = clusterState.getCollection(collection).getActiveSlicesMap(); 6. List<String> collections = zkStateReader.getAllCollections(); api已经将getAllCollections()废弃掉 Map<String, DocCollection> map = zkStateReader.getClusterState().getCollectionsMap(); 7. Collection<Slice> slices = clusterState.getSlices(Collection); api已经将getSlices(collection)废弃,采用更加方便、安全的中间类DocCollection DocCollection docCollection = clusterState.getCollection(collection); Collection<Slice> slices = docCollection.getActiveSlices(); 8. CollectionAdminRequest.Create req = new CollectionAdminRequest.Create(); req.setCollectionName(name); req.setNumShards(numShards); req.setConfigName(cluster); req.setCreateNodeSet(getNodeSet(cluster)); req.setReplicationFactor(numReplicas); 修改成链式赋值法 CollectionAdminRequest.Create req = CollectionAdminRequest.createCollection(name, cluster, numShards, numReplicas); 9. CollectionAdminRequest.Delete req = new CollectionAdminRequest.Delete(); api已将这种建立方式废弃 CollectionAdminRequest.Delete req = CollectionAdminRequest.deleteCollection(name); 10. CollectionAdminRequest.CreateAlias req = new CollectionAdminRequest.CreateAlias(); api已经将这种建立方式废弃 CollectionAdminRequest.CreateAlias req = CollectionAdminRequest.createAlias(name, collections); 11. CollectionAdminRequest.DeleteAlias req = new CollectionAdminRequest.deleteAlias(); api已经将这种建立方式废弃 CollectionAdminRequest.DeleteAlias req = CollectionAdminRequest.deleteAlias(name); 12. SolrInputDocument inputDocument = ClientUtils.toSolrInputDocument(solrDocument); 将SolrDocument 转换为 SolrInputDocument 的方法从ClientUtils中移除了.从solr-5.5以后就将此方法移除,代码中要想使用此相似功能,须要本身添加方法实现 /** * 将SolrDocument转换为SolrInputDocument,原底层提供的方法从solr5.5以后被废弃掉了 * add by liangyongxing * @param solrDocument * @createTime 2017-02-21 * @return */ public static SolrInputDocument toSolrInputDocument(SolrDocument solrDocument) { SolrInputDocument doc = new SolrInputDocument(); for (String name : solrDocument.getFieldNames()) { doc.addField(name, solrDocument.getFieldValue(name)); } return doc; }
以上这个错误对于有点经验的程序员来讲都是很easy的问题,就是服务器上的jdk和我们打包程序所使用的jdk版本不一致,很明显,本地使用的是jdk1.8而服务器上的是jdk1.7,具体能够经过命令:java -version 进行查看jdk版本。那么就好办了,直接下载或者拷贝均可以,将当前环境的jdk升级为18的便可,这个是很easy的我就不在这里啰嗦了。html
spring-aop-3.2.13-RELEASE.jar、spring-beans-3.2.13-RELEASE.jar、spring-context-3.2.13-RELEASE.jar、spring-context-support-3.2.13-RELEASE.jar、spring-core-3.2.13-RELEASE.jar、spring-jdbc-3.2.13-RELEASE.jar、spring-orm-3.2.13-RELEASE.jar、spring-tx-3.2.13-RELEASE.jar、spring-web-3.2.13-RELEASE.jar等java