<div dir="ltr"><div><div>Hi All,<br><br></div>Since I was using OpenSAML3 on a project which is based on OSGi seems there was a problem during initialization so what I had to do is initialize them myself. Hope this helps someone in the future.<br><br></div><div>Stack Overflow Resource - <a href="https://stackoverflow.com/questions/37948303/opensaml3-resource-not-found-default-config-xml-in-osgi-container">https://stackoverflow.com/questions/37948303/opensaml3-resource-not-found-default-config-xml-in-osgi-container</a><br></div><div><br></div><div>Code Implementation:</div><div><br></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(204,120,50)">public static void </span><span style="color:rgb(255,198,109)">doBootstrap</span>() {<br>    <span style="color:rgb(204,120,50)">if </span>(!<span style="color:rgb(152,118,170);font-style:italic">isBootStrapped</span>) {<br>        <span style="color:rgb(204,120,50)">try </span>{<br>            InitializationService.<span style="font-style:italic">initialize</span>()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">            </span>SAMLConfigurationInitializer initializer_1 = <span style="color:rgb(204,120,50)">new </span>SAMLConfigurationInitializer()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">            </span>initializer_1.init()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)">            </span>org.opensaml.saml.config.XMLObjectProviderInitializer initializer_2 = <span style="color:rgb(204,120,50)">new </span>org.opensaml.saml.config.XMLObjectProviderInitializer()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">            </span>initializer_2.init()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)">            </span>org.opensaml.core.xml.config.XMLObjectProviderInitializer initializer_3 = <span style="color:rgb(204,120,50)">new </span>org.opensaml.core.xml.config.XMLObjectProviderInitializer()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">            </span>initializer_3.init()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)">            </span>org.opensaml.core.xml.config.GlobalParserPoolInitializer initializer_4 = <span style="color:rgb(204,120,50)">new </span>org.opensaml.core.xml.config.GlobalParserPoolInitializer()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">            </span>initializer_4.init()<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)">            </span><span style="color:rgb(152,118,170);font-style:italic">isBootStrapped </span>= <span style="color:rgb(204,120,50)">true;<br></span><span style="color:rgb(204,120,50)">        </span>} <span style="color:rgb(204,120,50)">catch </span>(InitializationException e) {<br>            <span style="color:rgb(152,118,170);font-style:italic">log</span>.error(<span style="color:rgb(106,135,89)">"Error in bootstrapping the OpenSAML2 library"</span><span style="color:rgb(204,120,50)">, </span>e)<span style="color:rgb(204,120,50)">;<br></span><span style="color:rgb(204,120,50)">        </span>}<br>    }<br>}</pre></div><div><br></div><div>Thanks all for the answers,</div><div>Best Regards,</div><div>Deshan Koswatte  </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 8, 2019 at 10:11 AM DD K <<a href="mailto:ddk05361@gmail.com">ddk05361@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi Brent,<br><br></div>I've been able to debug the process and found out that I have got null from unmarshallerFactory.getUnmarshaller(element) because there has been no unmarshaller registered to unmarshall the element. Can you suggest a way to manually register an unmarshaller for the element (any resource that i can refer). So my request is as follows:<br><br> <?xml version="1.0" encoding="UTF-8"?><br><samlp:AuthnRequest AssertionConsumerServiceURL="<a href="http://localhost.com:8080/saml2-web-app-pickup-dispatch.com/home.jsp" target="_blank">http://localhost.com:8080/saml2-web-app-pickup-dispatch.com/home.jsp</a>" Destination="<a href="https://localhost:9443/samlsso" target="_blank">https://localhost:9443/samlsso</a>" ForceAuthn="false" ID="fnhigdbcehpepkchcpbacfooiadpciniicamhckg" IsPassive="true" IssueInstant="2019-08-08T04:40:07.949Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><samlp:Issuer xmlns:samlp="urn:oasis:names:tc:SAML:2.0:assertion"><a href="http://saml2-web-app-pickup-dispatch.com" target="_blank">saml2-web-app-pickup-dispatch.com</a></samlp:Issuer><saml2p:NameIDPolicy AllowCreate="true" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" SPNameQualifier="Issuer" xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"/><saml2p:RequestedAuthnContext Comparison="exact" xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"><saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef></saml2p:RequestedAuthnContext></samlp:AuthnRequest></div><div dir="ltr"><br></div><div>Any answers answers would be appreciated,<br></div><div>Thanks,<br></div><div>Deshan Koswatte<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 8, 2019 at 4:21 AM Brent Putman <<a href="mailto:putmanb@georgetown.edu" target="_blank">putmanb@georgetown.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="gmail-m_7359292674112531304gmail-m_265686334465688654moz-cite-prefix">On 8/6/19 1:30 AM, DD K wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div class="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-adn gmail-m_7359292674112531304gmail-m_265686334465688654gmail-ads">
          <div class="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-gs">
            <div class="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-">
              <div id="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-:sy" class="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-ii gmail-m_7359292674112531304gmail-m_265686334465688654gmail-gt">
                <div id="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-:s9" class="gmail-m_7359292674112531304gmail-m_265686334465688654gmail-a3s gmail-m_7359292674112531304gmail-m_265686334465688654gmail-aXjCH">
                  <div dir="ltr"><br>
                    <div>The exception is thrown from the code snippet
                      at the commented line:</div>
                    <div><br>
                    </div>
                    <div>
                      <pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"DejaVu Sans Mono";font-size:9pt"><span style="color:rgb(204,120,50)">public static </span>XMLObject <span style="color:rgb(255,198,109)">unmarshall</span>(String authReqStr) <span style="color:rgb(204,120,50)">throws </span>IdentityException {
    InputStream inputStream = <span style="color:rgb(204,120,50)">null;
</span><span style="color:rgb(204,120,50)">    try </span>{
        <span style="font-style:italic">doBootstrap</span>()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>DocumentBuilderFactory documentBuilderFactory = IdentityUtil.<span style="font-style:italic">getSecuredDocumentBuilderFactory</span>()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>inputStream = <span style="color:rgb(204,120,50)">new </span>ByteArrayInputStream(authReqStr.trim().getBytes(StandardCharsets.<span style="color:rgb(152,118,170);font-style:italic">UTF_8</span>))<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>Document document = docBuilder.parse(inputStream)<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>Element element = document.getDocumentElement()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>UnmarshallerFactory unmarshallerFactory = XMLObjectProviderRegistrySupport.<span style="font-style:italic">getUnmarshallerFactory</span>()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        </span>Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element)<span style="color:rgb(204,120,50)">;</span><span style="color:rgb(204,120,50)"></span><span style="color:rgb(152,118,170);font-style:italic"></span><span style="color:rgb(204,120,50)">
</span><span style="color:rgb(204,120,50)">        return </span>unmarshaller.unmarshall(element)<span style="color:rgb(204,120,50)">; // Exception thrown here
</span><span style="color:rgb(204,120,50)">    </span>} <span style="color:rgb(204,120,50)">catch </span>(Exception e) {
        <span style="color:rgb(152,118,170);font-style:italic">log</span>.error(<span style="color:rgb(106,135,89)">"Error in constructing AuthRequest from the encoded String"</span><span style="color:rgb(204,120,50)">, </span>e)<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">        throw </span>IdentityException.<span style="font-style:italic">error</span>(
                <span style="color:rgb(106,135,89)">"Error in constructing AuthRequest from the encoded String "</span><span style="color:rgb(204,120,50)">,
</span><span style="color:rgb(204,120,50)">                </span>e)<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">    </span>} <span style="color:rgb(204,120,50)">finally </span>{
        <span style="color:rgb(204,120,50)">if </span>(inputStream != <span style="color:rgb(204,120,50)">null</span>) {
            <span style="color:rgb(204,120,50)">try </span>{
                inputStream.close()<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">            </span>} <span style="color:rgb(204,120,50)">catch </span>(IOException e) {
                <span style="color:rgb(152,118,170);font-style:italic">log</span>.error(<span style="color:rgb(106,135,89)">"Error while closing the stream"</span><span style="color:rgb(204,120,50)">, </span>e)<span style="color:rgb(204,120,50)">;
</span><span style="color:rgb(204,120,50)">            </span>}
        }
    }
}</pre>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
    </blockquote>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>I don't see anything obviously wrong there.  If it's throwing on
      that line, it's likely that the unmarshaller is null, which means
      you didn't get anything back from the unmarshallerFactory.  That
      means something is likely not working with your initialization of
      the library.  I can't say anything more than that.  I'd suggest
      turning up logging to DEBUG or even TRACE on some or all of the
      OpenSAML packages to see what is actually happening, for example
      whether you are actually successfully reading and registering the
      XMLObject builders, marshallers and unmarshallers.<br>
    </p>
  </div>

-- <br>
To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net" target="_blank">dev-unsubscribe@shibboleth.net</a></blockquote></div></div>
</blockquote></div>