为什么solr add documentserver.add的时候会出错

HttpSolrServer
HttpSolrServer使用HTTPClient 和solr服务器进行通信。
  String url = "http://localhost:8080/solr";
  SolrServer server = new HttpSolrServer(url);
HttpSolrServer&是线程安全的,建议重复使用HttpSolrServer 实例。
HttpSorlrServer 允许设置链接属性
String url = "http://localhost:8080/solr"
HttpSolrServer server = new HttpSolrServer( url );
server.setSoTimeout(1000);
// socket read timeout
server.setConnectionTimeout(100);
server.setDefaultMaxConnectionsPerHost(100);
server.setMaxTotalConnections(100);
server.setFollowRedirects(false);
// defaults to false
// allowCompression defaults to false.
// Server side must support gzip or deflate for this to have any effect.
server.setAllowCompression(true);
server.setMaxRetries(1); // defaults to 0.
& 1 not recommended.
EmbeddedSorrServer提供和HttpSorlrServer相同的接口,它不需要http连接
//注意,下面的属性也是可以在jvm参数里面设置的
System.setProperty("solr.solr.home", "/home/shalinsmangar/work/oss/branch-1.3/example/solr");
CoreContainer.Initializer initializer = new CoreContainer.Initializer();
CoreContainer coreContainer = initializer.initialize();
EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "");
如果你想要使用 Multicore 特性,那么你可以这样使用:
  File home = new File( getSolrHome() );
File f = new File( home, "solr.xml" );
multicore.load( getSolrHome(), f );
EmbeddedSolrServer server = new EmbeddedSolrServer( multicore, "core name as defined in solr.xml" );
如果你在你的项目中内嵌solr服务,这将是一个不错的选择。无论你能否使用http,它都提供相同的接口
&&& solrj 被设计成一个可扩展的框架,用以向solr服务器提交请求,并接收回应。
&&& 我们已经将最通用的一些命令封装在了solrServer类中了。
Adding Data to Solr添加DOC到Solr索引
&&&&首先需要获得一个server的实例,&
SolrServer server = getSolrServer();
  如果,你使用的是一个远程的solrServer的话呢,你或许会这样来实现getSolrServer()这个方法:
public SolrServer getSolrServer(){
  return new HttpSolrServer(url);
  如果,你使用的是一个本地的solrServer的话,你或许会这样来实现getSolrServer()方法:
public SolrServer getSolrServer(){
//the instance can be reused
return new EmbeddedSolrServer();
  如果,你在添加数据之前,想清空现有的索引,那么你可以这么做:
server.deleteByQuery( "*:*" );// delete everything!
  构造一个document
SolrInputDocument doc1 = new SolrInputDocument();
doc1.addField( "id", "id1", 1.0f );
doc1.addField( "name", "doc1", 1.0f );
doc1.addField( "price", 10 );
  构造另外一个文档,每个文档都能够被独自地提交给solr,但是,批量提交是更高效的。每一个对SolrServer的请求都是http请求,当然对于EmbeddedSolrServer来说,是不一样的。
SolrInputDocument doc2 = new SolrInputDocument();
doc2.addField( "id", "id2", 1.0f );
doc2.addField( "name", "doc2", 1.0f );
doc2.addField( "price", 20 );
  构造一个文档的集合
Collection&SolrInputDocument& docs = new
ArrayList&SolrInputDocument&();
docs.add( doc1 );
docs.add( doc2 );
  将documents提交给solr
  server.add( docs );
  提交一个commit
  mit();
在添加完documents后,立即做一个commit,你可以这样来写你的程序:
UpdateRequest req = new UpdateRequest();
req.setAction( MIT, false, false );
req.add( docs );
UpdateResponse rsp = req.process( server );
Directly adding POJOs to Solr
使用 java 注释创建java bean。@Field&,可以被用在域上,或者是setter方法上。如果一个域的名称跟bean的名称是不一样的,那么在java注释中填写别名,具体的,可以参照下面的域categories&
import org.apache.solr.client.solrj.beans.F
public class Item {
@Field("cat")
List&String&
java注释也可以使用在setter方法上,如下面的例子:
@Field("cat")
public void setCategory(String[] c){
this.categories =
创建bean实例
Item item = new Item();
item.id = "one";
item.categories =
new String[] { "aaa", "bbb", "ccc" };
添加给Solr
server.addBean(item);
将多个bean提交给solr
List&Item&
//add Item objects to the list
server.addBeans(beans);
注意: 你可以重复使用SolrServer,这样可以提高性能。
Reading Data from Solr搜索
获取solrserver的实例
SolrServer server = getSolrServer();
构造 SolrQuery
SolrQuery query = new SolrQuery();
query.setQuery( "*:*" );
query.addSortField( "price", SolrQuery.ORDER.asc );
向服务器发出查询请求
QueryResponse rsp = server.query( query );
获取结果。
SolrDocumentList docs = rsp.getResults();
想要以javabean的方式获取结果,那么这个javabean必须像之前的例子一样有java注释
List&Item& beans = rsp.getBeans(Item.class);
&&&&&& solrJ 提供了一组API,来帮助我们创建查询,下面是一个faceted query的例子。
SolrServer server = getSolrServer();
SolrQuery solrQuery = new
SolrQuery().
setQuery("ipod").
setFacet(true).
setFacetMinCount(1).
setFacetLimit(8).
addFacetField("category").
addFacetField("inStock");
QueryResponse rsp = server.query(solrQuery);
所有的 setter/add 方法都是返回它自己本身的实例,所以就像你所看到的一样,上面的用法是链式的
阅读(...) 评论()solr添加文档非常方便,不用像Lucene那样一个一个添加Field,省去了很多的麻烦下面看操作
private static String URI = "http://localhost:8080/solr/";
private CommonsHttpSolrServer httpSolrServer = null;
public void init() {
httpSolrServer = new CommonsHttpSolrServer(URI);
} catch (MalformedURLException e) {
e.printStackTrace();
public void test1() {
SolrInputDocument document = new SolrInputDocument();
document.addField("id", "1");
document.addField("news_title", "这是我的第一个solr程序");
document.addField("news_content", "希望能够运行起来");
httpSolrServer.add(document);
} catch (SolrServerException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Note:id为唯一,不可重复,如果重复,solr会自动将索引中id相同的元素更新为现在的属性域的名称可以在schema.xml的Field中设置,默认的有很多Field,我们也可以使用默认的
&field name="news_title" type="textComplex" indexed="true" stored="true" /&
&field name="news_content" type="textComplex" indexed="true" sotred="true" /&
方法2:直接添加对象
2.1 定义对象
1 package com.solr.
3 import org.apache.solr.client.solrj.beans.F
5 public class News {
public News(){}
public News(String id, String title, String content) {
this.title =
this.content =
public String getId() {
public void setId(String id) {
public String getTitle() {
@Field("news_title")
public void setTitle(String title) {
this.title =
public String getContent() {
@Field("news_content")
public void setContent(String content) {
this.content =
2.2 添加对象到索引
public void test2() {
List&News& list = new ArrayList&News&();
News news1 = new News("2", "title2", "content2");
list.add(news1);
News news2 = new News("3", "title3", "content3");
list.add(news2);
httpSolrServer.addBeans(list);
} catch (SolrServerException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Note:如果对象的某个域里面的属性为数组,我们需要在schema.xml的Field中设置&multiValued="true"
阅读(...) 评论()Solr版本:Solr 4.2.1
Weblgoic版本:Weblogic 10.3.6
Weblgoic安装部署时出现如下错误:weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND problem: cvc-complex-type.2.4a: Expected elements 'mapped-name@&injection-target@' instead of 'env-entry-type@' here in element env-entry@&null&
此问题是由于web.xml中的&env-entry&引起的,如下:
/put/your/solr/home/here
java.lang.String
解决方法,将&env-entry-type&移到&env-entry-value&之前,如下:
java.lang.String
/put/your/solr/home/here
报找不到方法:java.lang.NoSuchMethodError: mons.lang.StringUtils.replaceEach(Ljava.lang.S[Ljava.lang.S[Ljava.lang.S)Ljava.lang.S
解决方法,修改WEB-INF/weblgoic.xml文件,加入&prefer-web-inf-classes&true&/prefer-web-inf-classes&配置,如下:
&weblogic-web-app
xmlns="/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/ns/weblogic/90 /ns/weblogic/90/weblogic-web-app.xsd"&
Solr 应用启用时控制台不停的打印以下信息: 15:51:09 org.apache.zookeeper.ClientCnxn$SendThread run警告: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnectjava.lang.IllegalArgumentException: No Configuration was registered that can handle the configuration named Clientat mon.security.jdkutils.JAASConfiguration.getAppConfigurationEntry(JAASConfiguration.java:130)at org.apache.zookeeper.client.ZooKeeperSaslClient.&init&(ZooKeeperSaslClient.java:97)at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:943)at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:993)
解决方法,是修改源码org.apache.zookeeper.client.ZooKeeperSaslClient.java,并编译成class文件放到zookeeper-3.4.5.jar包相应的目录下覆盖之前的class文件,将修改后的包覆盖掉WEB-INF/lib下的zookeerper-3.4.5.jar包;详见以下修改后的源码(搜索 by duanbo 为修改的地方):
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.
See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.
The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
package org.apache.zookeeper.
import org.apache.zookeeper.AsyncC
import org.apache.zookeeper.ClientC
import org.apache.zookeeper.L
import org.apache.zookeeper.Watcher.Event.KeeperS
import org.apache.zookeeper.ZooD
import org.apache.zookeeper.E
import org.apache.zookeeper.data.S
import org.apache.zookeeper.proto.GetSASLR
import org.apache.zookeeper.proto.SetSASLR
import org.apache.zookeeper.server.auth.KerberosN
import org.slf4j.L
import org.slf4j.LoggerF
import java.io.IOE
import java.security.P
import java.security.PrivilegedActionE
import java.security.PrivilegedExceptionA
import javax.security.auth.S
import javax.security.auth.callback.C
import javax.security.auth.callback.CallbackH
import javax.security.auth.callback.NameC
import javax.security.auth.callback.PasswordC
import javax.security.auth.callback.UnsupportedCallbackE
import javax.security.auth.login.AppConfigurationE
import javax.security.auth.login.C
import javax.security.auth.login.LoginE
import javax.security.sasl.AuthorizeC
import javax.security.sasl.RealmC
import javax.security.sasl.S
import javax.security.sasl.SaslC
import javax.security.sasl.SaslE
* This class manages SASL authentication for the client. It
* allows ClientCnxn to authenticate using SASL with a Zookeeper server.
public class ZooKeeperSaslClient {
public static final String LOGIN_CONTEXT_NAME_KEY = "zookeeper.sasl.clientconfig";
private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperSaslClient.class);
private static Login login = null;
private SaslClient saslC
private byte[] saslToken = new byte[0];
public enum SaslState {
INITIAL,INTERMEDIATE,COMPLETE,FAILED
private SaslState saslState = SaslState.INITIAL;
private boolean gotLastPacket = false;
/** informational message indicating the current configuration status */
private final String configS
public SaslState getSaslState() {
return saslS
public String getLoginContext() {
if (login != null)
return login.getLoginContextName();
return null;
public ZooKeeperSaslClient(final String serverPrincipal)
throws LoginException {
* ZOOKEEPER-1373: allow system property to specify the JAAS
* configuration section that the zookeeper client should use.
* Default to "Client".
String clientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client");
AppConfigurationEntry entries[] = null;
// delete by duanbo
RuntimeException securityException = null;
entries = Configuration.getConfiguration().getAppConfigurationEntry(clientSection);
} catch (/*SecurityException*/RuntimeException e) {
the user doesn't intend to use JAAS authentication.
securityException =
if (entries != null) {
this.configStatus = "Will attempt to SASL-authenticate using Login Context section '" + clientSection + "'";
this.saslClient = createSaslClient(serverPrincipal, clientSection);
: it might simply because the client does not intend to
saslState = SaslState.FAILED;
String explicitClientSection = System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY);
if (explicitClientSection != null) {
Login Context, they probably expected SASL to
we got here, SASL failed.
if (securityException != null) {
throw new LoginException("Zookeeper client cannot authenticate using the " + explicitClientSection +
" section of the supplied JAAS configuration: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
"SecurityException: " + securityException);
throw new LoginException("Client cannot SASL-authenticate because the specified JAAS configuration " +
"section '" + explicitClientSection + "' could not be found.");
context. It might be that they just don't intend to use SASL,
String msg = "Will not attempt to authenticate using SASL ";
if (securityException != null) {
msg += "(" + securityException.getLocalizedMessage() + ")";
msg += "(unknown error)";
this.configStatus =
if (System.getProperty(Environment.JAAS_CONF_KEY)
!= null) {
if (securityException != null) {
throw new LoginException("Zookeeper client cannot authenticate using the '" +
System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
"' section of the supplied JAAS configuration: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "' because of a " +
"SecurityException: " + securityException);
throw new LoginException("No JAAS configuration section named '" +
System.getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY, "Client") +
"' was found in specified JAAS configuration file: '" +
System.getProperty(Environment.JAAS_CONF_KEY) + "'.");
* @return informational message indicating the current configuration status.
public String getConfigStatus() {
return configS
public boolean isComplete() {
return (saslState == PLETE);
public boolean isFailed() {
return (saslState == SaslState.FAILED);
public static class ServerSaslResponseCallback implements AsyncCallback.DataCallback {
public void processResult(int rc, String path, Object ctx, byte data[], Stat stat) {
object's respondToServer() method
ZooKeeperSaslClient client = ((ClientCnxn)ctx).zooKeeperSaslC
if (client == null) {
LOG.warn("sasl client was unexpectedly null: cannot respond to Zookeeper server.");
byte[] usedata =
if (data != null) {
LOG.debug("ServerSaslResponseCallback(): saslToken server response: (length="+usedata.length+")");
usedata = new byte[0];
LOG.debug("ServerSaslResponseCallback(): using empty data[] as server response (length="+usedata.length+")");
client.respondToServer(usedata, (ClientCnxn)ctx);
synchronized private SaslClient createSaslClient(final String servicePrincipal,
final String loginContext) throws LoginException {
if (login == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("JAAS loginContext is: " + loginContext);
: it's shared amongst all zookeeper-related connections.
so that login is initialized only once.
login = new Login(loginContext, new ClientCallbackHandler(null));
login.startThreadIfNeeded();
Subject subject = login.getSubject();
SaslClient saslC
empty, use DIGEST-MD5; otherwise, use GSSAPI.
if (subject.getPrincipals().isEmpty()) {
("Client will use DIGEST-MD5 as SASL mechanism.");
String[] mechs = {"DIGEST-MD5"};
String username = (String)(subject.getPublicCredentials().toArray()[0]);
String password = (String)(subject.getPrivateCredentials().toArray()[0]);
is a hard-wired 'domain' parameter shared with zookeeper server code (see ServerCnxnFactory.java)
saslClient = Sasl.createSaslClient(mechs, username, "zookeeper", "zk-sasl-md5", null, new ClientCallbackHandler(password));
return saslC
final Object[] principals = subject.getPrincipals().toArray();
final Principal clientPrincipal = (Principal)principals[0];
final KerberosName clientKerberosName = new KerberosName(clientPrincipal.getName());
unless the system property
String serverRealm = System.getProperty("zookeeper.server.realm",clientKerberosName.getRealm());
KerberosName serviceKerberosName = new KerberosName(servicePrincipal+"@"+serverRealm);
final String serviceName = serviceKerberosName.getServiceName();
final String serviceHostname = serviceKerberosName.getHostName();
final String clientPrincipalName = clientKerberosName.toString();
saslClient = Subject.doAs(subject,new PrivilegedExceptionAction&SaslClient&() {
public SaslClient run() throws SaslException {
("Client will use GSSAPI as SASL mechanism.");
String[] mechs = {"GSSAPI"};
LOG.debug("creating sasl client: client="+clientPrincipalName+";service="+serviceName+";serviceHostname="+serviceHostname);
SaslClient saslClient = Sasl.createSaslClient(mechs,clientPrincipalName,serviceName,serviceHostname,null,new ClientCallbackHandler(null));
return saslC
return saslC
catch (Exception e) {
LOG.error("Error creating SASL client:" + e);
e.printStackTrace();
return null;
} catch (LoginException e) {
LoginExceptions...
} catch (Exception e) {
LOG.error("Exception while trying to create SASL client: " + e);
return null;
public void respondToServer(byte[] serverToken, ClientCnxn cnxn) {
if (saslClient == null) {
LOG.error("saslClient is unexpectedly null. Cannot respond to server's SASL ignoring.");
if (!(saslClient.isComplete())) {
saslToken = createSaslToken(serverToken);
if (saslToken != null) {
sendSaslPacket(saslToken, cnxn);
} catch (SaslException e) {
LOG.error("SASL authentication failed using login context '" +
this.getLoginContext() + "'.");
saslState = SaslState.FAILED;
gotLastPacket = true;
if (saslClient.isComplete()) {
packet after authentication succeeds
if ((serverToken == null) && (saslClient.getMechanismName() == "GSSAPI"))
gotLastPacket = true;
packet from server.
if (saslClient.getMechanismName() != "GSSAPI") {
gotLastPacket = true;
authentication to complete in
cnxn.enableWrite();
private byte[] createSaslToken() throws SaslException {
saslState = SaslState.INTERMEDIATE;
return createSaslToken(saslToken);
private byte[] createSaslToken(final byte[] saslToken) throws SaslException {
if (saslToken == null) {
saslState = SaslState.FAILED;
throw new SaslException("Error in authenticating with a Zookeeper Quorum member: the quorum member's saslToken is null.");
Subject subject = login.getSubject();
if (subject != null) {
synchronized(login) {
final byte[] retval =
Subject.doAs(subject, new PrivilegedExceptionAction&byte[]&() {
public byte[] run() throws SaslException {
LOG.debug("saslClient.evaluateChallenge(len="+saslToken.length+")");
return saslClient.evaluateChallenge(saslToken);
catch (PrivilegedActionException e) {
String error = "An error: (" + e + ") occurred when evaluating Zookeeper Quorum Member's " +
" received SASL token.";
GSS information.
final String UNKNOWN_SERVER_ERROR_TEXT =
"(Mechanism level: Server not found in Kerberos database (7) - UNKNOWN_SERVER)";
if (e.toString().indexOf(UNKNOWN_SERVER_ERROR_TEXT) & -1) {
error += " This may be caused by Java's being unable to resolve the Zookeeper Quorum Member's" +
" hostname correctly. You may want to try to adding" +
" '-Dsun.net.spi.nameservice.provider.1=dns,sun' to your client's JVMFLAGS environment.";
error += " Zookeeper Client will go to AUTH_FAILED state.";
LOG.error(error);
saslState = SaslState.FAILED;
throw new SaslException(error);
throw new SaslException("Cannot make SASL token without subject defined. " +
"For diagnosis, please look for WARNs and ERRORs in your log related to the Login class.");
private void sendSaslPacket(byte[] saslToken, ClientCnxn cnxn)
throws SaslException{
if (LOG.isDebugEnabled()) {
LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
GetSASLRequest request = new GetSASLRequest();
request.setToken(saslToken);
SetSASLResponse response = new SetSASLResponse();
ServerSaslResponseCallback cb = new ServerSaslResponseCallback();
cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
} catch (IOException e) {
throw new SaslException("Failed to send SASL packet to server.",
private void sendSaslPacket(ClientCnxn cnxn) throws SaslException {
if (LOG.isDebugEnabled()) {
LOG.debug("ClientCnxn:sendSaslPacket:length="+saslToken.length);
GetSASLRequest request = new GetSASLRequest();
request.setToken(createSaslToken());
SetSASLResponse response = new SetSASLResponse();
ServerSaslResponseCallback cb = new ServerSaslResponseCallback();
cnxn.sendPacket(request,response,cb, ZooDefs.OpCode.sasl);
} catch (IOException e) {
throw new SaslException("Failed to send SASL packet to server due " +
"to IOException:", e);
not ready yet. Sets saslState to COMPLETE as a side-effect.
public KeeperState getKeeperState() {
if (saslClient != null) {
if (saslState == SaslState.FAILED) {
return KeeperState.AuthF
if (saslClient.isComplete()) {
if (saslState == SaslState.INTERMEDIATE) {
saslState = PLETE;
return KeeperState.SaslA
return null;
public void initialize(ClientCnxn cnxn) throws SaslException {
if (saslClient == null) {
saslState = SaslState.FAILED;
throw new SaslException("saslClient failed to initialize properly: it's null.");
if (saslState == SaslState.INITIAL) {
if (saslClient.hasInitialResponse()) {
sendSaslPacket(cnxn);
byte[] emptyToken = new byte[0];
sendSaslPacket(emptyToken, cnxn);
saslState = SaslState.INTERMEDIATE;
here refers to
public static class ClientCallbackHandler implements CallbackHandler {
private String password = null;
public ClientCallbackHandler(String password) {
this.password =
public void handle(Callback[] callbacks) throws
UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback) {
NameCallback nc = (NameCallback)
nc.setName(nc.getDefaultName());
if (callback instanceof PasswordCallback) {
PasswordCallback pc = (PasswordCallback)
if (password != null) {
pc.setPassword(this.password.toCharArray());
LOG.warn("Could not login: the client is being asked for a password, but the Zookeeper" +
" client code does not currently support obtaining a password from the user." +
" Make sure that the client is configured to use a ticket cache (using" +
" the JAAS configuration setting 'useTicketCache=true)' and restart the client. If" +
" you still get this message after that, the TGT in the ticket cache has expired and must" +
" be manually refreshed. To do so, first determine if you are using a password or a" +
" keytab. If the former, run kinit in a Unix shell in the environment of the user who" +
" is running this Zookeeper client using the command" +
" 'kinit &princ&' (where &princ& is the name of the client's Kerberos principal)." +
" If the latter, do" +
" 'kinit -k -t &keytab& &princ&' (where &princ& is the name of the Kerberos principal, and" +
" &keytab& is the location of the keytab file). After manually refreshing your cache," +
" restart this client. If you continue to see this message after manually refreshing" +
" your cache, ensure that your KDC host's clock is in sync with this host's clock.");
if (callback instanceof RealmCallback) {
RealmCallback rc = (RealmCallback)
rc.setText(rc.getDefaultText());
if (callback instanceof AuthorizeCallback) {
AuthorizeCallback ac = (AuthorizeCallback)
String authid = ac.getAuthenticationID();
String authzid = ac.getAuthorizationID();
if (authid.equals(authzid)) {
ac.setAuthorized(true);
ac.setAuthorized(false);
if (ac.isAuthorized()) {
ac.setAuthorizedID(authzid);
throw new UnsupportedCallbackException(callback,"Unrecognized SASL ClientCallback");
public boolean clientTunneledAuthenticationInProgress() {
class to determine whether the client is
if ((System.getProperty(Environment.JAAS_CONF_KEY) != null) ||
((javax.security.auth.login.Configuration.getConfiguration() != null) &&
(javax.security.auth.login.Configuration.getConfiguration().
getAppConfigurationEntry(System.
getProperty(ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY,"Client"))
!= null))) {
it to do so.
if ((isComplete() == false) &&
(isFailed() == false)) {
return true;
if (isComplete() || isFailed()) {
if (gotLastPacket == false) {
return true;
return false;
} catch (/*SecurityException*/RuntimeException e) {
the caller does not have permission to retrieve the Configuration.
case, simply returning false is correct.
if (LOG.isDebugEnabled() == true) {
LOG.debug("Could not retrieve login configuration: " + e);
return false;
阅读(...) 评论()

我要回帖

更多关于 solr addbean 的文章

 

随机推荐