无法在 wso2 应用程序管理器中发布 XACML 策略并引发 NoSuchMethodError 异常 [英] Unable to publish XACML policy in wso2 application manager and throwing NoSuchMethodError exception

查看:16
本文介绍了无法在 wso2 应用程序管理器中发布 XACML 策略并引发 NoSuchMethodError 异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照以下链接提供的步骤在 wso2 应用程序管理器中创建策略并发布

I followed the steps provided by the below links to create a policy in the wso2 application manager and publshing

http://wso2.com/library/articles/2014/02/use-of-wso2-api-manager-to-validate-fine-grained-policy-decisions-using-xacml/

创建 XACML 策略后尝试将其发布到 PDP,得到以下错误

After created the XACML Policy trying to publish it to PDP,getting the following error

[2014-09-15 15:52:53,007] ERROR - ApplicationDispatcher Servlet.service() for servlet bridgeservlet threw exception
java.lang.NoSuchMethodError: org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceStub.publishPolicies([Ljava
g;Ljava/lang/String;ZI)V
        at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.publish(EntitlementPolicyAdminSer
        at org.apache.jsp.entitlement.publish_002dfinish_jsp._jspService(org.apache.jsp.entitlement.publish_002dfinish_jsp:133)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
        at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
        at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

我想将 XACML 策略集成到 WSO2 APIM 中.下面是我想在 wso2 api manager 中发布的 XACML 策略.

I want to integrate the XACML policies in the WSO2 APIM. And below is the XACML policy I want to publish in the wso2 api manager.

<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="TestPolicy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" Version="1.0">
 <Target>
  <AnyOf>
     <AllOf>
        <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
           <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">foo</AttributeValue>
           <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/>
        </Match>
     </AllOf>
  </AnyOf>
</Target>
<Rule Effect="Permit" RuleId="Rule-1">
  <Target>
     <AnyOf>
        <AllOf>
           <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
              <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">GET</AttributeValue>
              <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/>
           </Match>
        </AllOf>
     </AnyOf>
  </Target>
  <Condition>
     <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:any-of">
        <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/>
        <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">test</AttributeValue>
        <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"/>
     </Apply>
  </Condition>
</Rule>
<Rule Effect="Deny" RuleId="Deny-Rule"/>
</Policy>        

推荐答案

这不是 XACML 策略的错误.根据错误,它清楚地表明java.lang.NoSuchMethodError: org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceStub.publishPolicies([Ljavag;Ljava/lang/String;ZI)V

This is not an error with XACML policy. According in to the error it clearly says that java.lang.NoSuchMethodError: org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceStub.publishPolicies([Ljavag;Ljava/lang/String;ZI)V

所以这是您调用的 Web 服务 API 的问题.这意味着很可能 Web 服务 API 发生了 API 更改,并且某些组件仍在调用旧 API.由于您已将 XACML 功能安装到 API 管理器中,因此您可能安装了一些旧版本的 XACML 功能.但是请您检查系统中是否有以下jar文件的两个版本.

So this is a problem with the web service API that you calling. It means most probably there is an API change in the web service API and some component is still calling the older API. As you have installed the XACML features in to API manager, you may have installed some older version of XACML features. However Could you please check whether there are two version of following jar file in the system.

  1. 您可以进入<APIM_HOME>/repository/components/plugin目录并搜索名称.
  1. You can go to the <APIM_HOME>/repository/components/plugin directory and search for name.

org.wso2.carbon.identity.entitlement.stub

  1. 如果有两个jar文件,请删除一个jar文件(比如旧版本)

  1. If there are two jar file, please remove the one jar file (say older version)

请删除 bundle.info 文件中该 jar 文件的 OSGI 条目,该文件位于 <APIM_HOME>repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator 目录

Please remove the OSGI entry for that jar file in bundle.info file which can be found at <APIM_HOME>repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator directory

重新启动服务器并尝试您的操作.

Restart the server and try out your operation.

如果不起作用,请删除其他jar文件并添加较旧的jar文件,并记住在步骤3中提到的上述文件中添加新删除的条目

If did not work, please remove other jar file and add older jar file and also remember add new deleted entry to above file mentioned in step3

这不是解决此问题的正确方法.我想,最好的事情是,您可以通过为您正在使用的 APIM 版本找到正确的 P2 存储库来重新安装 XACML 功能.您可以从这里

This is not the correct way to resolve this. I guess, best thing, you can re-install the XACML features by finding correct P2 repo for the APIM version that you are using. You can find it from here

这篇关于无法在 wso2 应用程序管理器中发布 XACML 策略并引发 NoSuchMethodError 异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆