6 jun
2017

Which axis2 class should be used for basic authorization?

I am using axis2-1.6.2.jar, axis2-transport-local-1.6.2.jar, axis2-transport-http-1.6.2.jar and axis2-kernel-1.6.2.jar. this is my web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.4">
  <display-name>WSO2HealthWebApplication</display-name>
  <welcome-file-list>
    <welcome-file>login.html</welcome-file>
  </welcome-file-list>
  <context-param>
    <param-name>subjectScope</param-name>
    <param-value>request-param</param-value>
  </context-param>
  <context-param>
    <param-name>subjectAttributeName</param-name>
    <param-value>user</param-value>
  </context-param>
  <context-param>
    <param-name>userName</param-name>
    <param-value>admin</param-value>
  </context-param>
  <context-param>
    <param-name>password</param-name>
    <param-value>admin</param-value>
  </context-param>
  <context-param>
    <param-name>remoteServiceUrl</param-name>
    <param-value>https://localhost:9444/services/</param-value>
  </context-param>
  <servlet>
    <servlet-name>Search</servlet-name>
    <servlet-class>org.wso2.sample.QueryPatientDetailServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>Register</servlet-name>
    <servlet-class>org.wso2.sample.RegisterPatientServlet</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>EntitlementCacheUpdateServlet</servlet-name>
    <servlet-class>org.wso2.carbon.identity.entitlement.filter.EntitlementCacheUpdateServlet
        </servlet-class>
    <init-param>
      <param-name>httpsPort</param-name>
      <param-value>9453</param-value>
    </init-param>
    <init-param>
      <param-name>authentication</param-name>
      <param-value>wso2is</param-value>
    </init-param>
    <init-param>
      <param-name>authenticationPage</param-name>
      <param-value>default</param-value>
    </init-param>
    <init-param>
      <param-name>authenticationPageUrl</param-name>
      <param-value>/updateCache.html</param-value>
    </init-param>
  </servlet>
  <filter>
    <filter-name>AuthenticationFilter</filter-name>
    <filter-class>org.wso2.sample.AuthenticationFilter</filter-class>
  </filter>
  <filter>
    <filter-name>EntitlementFilter</filter-name>
    <filter-class>org.wso2.carbon.identity.entitlement.filter.EntitlementFilter</filter-class>
    <init-param>
      <param-name>client</param-name>
      <param-value>basicAuth</param-value>
    </init-param>
    <init-param>
      <param-name>cacheType</param-name>
      <param-value>simple</param-value>
    </init-param>
    <init-param>
      <param-name>maxCacheEntries</param-name>
      <param-value>1000</param-value>
    </init-param>
    <init-param>
      <param-name>invalidationInterval</param-name>
      <param-value>2000</param-value>
    </init-param>
    <init-param>
      <param-name>authRedirectUrl</param-name>
      <param-value>/login.html</param-value>
    </init-param>
    <init-param>
      <param-name>thriftHost</param-name>
      <param-value>localhost</param-value>
    </init-param>
    <init-param>
      <param-name>thriftPort</param-name>
      <param-value>10500</param-value>
    </init-param>
  </filter>
  <servlet-mapping>
    <servlet-name>Search</servlet-name>
    <url-pattern>/Search</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Register</servlet-name>
    <url-pattern>/Register</url-pattern>
  </servlet-mapping>
  <filter-mapping>
    <filter-name>AuthenticationFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>EntitlementFilter</filter-name>
    <url-pattern>/getPatientDetails.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>EntitlementFilter</filter-name>
    <url-pattern>/addPatient.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>EntitlementFilter</filter-name>
    <url-pattern>/patientInfoPage.jsp</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>EntitlementFilter</filter-name>
    <url-pattern>/updateCacheAuth.do</url-pattern>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
  <servlet-mapping>
    <servlet-name>EntitlementCacheUpdateServlet</servlet-name>
    <url-pattern>/updateCache.do</url-pattern>
  </servlet-mapping>
</web-app>

But whenever I try to authorize the users, I get the following error

ERROR {org.wso2.carbon.identity.entitlement.proxy.soap.basicAuth.BasicAuthEntitlementServiceClient} -  Error initializing default Axis2 configuration context
java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver cannot be cast to org.apache.axis2.engine.MessageReceiver
        at org.apache.axis2.deployment.DescriptionBuilder.loadMessageReceiver(DescriptionBuilder.java:192)
        at org.apache.axis2.deployment.DescriptionBuilder$1.run(DescriptionBuilder.java:145)
        at org.apache.axis2.deployment.DescriptionBuilder$1.run(DescriptionBuilder.java:142)
        at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132)
        at org.apache.axis2.deployment.DescriptionBuilder.processMessageReceivers(DescriptionBuilder.java:141)
        at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:107)
        at org.apache.axis2.context.ConfigurationContextFactory.createBasicConfigurationContext(ConfigurationContextFactory.java:343)
        at org.apache.axis2.context.ConfigurationContextFactory.createDefaultConfigurationContext(ConfigurationContextFactory.java:330)
        at org.wso2.carbon.identity.entitlement.proxy.soap.basicAuth.BasicAuthEntitlementServiceClient.initConfigurationContext(BasicAuthEntitlementServiceClient.java:96)
        at org.wso2.carbon.identity.entitlement.proxy.soap.basicAuth.BasicAuthEntitlementServiceClient.<init>(BasicAuthEntitlementServiceClient.java:81)
        at org.wso2.carbon.identity.entitlement.proxy.PEPProxyFactory.getAppToPDPClientMap(PEPProxyFactory.java:105)
        at org.wso2.carbon.identity.entitlement.proxy.PEPProxy.<init>(PEPProxy.java:55)
        at org.wso2.carbon.identity.entitlement.filter.EntitlementFilter.init(EntitlementFilter.java:156)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5542)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:344)
        at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:252)
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWebappDeployment(TomcatGenericWebappsDeployer.java:314)
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWarWebappDeployment(TomcatGenericWebappsDeployer.java:212)
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleHotDeployment(TomcatGenericWebappsDeployer.java:179)
        at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.deploy(TomcatGenericWebappsDeployer.java:144)
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deployThisWebApp(AbstractWebappDeployer.java:224)
        at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deploy(AbstractWebappDeployer.java:114)
        at org.wso2.carbon.webapp.deployer.WebappDeployer.deploy(WebappDeployer.java:42)
        at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
        at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
        at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
        at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
        at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
        at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
        at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
        at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
        at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:93)
        at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:138)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Please help. Thank you in advance

COMENTARIOS

DEJA TU COMENTARIO

© 2017 website by Rubit Corporation