2014-04-04 13 views
1

我正在關注this java中的一個小例子,用於測試JRadius客戶端。 但我不斷收到此錯誤:Java - 未知屬性MS-CHAP-Challenge

Exception in thread "main" net.sf.jradius.exception.UnknownAttributeException: Unknown attribute MS-CHAP-Challenge 
at net.sf.jradius.packet.attribute.AttributeFactory.newAttribute(Unknown Source) 
at net.sf.jradius.client.auth.MSCHAPv2Authenticator.processRequest(Unknown Source) 
at net.sf.jradius.client.RadiusClient.authenticate(Unknown Source) 
at lu.restena.zimbra.RestenaAuthenticator.main(RestenaAuthenticator.java:94) 

我已經和進口增加的所有罐子了。

我的代碼:

 InetAddress remoteInetAddress = InetAddress.getByName(RADIUSname); 
     RadiusClient radiusClient; 
     radiusClient = new RadiusClient(
       remoteInetAddress, // InetAddress - Address of remote RADIUS Server 
       sharedSecret); // String - Shared Secret for remote RADIUS Server 
     AttributeList attributeList; 
     attributeList = new AttributeList(); 
     attributeList.add(new Attr_UserName(username)); 
     RadiusAuthenticator auth = RadiusClient.getAuthProtocol("mschapv2"); 
     RadiusPacket request; 
     request = new AccessRequest(radiusClient, attributeList); 
     request.addAttribute(new Attr_UserPassword(password)); 
     RadiusPacket reply = radiusClient.authenticate((AccessRequest) request, auth, 5); 

的錯誤是:

RadiusPacket reply = radiusClient.authenticate((AccessRequest) request, auth, 5); 

任何人有任何想法,爲什麼? (我是JRadius的新手)(MSCHAPv2Authenticator.java

回答

1

在使用JRadius庫之前,應該像下面那樣加載JRadius詞典。

AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); 

另外,確保您已將JRadius Dictionary(jradius-dictionary-.jar)添加到您的類路徑中。