Я интегрирую приложение весенней загрузки с сервером идентификации wso2 для единого входа (используя Saml). Я получаю следующее исключение:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 91 in the jsp file: /index.jsp
The method marshall(XMLObject) in the type CommonUtil is not applicable for the arguments (Response)
88: subjectId = sessionBean.getSAML2SSO().getSubjectId();
89:
90: System.out.println(":::::::::::::"+sessionBean.getSAML2SSO().getSAMLResponse().getClass());
91: samlResponse = CommonUtil.marshall(sessionBean.getSAML2SSO().getSAMLResponse());
92: samlResponse = StringEscapeUtils.escapeXml(samlResponse);
93: } else {
94:
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.trinity.app.wso2.saml.integration.SecurityCheck.doFilter(SecurityCheck.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.wso2.carbon.identity.sso.agent.SAML2SSOAgentFilter.doFilter(SAML2SSOAgentFilter.java:170)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115)
at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59)
at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Ниже приведена зависимость, которую я использую:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>TestApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>TestApp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId>
<version>4.0</version> </dependency> -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- marked the embedded servlet container as provided -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- WSo2 Integration -->
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>${opensaml.version}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- dependencies -->
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>${xmlsec.version}</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
</exclusion>
</exclusions>
<version>${xmltooling.version}</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>openws</artifactId>
<version>${openws.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.agent.sso.java</groupId>
<artifactId>org.wso2.carbon.identity.sso.agent</artifactId>
<version>${identity.agent.sso.version.range}</version>
<exclusions>
<exclusion>
<groupId>opensaml.wso2</groupId>
<artifactId>opensaml2</artifactId>
</exclusion>
<exclusion>
<groupId>commons-collections.wso2</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.orbit.joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.8.2.wso2v1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>${axiom.impl.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons-collections.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${sevlet.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.api</artifactId>
<version>${carbon.kernel.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.samples.is</groupId>
<artifactId>claim-manager</artifactId>
<version>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<start-class>com.test.controller.Application</start-class>
<!-- wso2 integration -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<opensaml.version>2.6.4</opensaml.version>
<xmlsec.version>1.4.4</xmlsec.version>
<xmltooling.version>1.3.1</xmltooling.version>
<openws.version>1.5.4</openws.version>
<identity.agent.sso.version.range>[5.0.0, 6.0.0)</identity.agent.sso.version.range>
<joda.wso2.version>2.8.2.wso2v1</joda.wso2.version>
<axiom.impl.version>1.2.12</axiom.impl.version>
<commons-collections.version>3.2.2</commons-collections.version>
<sevlet.api.version>2.5</sevlet.api.version>
<carbon.kernel.version>4.4.17</carbon.kernel.version>
<javax.servlet.api.version>3.1.0</javax.servlet.api.version>
<oauth2.client.version>1.0.0</oauth2.client.version>
<nimbusds.version>2.26.1</nimbusds.version>
<commons-codec.version>1.4.0.wso2v1</commons-codec.version>
<commons-lang.version>2.6</commons-lang.version>
<maven.surefire.plugin.version>2.18</maven.surefire.plugin.version>
<maven.clean.plugin.version>2.1</maven.clean.plugin.version>
<maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>TestApp</finalName>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>wso2-nexus</id>
<name>WSO2 Internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2.releases</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</project>
Index. jsp страница:
<%@ page
import="org.wso2.carbon.identity.sso.agent.bean.LoggedInSessionBean"%>
<%@ page
import="org.wso2.carbon.identity.sso.agent.util.SSOAgentConstants"%>
<%@ page import="com.trinity.app.wso2.saml.integration.CommonUtil"%>
<%@ page import="org.wso2.samples.claims.manager.ClaimManagerProxy"%>
<%@ page import="org.json.JSONObject"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Map"%>
<%@ page import="org.apache.commons.lang.StringEscapeUtils"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description"
content="PICKUP DISPATCH - Vehicle allocation application">
<title>SmartParking</title>
<!-- Bootstrap Material Design CSS -->
<link
href="libs/bootstrap-material-design_4.0.0/css/bootstrap-material-design.min.css"
rel="stylesheet">
<!-- Font Awesome icons -->
<link href="libs/fontawesome-5.2.0/css/fontawesome.min.css"
rel="stylesheet">
<link href="libs/fontawesome-5.2.0/css/solid.min.css" rel="stylesheet">
<!-- Golden Layout styles -->
<link href="libs/goldenlayout/css/goldenlayout-base.css"
rel="stylesheet">
<!-- Highlight styles -->
<link href="libs/highlight_9.12.0/styles/atelier-cave-light.css"
rel="stylesheet">
<!-- Custom styles -->
<link href="css/spinner.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
<link href="css/dispatch.css" rel="stylesheet">
</head>
<%
String subjectId = null;
final String SAML_SSO_URL = "samlsso";
final String SAML_LOGOUT_URL = "logout";
String samlResponse = "";
// if web-browser session is there but no session bean set,
// invalidate session and direct back to login page
JSONObject requestObject = new JSONObject();
requestObject.append("requestEndpoint", request.getRequestURI());
if (request.getSession(false) != null
&& request.getSession(false).getAttribute(SSOAgentConstants.SESSION_BEAN_NAME) == null) {
request.getSession().invalidate();
%>
<script type="text/javascript">
location.href =
<%= SAML_SSO_URL %>
;
</script>
<%
return;
}
System.out.println("testedeedede:::::::::::::");
LoggedInSessionBean sessionBean = (LoggedInSessionBean) session.getAttribute(SSOAgentConstants.SESSION_BEAN_NAME);
final Map<String, String> subjectAttributeValueMap = sessionBean.getSAML2SSO().getSubjectAttributes();
ClaimManagerProxy claimManagerProxy = (ClaimManagerProxy) application.getAttribute("claimManagerProxyInstance");
final Map<String, String> subjectAttributeDisplayValueMap =
claimManagerProxy.getLocalClaimUriDisplayValueMapping(new ArrayList<>(subjectAttributeValueMap.keySet()));
if (sessionBean != null && sessionBean.getSAML2SSO() != null) {
subjectId = sessionBean.getSAML2SSO().getSubjectId();
System.out.println("testedeedede:::::::::::::"+sessionBean.getSAML2SSO().getSAMLResponse().getClass());
samlResponse = CommonUtil.marshall(sessionBean.getSAML2SSO().getSAMLResponse());
samlResponse = StringEscapeUtils.escapeXml(samlResponse);
} else {
%>
<script type=p"text/javascript">
location.href = <%= SAML_SSO_URL %>;
</script>
<%
return;
}
%>
<body>
<% if(subjectId!=null || subjectId!=""){ %>
<script type="text/javascript">
</script>
<%
// New location to be redirected
String site = new String("http://localhost:8080/");
response.setStatus(response.SC_MOVED_TEMPORARILY);
response.setHeader("Location", site);
response.setHeader("ssoUserName", subjectId);
}else { %>
<p>
test
<%= subjectId%></p>
<script type=p"text/javascript">
location.href = <%= SAML_SSO_URL %>;
</script>
<%
return;
} %>
</body>
</html>
выше это пом. xml и индекс. jsp стр. Я хотел знать, есть ли какая-либо проблема зависимости. Используя пример самопроизвольного путешествия, я попытался использовать этот код для интеграции моего весеннего приложения с wso2 IS. До аутентификации он работает нормально, но при перенаправлении на страницу index. jsp показывает Метод marshall (XMLObject) в типе CommonUtil не применим для аргументов (Response) .