2016-01-12 95 views
1

我根據用戶指南中的說明編寫了自定義身份驗證處理程序。WSo2自定義處理程序:未找到類錯誤

我放置了我的jar/repository/components/lib並嘗試從管理控制檯 - >服務總線 - >服務視圖中添加它到特定的API,但在日誌中收到了類未找到的錯誤。

我能夠使其工作的唯一方法是將其「推送」到WSO2的部署jar(org.wso2.carbon.apimgt.gateway_5.0.3.jar)之一的解決方法。當添加到這個jar並重新啓動WSo2時,我得到了處理程序正常工作。

但我想這種解決方法不是正確的方法來做到這一點...這是一個CLASSPATH問題或我在過程中失蹤,使其工作?

+1

什麼是classnotfound錯誤?你可以發佈stacktrace嗎? – lakshman

+0

似乎你正在使用wso2 APIM。共享版本和日誌 –

回答

0

經過進一步檢查,發現我的JAR由於某種原因已經損壞。我再次構建它,現在它工作。

對於從誰試圖嘗試這個社會人的利益,我會後我也

1)JAR文件(APIM 1.10.0工作)的步驟:

$ cd /home/olahav/wso2/wso2am-1.10.0/repository/components/lib 
$ jar tf extensions.jar 
... 
org/wso2/carbon/test/OferAPIAuthenticationHandler_1.class 

2)API模板:

<handlers xmlns="http://ws.apache.org/ns/synapse"> 
<handler class="org.wso2.carbon.test.OferAPIAuthenticationHandler_1"/> 
#foreach($handler in $handlers) 
    <handler xmlns="http://ws.apache.org/ns/synapse" class="$handler.className"> 
     #if($handler.hasProperties()) 
     #set ($map = $handler.getProperties()) 
     #foreach($property in $map.entrySet()) 
     <property name="$!property.key" value="$!property.value"/> 
     #end 
     #end 
    </handler> 
    #end 
</handlers> 

3),因爲這是一個模板,需要重新創建API。然後在服務視圖檢查(通過https://localhost:9443/carbon),你可以看到處理器添加到處理程序列表:

<handlers> 
     <handler class="org.wso2.carbon.test.OferAPIAuthenticationHandler_1"/> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler"> 
      <property name="apiImplementationType" value="ENDPOINT"/> 
     </handler> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler"> 
      <property name="id" value="A"/> 
      <property name="policyKeyResource" value="gov:/apimgt/applicationdata/res-tiers.xml"/> 
      <property name="policyKey" value="gov:/apimgt/applicationdata/tiers.xml"/> 
      <property name="policyKeyApplication" value="gov:/apimgt/applicationdata/app-tiers.xml"/> 
     </handler> 
     <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/> 
     <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler"> 
      <property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/> 
     </handler> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/> 
    </handlers> 

這就是它!

感謝任何幫助過我的人。

相關問題