How to create link with PDF download? - orbeon

I have locally installed Orbeon Forms CE 2017.2.201712300816-CE and I would like to create view which will serve pdf document generated from xforms form.
All my files are in orbeon/WEB-INF/resources/apps/test/ directory.
When I go to URL http://localhost:8080/orbeon/test/ I see error message: "Orbeon Forms - Page Not Found We are sorry, but the resource you have requested is not available on this server. ".
What I'm doing wrong? How can I fix it?
My files:
page-flow.xml
<controller xmlns="http://www.orbeon.com/oxf/controller" matcher="regexp">
<page path="/test/" view="pdf.xpl"/>
<epilogue url="oxf:/config/epilogue.xpl"/>
</controller>
pdf.xpl
<!--
Copyright (C) 2011 Orbeon, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License as published by the Free Software Foundation; either version
2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<p:param type="output" name="data"/>
<!-- Prepare XForms to use noscript mode, with static appearance -->
<p:processor name="oxf:xslt">
<p:input name="config">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/>
<xsl:template match="xforms:model">
<xsl:copy>
<xsl:attribute name="xxforms:readonly-appearance">static</xsl:attribute>
<xsl:apply-templates select="#* | node()"/>
<xforms:bind nodeset="//*" readonly="true()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
</p:input>
<p:input name="data" href="pdf.xhtml"/>
<p:output name="data" id="xforms"/>
</p:processor>
<!-- Run XForms engine, which gives us XHTML -->
<p:processor name="oxf:pipeline">
<p:input name="config" href="/ops/pfc/xforms-epilogue.xpl"/>
<p:input name="data" href="#xforms"/>
<p:input name="model-data"><null xsi:nil="true"/></p:input>
<p:output name="xformed-data" id="xformed-data"/>
</p:processor>
<!-- Prepare XHTML before conversion to PDF -->
<p:processor name="oxf:xslt">
<p:input name="config">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/>
<!-- Filter out scripts as they won't be used -->
<xsl:template match="*:script"/>
<!-- Remove noscript element, to remove warning that scripts are not supported -->
<xsl:template match="*:noscript"/>
<!-- Remove xforms-initially-hidden class on the form, normally removed by the script -->
<xsl:template match="*:form">
<xsl:copy>
<xsl:attribute name="class" select="string-join(tokenize(#class, ' ')[. != 'xforms-initially-hidden'], ' ')"/>
<xsl:apply-templates select="#* except #class | node()"/>
</xsl:copy>
</xsl:template>
<!-- Remove all prefixes because Flying Saucer doesn't like them -->
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="#* | node()"/>
</xsl:element>
</xsl:template>
</xsl:transform>
</p:input>
<p:input name="data" href="#xformed-data"/>
<p:output name="data" id="xhtml-data"/>
</p:processor>
<!-- Run Flying Saucer on the XHTML to get PDF -->
<p:processor name="oxf:xhtml-to-pdf">
<p:input name="data" href="#xhtml-data"/>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>
pdf.xhtml
<?xml version="1.0"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms">
<head></head>
<body>
<div style="max-width: 900px; margin: 0 auto;">
This should be PDF.
</div>
</body>
</html>
orbeon.log
2018-08-06 21:07:43,038 INFO lifecycle - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "limiter", "message": "start: nofilter", "path": "/test/", "method": "GET"}
2018-08-06 21:07:43,039 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-prod.xml
2018-08-06 21:07:43,039 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-internal.xml
2018-08-06 21:07:43,045 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-base.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-xforms.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-form-runner.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-form-builder.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-local.xml
2018-08-06 21:07:43,047 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/properties-local-prod.xml
2018-08-06 21:07:43,047 DEBUG properties - Not reloading properties because they have not changed.
2018-08-06 21:07:43,047 DEBUG auth - using `Container` method
2018-08-06 21:07:43,047 DEBUG auth - usernameOpt: `None`, roles: `None`
2018-08-06 21:07:43,047 WARN auth - not setting credentials headers because credentials are not found
2018-08-06 21:07:43,047 INFO lifecycle - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "service", "message": "start: handle"}
2018-08-06 21:07:43,047 INFO ProcessorService - /test/ - Received request
2018-08-06 21:07:43,047 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,048 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/prologue-servlet.xpl
2018-08-06 21:07:43,048 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/aggregator.rng
2018-08-06 21:07:43,057 DEBUG ConcreteChooseProcessor - Choose: taking otherwise branch at line 25, column 40 of oxf:/config/prologue-servlet.xpl
2018-08-06 21:07:43,057 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/page-flow-controller.rng
2018-08-06 21:07:43,057 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /page-flow.xml
2018-08-06 21:07:43,057 DEBUG PageFlowControllerProcessor - processing page/service {controller: "oxf:/page-flow.xml", method: "GET", path: "/test/"}
2018-08-06 21:07:43,057 DEBUG PageFlowControllerProcessor - processing route {route: "PageOrServiceRoute(PageOrServiceElement(None,/([^/]+)/.*,/([^/]+)/.*,None,Some(apps/${1}/page-flow.xml),None,org.orbeon.dom.tree.ConcreteElement#1ea06e3 [Element: <page uri: http://www.orbeon.com/oxf/controller attributes: [org.orbeon.dom.tree.ConcreteAttribute#117b4e6 [Attribute: name path value "/([^/]+)/.*"], org.orbeon.dom.tree.ConcreteAttribute#1b83b9f [Attribute: name model value "apps/${1}/page-flow.xml"], org.orbeon.dom.tree.ConcreteAttribute#f734ae [Attribute: name public-methods value "#all"]]/>] userData: line 31, column 85 of oxf:/page-flow.xml,<function1>,<function1>,true),<function1>)"}
2018-08-06 21:07:43,058 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,058 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-xml-submission.xpl
2018-08-06 21:07:43,058 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,061 DEBUG ConcreteChooseProcessor - Choose: taking otherwise branch at null
2018-08-06 21:07:43,062 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /ops/pfc/rewrite.xsl
2018-08-06 21:07:43,062 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/url-generator-config.rng
2018-08-06 21:07:43,062 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/aggregator.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,063 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,063 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /apps/test/page-flow.xml
2018-08-06 21:07:43,070 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,070 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,076 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,076 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/page-flow-controller.rng
2018-08-06 21:07:43,078 DEBUG PageFlowControllerProcessor - processing page/service {controller: "oxf:/apps/test/page-flow.xml", method: "GET", path: "/test/"}
2018-08-06 21:07:43,078 DEBUG PageFlowControllerProcessor - processing route {route: "PageOrServiceRoute(PageOrServiceElement(None,/test/,/test/,None,None,Some(pdf.xpl),org.orbeon.dom.tree.ConcreteElement#1bf3914 [Element: <page uri: http://www.orbeon.com/oxf/controller attributes: [org.orbeon.dom.tree.ConcreteAttribute#876b67 [Attribute: name path value "/test/"], org.orbeon.dom.tree.ConcreteAttribute#48c89c [Attribute: name view value "pdf.xpl"]]/>] userData: line 2, column 41 of oxf:/apps/test/page-flow.xml,<function1>,Set(GET, HEAD),true),<function1>)"}
2018-08-06 21:07:43,078 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,078 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-xml-submission.xpl
2018-08-06 21:07:43,084 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,089 DEBUG ConcreteChooseProcessor - Choose: taking when branch with test: /step-type = 'view' at null
2018-08-06 21:07:43,089 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/url-generator-config.rng
2018-08-06 21:07:43,089 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,089 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,089 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /apps/test/pdf.xpl
2018-08-06 21:07:43,112 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,113 DEBUG URLGenerator - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences#19489e
2018-08-06 21:07:43,113 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,114 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,114 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-epilogue.xpl
2018-08-06 21:07:43,115 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,115 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,115 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /apps/test/pdf.xhtml
2018-08-06 21:07:43,121 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /oxf/xslt/utils/copy.xsl
2018-08-06 21:07:43,122 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/processor/serializer/legacy-serializer-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /oxf/xslt/utils/copy.xsl
2018-08-06 21:07:43,122 DEBUG ConcreteChooseProcessor - Choose: taking when branch with test: not(/*/#xsi:nil = 'true') at null
2018-08-06 21:07:43,122 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,123 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/epilogue.xpl
2018-08-06 21:07:43,123 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,125 DEBUG ConcreteChooseProcessor - Choose: taking when branch with test: /request/container-type = 'servlet' at line 57, column 31 of oxf:/config/epilogue.xpl
2018-08-06 21:07:43,125 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,125 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /config/epilogue-servlet.xpl
2018-08-06 21:07:43,139 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,139 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-epilogue.xpl
2018-08-06 21:07:43,141 DEBUG ConcreteChooseProcessor - Choose: taking when branch with test: /document[#xsi:type] at line 52, column 36 of oxf:/config/epilogue-servlet.xpl
2018-08-06 21:07:43,141 DEBUG URLGenerator - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/processor/serializer/http-serializer-config.rng
2018-08-06 21:07:43,143 INFO ProcessorService - /test/ - Timing: 96
2018-08-06 21:07:43,146 INFO lifecycle - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "service", "message": "end: handle", "time": "96 ms"}
2018-08-06 21:07:43,146 INFO lifecycle - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "limiter", "message": "end: nofilter", "time": "108 ms"}

Related

Spring Authorization Server 1.0 sample federated-identity-authorizationserver gives invalid_token_response

I am trying out federated-identity-authorizationserver sample given in sample.
I updated the yml files as required.
I was able to start auth server and resource server.
While starting client I got provider issuer error which I resolved by updating client yml as below
provider:
spring:
authorization-uri: http://localhost:9000/oauth2/authorize
token-uri: http://localhost:9000/oauth2/token
#issuer-uri: http://localhost:9000
I am able to start the messaging client and able to perform authentication with google but getting below error. I am getting same error if I try it with local auth server using user1/password credentials.
{"exception":"[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] and content type [text/html;charset=utf-8]","timestamp":1674192821362}
To get the error I added failureHandler as below otherwise I was getting too many redirects error.
#Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests(authorize ->
authorize.anyRequest().authenticated()
)
.oauth2Login(oauth2Login ->
oauth2Login.loginPage("/oauth2/authorization/messaging-client-oidc").successHandler(new LoginSuccessHandler()).failureHandler(new CustomAuthenticationFailureHandler()))
.oauth2Client(withDefaults());
return http.build();
I also tried adding accessTokenResponseClient as below but error remains same and the accessTokenResponseClient to the client config but it is not getting invoked. I have authorizationCodeTokenResponseClient() and other relevant classes.
.oauth2Login(oauth2Login ->
oauth2Login
.tokenEndpoint(tokenEndpoint ->
tokenEndpoint
.accessTokenResponseClient(authorizationCodeTokenResponseClient()))
.loginPage("/oauth2/authorization/messaging-client-oidc").successHandler(new LoginSuccessHandler()).failureHandler(new CustomAuthenticationFailureHandler()))
.oauth2Client(withDefaults());
I am getting above error when I try with local auth server and Google as a federated auth server.
The debug trace from client just before the error. the code is matching the federated server code
2023-01-24T22:24:59.078+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler [classpath [META-INF/resources/], classpath [resources/], classpath [static/], classpath [public/], ServletContext [/]]
2023-01-24T22:24:59.079+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.security.web.FilterChainProxy : Securing GET /login/oauth2/code/messaging-client-oidc?code=DxWgpwZqmepYInMZ0lBZrboaEVULZYep8r2I9Kz6MM9rY-2O2Bg1wSMiKPhwMM2U2Uf9bvd2N9pMFXbB7mCKw4GlDULdgNSADjHOzXQxdEGRNPtRVBU7i6OKfkxCtB7i&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D
2023-01-24T22:24:59.092+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.web.client.RestTemplate : HTTP POST http://localhost:9000/oauth2/token
2023-01-24T22:24:59.095+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.web.client.RestTemplate : Accept=[application/json, application/*+json]
2023-01-24T22:24:59.096+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.web.client.RestTemplate : Writing [{grant_type=[authorization_code], code=[DxWgpwZqmepYInMZ0lBZrboaEVULZYep8r2I9Kz6MM9rY-2O2Bg1wSMiKPhwMM2U2Uf9bvd2N9pMFXbB7mCKw4GlDULdgNSADjHOzXQxdEGRNPtRVBU7i6OKfkxCtB7i], redirect_uri=[http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2023-01-24T22:24:59.276+05:30 DEBUG 96239 --- [nio-8080-exec-5] o.s.web.client.RestTemplate : Response 200 OK
2023-01-24T22:24:59.284+05:30 DEBUG 96239 --- [nio-8080-exec-5] .s.a.DefaultAuthenticationEventPublisher : No event was found for the exception org.springframework.security.oauth2.core.OAuth2AuthenticationException
org.springframework.security.oauth2.core.OAuth2AuthenticationException: [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] and content type [text/html;charset=utf-8]
at org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider.getResponse(OidcAuthorizationCodeAuthenticationProvider.java:176) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider.authenticate(OidcAuthorizationCodeAuthenticationProvider.java:144) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182) ~[spring-security-core-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter.attemptAuthentication(OAuth2LoginAuthenticationFilter.java:195) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:231) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:181) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:116) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.context.SecurityContextHolderFilter.doFilterInternal(SecurityContextHolderFilter.java:69) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) ~[spring-security-web-6.0.0.jar:6.0.0]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:351) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) ~[spring-web-6.0.2.jar:6.0.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.0.2.jar:6.0.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.2.jar:6.0.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.1.jar:10.1.1]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: org.springframework.security.oauth2.core.OAuth2AuthorizationException: [invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] and content type [text/html;charset=utf-8]
at org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient.getResponse(DefaultAuthorizationCodeTokenResponseClient.java:95) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient.getTokenResponse(DefaultAuthorizationCodeTokenResponseClient.java:77) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient.getTokenResponse(DefaultAuthorizationCodeTokenResponseClient.java:56) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
at org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider.getResponse(OidcAuthorizationCodeAuthenticationProvider.java:170) ~[spring-security-oauth2-client-6.0.0.jar:6.0.0]
... 62 common frames omitted
The debug trace from auth server
2023-01-24T22:24:54.510+05:30 INFO 96235 --- [nio-9000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
2023-01-24T22:24:54.518+05:30 DEBUG 96235 --- [nio-9000-exec-1] o.s.security.web.FilterChainProxy : Securing GET /oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid%20profile&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&nonce=FTOwMi9WPU3zHBPBrG2Jj-Dxm0udS_dLfI1I0TiN2Ws
2023-01-24T22:24:54.581+05:30 DEBUG 96235 --- [nio-9000-exec-1] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext
2023-01-24T22:24:54.608+05:30 DEBUG 96235 --- [nio-9000-exec-1] o.s.s.w.s.HttpSessionRequestCache : Saved request http://localhost:9000/oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid%20profile&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&nonce=FTOwMi9WPU3zHBPBrG2Jj-Dxm0udS_dLfI1I0TiN2Ws&continue to session
2023-01-24T22:24:54.609+05:30 DEBUG 96235 --- [nio-9000-exec-1] o.s.s.web.DefaultRedirectStrategy : Redirecting to http://localhost:9000/login
2023-01-24T22:24:54.615+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.security.web.FilterChainProxy : Securing GET /login
2023-01-24T22:24:54.625+05:30 DEBUG 96235 --- [nio-9000-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to sample.web.LoginController#login()
2023-01-24T22:24:54.627+05:30 DEBUG 96235 --- [nio-9000-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to sample.web.LoginController#login()
2023-01-24T22:24:54.627+05:30 DEBUG 96235 --- [nio-9000-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to sample.web.LoginController#login()
2023-01-24T22:24:54.627+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.security.web.FilterChainProxy : Secured GET /login
2023-01-24T22:24:54.630+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.web.servlet.DispatcherServlet : GET "/login", parameters={}
2023-01-24T22:24:54.632+05:30 DEBUG 96235 --- [nio-9000-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to sample.web.LoginController#login()
2023-01-24T22:24:54.647+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, application/xhtml+xml, image/avif, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8]
2023-01-24T22:24:54.889+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2023-01-24T22:24:54.889+05:30 DEBUG 96235 --- [nio-9000-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter : Set SecurityContextHolder to anonymous SecurityContext
2023-01-24T22:24:56.340+05:30 DEBUG 96235 --- [nio-9000-exec-3] o.s.security.web.FilterChainProxy : Securing GET /oauth2/authorization/google-idp
2023-01-24T22:24:56.351+05:30 DEBUG 96235 --- [nio-9000-exec-3] o.s.s.web.DefaultRedirectStrategy : Redirecting to https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=12345&scope=openid%20https://www.googleapis.com/auth/userinfo.profile%20https://www.googleapis.com/auth/userinfo.email&state=LiD_tN32DWHRqSqplicP6DmLk9oYl4_jcW0koqBe4uc%3D&redirect_uri=http://localhost:9000/login/oauth2/code/google-idp&nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck
2023-01-24T22:24:56.661+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.security.web.FilterChainProxy : Securing GET /login/oauth2/code/google-idp?state=LiD_tN32DWHRqSqplicP6DmLk9oYl4_jcW0koqBe4uc%3D&code=4%2F0AWtgzh5Qn1pSQP9samBXt-s-A9NUT0LBaC0iwCps44rQnq1M7wVMG-bd5DQj_0HMaSLSRA&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&prompt=none
2023-01-24T22:24:56.743+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : HTTP POST https://www.googleapis.com/oauth2/v4/token
2023-01-24T22:24:56.747+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Accept=[application/json, application/*+json]
2023-01-24T22:24:56.748+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Writing [{grant_type=[authorization_code], code=[4/0AWtgzh5Qn1pSQP9samBXt-s-A9NUT0LBaC0iwCps44rQnq1M7wVMG-bd5DQj_0HMaSLSRA], redirect_uri=[http://localhost:9000/login/oauth2/code/google-idp]}] as "application/x-www-form-urlencoded;charset=UTF-8"
2023-01-24T22:24:57.051+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Response 200 OK
2023-01-24T22:24:57.052+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Reading to [org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] as "application/json;charset=utf-8"
2023-01-24T22:24:57.093+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : HTTP GET https://www.googleapis.com/oauth2/v3/certs
2023-01-24T22:24:57.094+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Accept=[text/plain, application/json, application/*+json, */*]
2023-01-24T22:24:57.118+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Response 200 OK
2023-01-24T22:24:57.118+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.web.client.RestTemplate : Reading to [java.lang.String] as "application/json;charset=UTF-8"
2023-01-24T22:24:57.125+05:30 DEBUG 96235 --- [nio-9000-exec-4] .s.ChangeSessionIdAuthenticationStrategy : Changed session id from 856E5CB5EA53F6364793E21162F85AF2
2023-01-24T22:24:57.125+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.s.w.csrf.CsrfAuthenticationStrategy : Replaced CSRF Token
2023-01-24T22:24:57.126+05:30 DEBUG 96235 --- [nio-9000-exec-4] w.c.HttpSessionSecurityContextRepository : Stored SecurityContextImpl [Authentication=OAuth2AuthenticationToken [Principal=Name: [***#gmail.com], Granted Authorities: [[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]], User Attributes: [{at_hash=ao1nlr-mAYrpo3nU3ODFUQ, sub=107668940011151070771, email_verified=true, iss=https://accounts.google.com, given_name=***, locale=en-GB, nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck, picture=https://lh3.googleusercontent.com/a/AEdFTp75Udyj3805vIwRZpzku1-cRpiFpuMWsivqzRa9=s96-c, aud=[12345], azp=12345, name=*** *, exp=2023-01-24T17:54:57Z, family_name=*, iat=2023-01-24T16:54:57Z, email=***#gmail.com}], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=856E5CB5EA53F6364793E21162F85AF2], Granted Authorities=[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]]] to HttpSession [org.apache.catalina.session.StandardSessionFacade#46dcae35]
2023-01-24T22:24:57.126+05:30 DEBUG 96235 --- [nio-9000-exec-4] .s.o.c.w.OAuth2LoginAuthenticationFilter : Set SecurityContextHolder to OAuth2AuthenticationToken [Principal=Name: [***#gmail.com], Granted Authorities: [[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]], User Attributes: [{at_hash=ao1nlr-mAYrpo3nU3ODFUQ, sub=107668940011151070771, email_verified=true, iss=https://accounts.google.com, given_name=***, locale=en-GB, nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck, picture=https://lh3.googleusercontent.com/a/AEdFTp75Udyj3805vIwRZpzku1-cRpiFpuMWsivqzRa9=s96-c, aud=[12345], azp=12345, name=*** *, exp=2023-01-24T17:54:57Z, family_name=*, iat=2023-01-24T16:54:57Z, email=***#gmail.com}], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=856E5CB5EA53F6364793E21162F85AF2], Granted Authorities=[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]]
Saving first-time user: name=***#gmail.com, claims={at_hash=ao1nlr-mAYrpo3nU3ODFUQ, sub=107668940011151070771, email_verified=true, iss=https://accounts.google.com, given_name=***, locale=en-GB, nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck, picture=https://lh3.googleusercontent.com/a/AEdFTp75Udyj3805vIwRZpzku1-cRpiFpuMWsivqzRa9=s96-c, aud=[12345], azp=12345, name=*** *, exp=2023-01-24T17:54:57Z, family_name=*, iat=2023-01-24T16:54:57Z, email=***#gmail.com}, authorities=[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]
2023-01-24T22:24:57.126+05:30 DEBUG 96235 --- [nio-9000-exec-4] o.s.s.web.DefaultRedirectStrategy : Redirecting to http://localhost:9000/oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid%20profile&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&nonce=FTOwMi9WPU3zHBPBrG2Jj-Dxm0udS_dLfI1I0TiN2Ws&continue
2023-01-24T22:24:57.129+05:30 DEBUG 96235 --- [nio-9000-exec-5] o.s.security.web.FilterChainProxy : Securing GET /oauth2/authorize?response_type=code&client_id=messaging-client&scope=openid%20profile&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D&redirect_uri=http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc&nonce=FTOwMi9WPU3zHBPBrG2Jj-Dxm0udS_dLfI1I0TiN2Ws&continue
2023-01-24T22:24:57.130+05:30 DEBUG 96235 --- [nio-9000-exec-5] w.c.HttpSessionSecurityContextRepository : Retrieved SecurityContextImpl [Authentication=OAuth2AuthenticationToken [Principal=Name: [***#gmail.com], Granted Authorities: [[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]], User Attributes: [{at_hash=ao1nlr-mAYrpo3nU3ODFUQ, sub=107668940011151070771, email_verified=true, iss=https://accounts.google.com, given_name=***, locale=en-GB, nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck, picture=https://lh3.googleusercontent.com/a/AEdFTp75Udyj3805vIwRZpzku1-cRpiFpuMWsivqzRa9=s96-c, aud=[12345], azp=12345, name=*** *, exp=2023-01-24T17:54:57Z, family_name=*, iat=2023-01-24T16:54:57Z, email=***#gmail.com}], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=856E5CB5EA53F6364793E21162F85AF2], Granted Authorities=[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]]]
2023-01-24T22:24:59.025+05:30 DEBUG 96235 --- [nio-9000-exec-6] o.s.security.web.FilterChainProxy : Securing POST /oauth2/authorize
2023-01-24T22:24:59.026+05:30 DEBUG 96235 --- [nio-9000-exec-6] w.c.HttpSessionSecurityContextRepository : Retrieved SecurityContextImpl [Authentication=OAuth2AuthenticationToken [Principal=Name: [***#gmail.com], Granted Authorities: [[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]], User Attributes: [{at_hash=ao1nlr-mAYrpo3nU3ODFUQ, sub=107668940011151070771, email_verified=true, iss=https://accounts.google.com, given_name=***, locale=en-GB, nonce=mEbeJ8BYMUG2snc7fQgr-BhvBd1Gw4SYIZsch6rp7Ck, picture=https://lh3.googleusercontent.com/a/AEdFTp75Udyj3805vIwRZpzku1-cRpiFpuMWsivqzRa9=s96-c, aud=[12345], azp=12345, name=*** *, exp=2023-01-24T17:54:57Z, family_name=*, iat=2023-01-24T16:54:57Z, email=***#gmail.com}], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=0:0:0:0:0:0:0:1, SessionId=856E5CB5EA53F6364793E21162F85AF2], Granted Authorities=[OIDC_USER, SCOPE_https://www.googleapis.com/auth/userinfo.email, SCOPE_https://www.googleapis.com/auth/userinfo.profile, SCOPE_openid]]]
2023-01-24T22:24:59.074+05:30 DEBUG 96235 --- [nio-9000-exec-6] o.s.s.web.DefaultRedirectStrategy : Redirecting to http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc?code=DxWgpwZqmepYInMZ0lBZrboaEVULZYep8r2I9Kz6MM9rY-2O2Bg1wSMiKPhwMM2U2Uf9bvd2N9pMFXbB7mCKw4GlDULdgNSADjHOzXQxdEGRNPtRVBU7i6OKfkxCtB7i&state=2gTNT52oxL3kRqtnbA0vnXQzp3VrghJmLtVUNEtagRo%3D

Gerrit failing to start:

This setup was already running and working fine. But something happened: maybe some package got updated, some file corrupted or a network change broke it.
The command bin/gerrit.sh start returns Starting Gerrit Code Review: FAILED.
logs/error_log:
[2018-11-28 11:49:01,135] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes192-ctr: Unable to initialize cipher BaseCipher[AES,16,24,AES/CTR/NoPadding]
[2018-11-28 11:49:01,135] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes256-ctr: Unable to initialize cipher BaseCipher[AES,16,32,AES/CTR/NoPadding]
[2018-11-28 11:49:01,138] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher arcfour256: Illegal key size or default parameters; try installing unlimited cryptography extension
[2018-11-28 11:49:01,145] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes192-cbc: Unable to initialize cipher BaseCipher[AES,16,24,AES/CBC/NoPadding]
[2018-11-28 11:49:01,145] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes256-cbc: Unable to initialize cipher BaseCipher[AES,16,32,AES/CBC/NoPadding]
[2018-11-28 11:49:01,214] [main] WARN com.google.gerrit.sshd.SshDaemon : Cannot format SSHD host key [EdDSA]: invalid key type
[2018-11-28 11:49:01,227] [main] WARN com.google.gerrit.server.config.GitwebCgiConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
[2018-11-28 11:49:02,025] [main] INFO org.eclipse.jetty.util.log : Logging initialized #8689ms
[2018-11-28 11:49:02,102] [main] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 332m
[2018-11-28 11:49:02,121] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_hooks_181128_1116_5514078957117773811.jar
[2018-11-28 11:49:02,121] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_events-log_181128_1116_8975419966674917654.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_download-commands_181128_1116_7149912149640119287.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_replication_181128_1116_3000551844744811569.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_commit-message-length-validator_181128_1116_2800985912637941647.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_reviewnotes_181128_1116_1435979824854811361.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_singleusergroup_181128_1116_4944938881709642049.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loading plugins from /home/gerrit/gerrit_testsite/plugins
[2018-11-28 11:49:02,199] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin commit-message-length-validator, version v2.14.2
[2018-11-28 11:49:02,250] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin download-commands, version v2.14.2
[2018-11-28 11:49:02,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin events-log, version e271462
[2018-11-28 11:49:02,550] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin hooks, version v2.14.2
[2018-11-28 11:49:02,638] [main] WARN com.googlesource.gerrit.plugins.replication.ReplicationFileBasedConfig : Config file /home/gerrit/gerrit_testsite/etc/replication.config does not exist; not replicating
[2018-11-28 11:49:02,641] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin replication, version v2.14.2
[2018-11-28 11:49:02,697] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin reviewnotes, version v2.14.2
[2018-11-28 11:49:02,736] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin singleusergroup, version v2.14.2
[2018-11-28 11:49:02,975] [main] INFO com.google.gerrit.server.change.ChangeCleanupRunner : Ignoring missing changeCleanup schedule configuration
[2018-11-28 11:49:02,998] [main] INFO com.google.gerrit.sshd.SshDaemon : Started Gerrit SSHD-CORE-1.4.0 on *:29419
[2018-11-28 11:49:03,002] [main] INFO org.eclipse.jetty.server.Server : jetty-9.3.17.v20170317
[2018-11-28 11:49:03,787] [main] INFO org.eclipse.jetty.server.handler.ContextHandler : Started o.e.j.s.ServletContextHandler#384cd83a{/r,null,AVAILABLE}
[2018-11-28 11:49:43,834] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot start HTTP daemon
at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:106)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:92)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:323)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:232)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:204)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:108)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63)
at Main.main(Main.java:24)
Caused by: java.net.SocketException: Unresolved address
at sun.nio.ch.Net.translateToSocketException(Net.java:131)
at sun.nio.ch.Net.translateException(Net.java:157)
at sun.nio.ch.Net.translateException(Net.java:163)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:76)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:317)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:92)
... 12 more
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:101)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:218)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
... 19 more
The configuration file is listed below, we use a LDAP server to authenticate:
[gerrit]
basePath = git
serverId = c3094920-33f3-4219-82cf-0181f4f0c7e7
canonicalWebUrl = http://oururl/r/
[database]
type = h2
database = /home/gerrit/gerrit_testsite/db/ReviewDB
[index]
type = LUCENE
[auth]
type = ldap
gitBasicAuthPolicy = LDAP
[ldap]
server = ldap://ldapserver
accountBase = OU=Usuários Rede,DC=company,DC=com,DC=br
groupBase = OU=Grupos,DC=company,DC=com,DC=br
referral = follow
accountPattern = (mailNickname=${username})
groupPattern = (memberOf=${cn})
accountFullName = cn
accountEmailAddress = mail
localUsernameToLowerCase = true
accountSshUserName = cn
username = ldapread#company.com.br
password = pass
[receive]
enableSignedPush = false
[sendemail]
smtpServer = mail.company.com.br
smtpServerPort = 587
smtpEncryption = tls
sslVerify = false
allowedDomain = company.com.br
smtpUser = gerrit#company.com.br
smtpPass = pass
[container]
user = gerrit
javaHome = /usr/lib/jvm/java-8-oracle/jre
[sshd]
listenAddress = *:29419
[httpd]
listenUrl = http://engenharia.company.com.br:8888/r/
[cache]
directory = cache
[download]
command = checkout
command = cherry_pick
command = format_patch
command = pull
scheme = ssh
[capability]
accessDatabase = group Administrators
[plugins]
allowRemoteAdmin = true
[plugin "events-log"]
storeUrl = jdbc:h2:/tmp/db
What can I do to debug the issue? (I haven't done the Gerrit setup and installation.)
It wasn't related to Gerrit.
A network change disabled Gerrit. After changing the DNS server and gateway of the Gerrit machine, everything is working again.

MyBatis log4j2 logging level not changing

I have an inverse wish from most other posts regarding log4j2 logging of MyBatis. I am getting the MyBatis SQL logged, but I want to reduce it.
Below is my log4j2.properties file.
At present, I have the rootLogger.level=ALL in effect.
This is nicely displaying all log messages, including the MyBatis Prepare SQL and parameters list.
When I change it to
rootLogger.level=FATAL
all MyBatis messages stop appearing in console and log file, as do other messages.
So this is working well.
But I would like to have MyBatis logging at level=ERROR (or higher) for normal circumstances and the rest staying at ALL.
When I change the
# MyBatis logging configuration...
com.wert.bus.mappers=TRACE
to any other Level, it does not take effect.
I prefixed "log4j", "log4j2", "log4j.logger", "log4j2.logger" before "com.wert"
but it had no effect.
The mappers have namespace com.wert.bus.mappers
The output on the first session:
[DEBUG] 2018-07-21 01:56:35.648 [main] LogFactory - Logging initialized using 'class org.apache.ibatis.logging.log4j2.Log4j2Impl' adapter.
[DEBUG] 2018-07-21 01:56:43.201 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.207 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.213 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.219 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.225 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.231 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.237 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
The output on a query:
[DEBUG] 2018-07-21 02:00:10.047 [main] JdbcTransaction - Opening JDBC Connection
[DEBUG] 2018-07-21 02:00:19.739 [main] PooledDataSource - Created connection 105321150.
[DEBUG] 2018-07-21 02:00:19.823 [main] insertJobStatus - ==> Preparing: insert bus_loc ( loc_date, loc_name, status, start_time, end_time) values ( ?, ?, ?, ?, ?)
[DEBUG] 2018-07-21 02:00:24.512 [main] insertJobStatus - ==> Parameters: 2018-07-21 01:56:26.978(String), Boston(String), Prep(String), 2018-07-21 01:59:41(String), null
[DEBUG] 2018-07-21 02:00:25.034 [main] insertJobStatus - <== Updates: 1
What have I missed?
Thanks in advance for your help.
log4j2.properties
#status = trace for log4j2 startup issues
#status other values: trace, debug, info, warn, error, fatal
status = error
dest = err
#Time interval to check for changes to file in seconds
monitorInterval = 300
name=BusLoggingConfig
property.filename=logs
appenders=console,rolling
# MyBatis logging configuration...
com.wert.bus.mappers=TRACE
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %m%n
#appender.console.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.rolling.type = RollingFile
appender.rolling.name = RollingFile
appender.rolling.fileName = ${filename}/Bus.log
appender.rolling.filePattern = logs/Bus-%d{yyyyMMdd-HHmmss}-%i.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 20
loggers=rolling
logger.rolling.name=com.wert.bus
#logger.rolling.level=debug
logger.rolling.additivity=true
logger.rolling.appenderRef.rolling.ref=RollingFile
rootLogger.level=ALL
rootLogger.appenderRefs=stdout
rootLogger.appenderRef.stdout.ref=STDOUT
One of the problems is using additivity for child logger:
logger.rolling.additivity=true
This settings means that every logging event will be processed twice. First time using appenders and levels for logger com.wert.bus and then by parent (in your case root) logger.

How to create an OntModel for an ontology which imports another ontology?

I have an ontology that imports another ontology (both are stored in the same folder on my machine, created using Protege & saved as RDF/XML). When I create the ontology model in my java application through Jena, I get the following
0 [main] DEBUG org.apache.jena.riot.system.stream.JenaIOEnvironment - Failed to find configuration: location-mapping.ttl;location-mapping.rdf;location-mapping.n3;etc/location-mapping.rdf;etc/location-mapping.n3;etc/location-mapping.ttl
297 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
300 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.LocationMapper - Failed to find configuration: file:location-mapping.rdf;file:location-mapping.n3;file:location-mapping.ttl;file:etc/location-mapping.rdf;file:etc/location-mapping.n3;file:etc/location-mapping.ttl
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorURL
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorURL
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Found: file:ont-policy.rdf (ClassLoaderLocator)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - readModel(model,http://www.semanticweb.org/myOnt)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - readModel(model,http://www.semanticweb.org/myOnt, null)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - Not mapped: http://www.semanticweb.org/myOnt
2065 [main] WARN com.hp.hpl.jena.ontology.OntDocumentManager - An error occurred while attempting to read from http://www.semanticweb.org/myOnt. Msg was 'http://www.semanticweb.org/myOnt'.
This exception is also thrown
com.hp.hpl.jena.shared.DoesNotExistException
I understand that it is unable to find the imported ontology, and that one solution might be to create separate models for both ontologies, but there's an objective property in parent ontology which relates one of its class to the classes of imported ontology.
What can I do?

How to use Apache DS with Apache Camel, Spring Security as embedded LDAP server prepopulated from LDIF?

I'm trying to build an integration test with Apache Camel LDAP and Spring Security. Unfortunately the embedded Apache DS throws the following error when I try to pre-populate it with an LDIF (downloaded from the ApacheDS user guide) on startup:
The error message on startup
2013-06-27 09:51:32,002 [main ] INFO AbstractContextLoader - Detected default resource location "classpath:/eu/hermes/esb/gateway/LdapRouteTest-context.xml" for test class [eu.hermes.esb.gateway.LdapRouteTest].
2013-06-27 09:51:32,003 [main ] INFO DelegatingSmartContextLoader - GenericXmlContextLoader detected default locations for context configuration [ContextConfigurationAttributes#16ba8602 declaringClass = 'eu.hermes.esb.gateway.LdapRouteTest', locations = '{classpath:/eu/hermes/esb/gateway/LdapRouteTest-context.xml}', classes = '{}', inheritLocations = true, contextLoaderClass = 'org.springframework.test.context.ContextLoader'].
2013-06-27 09:51:32,003 [main ] INFO AnnotationConfigContextLoader - Could not detect default configuration classes for test class [eu.hermes.esb.gateway.LdapRouteTest]: LdapRouteTest does not declare any static, non-private, non-final, inner classes annotated with #Configuration.
2013-06-27 09:51:32,005 [main ] INFO TestContextManager - #TestExecutionListeners is not present for class [class eu.hermes.esb.gateway.LdapRouteTest]: using defaults.
2013-06-27 09:51:32,097 [main ] INFO XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [eu/hermes/esb/gateway/LdapRouteTest-context.xml]
2013-06-27 09:51:32,356 [main ] INFO SpringSecurityCoreVersion - You are running with Spring Security Core 3.1.4.RELEASE
2013-06-27 09:51:32,357 [main ] INFO SecurityNamespaceHandler - Spring Security 'config' module version is 3.1.4.RELEASE
2013-06-27 09:51:32,372 [main ] INFO LdapServerBeanDefinitionParser - Embedded LDAP server bean definition created for URL: ldap://127.0.0.1:389/dc=example,dc=com
2013-06-27 09:51:32,408 [main ] DEBUG CamelNamespaceHandler - Using org.apache.camel.spring.CamelContextFactoryBean as CamelContextBeanDefinitionParser
2013-06-27 09:51:32,975 [main ] DEBUG CamelNamespaceHandler - Registered default: org.apache.camel.spring.CamelProducerTemplateFactoryBean with id: template on camel context: camel-1
2013-06-27 09:51:32,975 [main ] DEBUG CamelNamespaceHandler - Registered default: org.apache.camel.spring.CamelConsumerTemplateFactoryBean with id: consumerTemplate on camel context: camel-1
2013-06-27 09:51:32,984 [main ] INFO GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext#7f56b6b9: startup date [Thu Jun 27 09:51:32 CEST 2013]; root of context hierarchy
2013-06-27 09:51:33,059 [main ] INFO DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#7619ed7e: defining beans [org.springframework.security.apacheDirectoryServerContainer,org.springframework.security.securityContextSource,ldapserver,template,consumerTemplate,camel-1:beanPostProcessor,camel-1,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
2013-06-27 09:51:33,319 [main ] INFO ApacheDSContainer - Setting working directory for LDAP_PROVIDER: C:\Users\MYUSERNAME\AppData\Local\Temp\apacheds-spring-security-8794490705744
2013-06-27 09:51:33,382 [main ] INFO ApacheDSContainer - Starting directory server...
2013-06-27 09:51:33,382 [main ] WARN DefaultDirectoryService - ApacheDS shutdown hook has NOT been registered with the runtime. This default setting for standalone operation has been overriden.
2013-06-27 09:51:34,002 [main ] ERROR DefaultAttributeTypeRegistry - attributeType w/ OID 2.5.4.16 not registered!
2013-06-27 09:51:34,451 [main ] INFO TlsKeyGenerator - Keys and self signed certificate successfully generated.
2013-06-27 09:51:34,615 [main ] INFO LdapServer - Successful bind of an LDAP Service (389) is completed.
2013-06-27 09:51:34,615 [main ] INFO LdapServer - Ldap service started.
2013-06-27 09:51:34,624 [main ] INFO ApacheDSContainer - Loading LDIF file: D:\projekte\ESB\esb-webservice-gateway\target\test-classes\apache-ds-tutorial.ldif
2013-06-27 09:51:34,632 [main ] INFO LdifFileLoader - Could not create entry ClientEntry
dn: ou=people,o=sevenSeas
objectclass: organizationalUnit
objectclass: top
ou: people
description: Contains entries which describe persons (seamen)
org.apache.directory.shared.ldap.exception.LdapNameNotFoundException: Cannot find a partition for 2.5.4.11=people,2.5.4.10=sevenseas
My camel context xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<security:ldap-server root="dc=example,dc=com" port="389" ldif="classpath:apache-ds-tutorial.ldif" />
<!-- ldap settings -->
<bean id="ldapserver" class="javax.naming.directory.InitialDirContext" scope="prototype">
<constructor-arg>
<props>
<prop key="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop>
<prop key="java.naming.provider.url">ldap://127.0.0.1:389</prop>
<prop key="java.naming.security.authentication">none</prop>
<!--
<prop key="java.naming.referral">ignore</prop>
<prop key="java.naming.security.principal">admin</prop>
<prop key="java.naming.security.credentials">admin</prop>
-->
</props>
</constructor-arg>
</bean>
<!-- this is the Camel route which proxies the real web service and forwards
SOAP requests to it -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start" />
<to uri="bean:ldapserver?method=doLookup('${body}')" />
<to uri="mock:result" />
</route>
</camelContext>
</beans>
My Question
Do I have to automatically create a partition? If yes, how do I configure that using the <security:ldap-server ... />? There is no attribute that looks right, so I guess I have to do some #Before in my junit class containing the test.
Update 1: I managed to get a little further, by specifing the root dn from my LDIF file inside the Spring security configuration:
<security:ldap-server root="ou=people,o=sevenSeas" port="389" ldif="classpath:apache-ds-tutorial.ldif" />
After that I removed everything from the LDIF file that's not related to ou=people,o=sevenSeas. Now I see the following log messages:
2013-06-27 11:04:30,193 [main ] INFO ApacheDSContainer - Starting directory server...
2013-06-27 11:04:30,193 [main ] WARN DefaultDirectoryService - ApacheDS shutdown hook has NOT been registered with the runtime. This default setting for standalone operation has been overriden.
2013-06-27 11:04:30,816 [main ] ERROR DefaultAttributeTypeRegistry - attributeType w/ OID 2.5.4.16 not registered!
2013-06-27 11:04:31,252 [main ] INFO TlsKeyGenerator - Keys and self signed certificate successfully generated.
2013-06-27 11:04:31,414 [main ] INFO LdapServer - Successful bind of an LDAP Service (389) is completed.
2013-06-27 11:04:31,414 [main ] INFO LdapServer - Ldap service started.
2013-06-27 11:04:31,417 [main ] ERROR ApacheDSContainer - Failed to create dc entry
java.lang.IllegalArgumentException: [Assertion failed] - this expression must be true
at org.springframework.util.Assert.isTrue(Assert.java:65)
at org.springframework.util.Assert.isTrue(Assert.java:77)
at org.springframework.security.ldap.server.ApacheDSContainer.start(ApacheDSContainer.java:189)
at org.springframework.security.ldap.server.ApacheDSContainer.afterPropertiesSet(ApacheDSContainer.java:130)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
2013-06-27 11:04:31,420 [main ] INFO ApacheDSContainer - Loading LDIF file: D:\projekte\ESB\esb-webservice-gateway\target\test-classes\apache-ds-tutorial.ldif
2013-06-27 11:04:31,436 [main ] INFO LdifFileLoader - Created null.
2013-06-27 11:04:31,443 [main ] INFO LdifFileLoader - Created null.
2013-06-27 11:04:31,448 [main ] INFO LdifFileLoader - Created null.
2013-06-27 11:04:31,454 [main ] INFO LdifFileLoader - Created null.
2013-06-27 11:04:31,460 [main ] INFO LdifFileLoader - Created null.
2013-06-27 11:04:31,473 [main ] INFO ultSpringSecurityContextSource - URL 'ldap://127.0.0.1:389/ou=people,o=sevenSeas', root DN is 'ou=people,o=sevenSeas'
Versions
Camel 2.11.0
Spring 3.1.4.RELEASE
UPDATE I created a gist with my files for reference at https://gist.github.com/MoriTanosuke/5882934
The root entry in the embedded server is restricted to "domain" so you're limited to DNs which end in "dc=blah,dc=blahblah".
you might consider using the LDAP tests from Spring Security as a starting point since they are already up and running.
First of all, my LdapRouteTest-context.xml had a really stupid mistake. My route definition was
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start" />
<to uri="bean:ldapserver?method=doLookup('${body}')" />
<to uri="mock:result" />
</route>
</camelContext>
and I referenced the bean ldapserver as a simple bean. The correct way to use camel-ldap is this:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start" />
<to uri="ldap:ldapserver?base=ou=people,o=sevenseas" />
<to uri="mock:result" />
</route>
</camelContext>
I had to use the base=ou=people,o=sevenseas parameter, or I wouldn't get any search results back. Maybe that's because I don't understand LDAP search filters yet or maybe this is the way you have to use camel-ldap. Anyway, now I can use an embedded LDAP server with an LDIF file for my integration tests.
I updated the gist with all my files at https://gist.github.com/MoriTanosuke/5882934 for later references.

Resources