I make apps for other people

Fixing the Unknown Source error in Java

Posted by Chris Jones
On September 19th, 2016 at 16:32

Permalink | Trackback | Links In |

Comments Off on Fixing the Unknown Source error in Java
Posted in General

Given a Maven Java project with dependencies, you might come across a project (like I did) with very old dependencies.  In my case, I found references to OpenSAML 1.1b, a never really released POM that was included with older (2012 and earlier) versions of Aspero JASIG CAS.  While testing my replacement for the CAS server, I encountered cryptic DOM parsing errors.
Caused by: org.opensaml.SAMLException
at org.opensaml.SAMLException.getInstance(Unknown Source)
at org.opensaml.SAMLResponse.fromDOM(Unknown Source)
at org.opensaml.SAMLResponse.<init>(Unknown Source)
at org.jasig.cas.client.validation.Saml11TicketValidator.parseResponseFromServer(Saml11TicketValidator.java:51)

Neither running the server with a debugger attached nor running a unit test which duplicated the exception helped:  the breakpoints were ignored because the debugging symbols were stripped by the original ant build which produced the JAR.

To fix this, I had to do the following:

  1. Download the original source (which was, thankfully, available as an archive from Internet2/Shibboleth).
  2. Add a pom.xml file to make this a Maven-ized project.  I named the new artifact org.opensaml:opensaml:1.1c
  3. Move the source, tests, and resources to Maven appropriate directories.
  4. Change FileInputStream constructors in the unit tests to ClassLoader.getSystemResourceAsStream() calls.
  5. Use Maven to install the new OpenSAML 1.1c module to my local repository.
  6. Add a dependency in my top-level CAS client project to load OpenSAML 1.1c.  This was sufficient for my unit test to now have access to the debugging symbols.

Caused by: org.jasig.cas.client.validation.TicketValidationException: org.opensaml.SAMLException
at org.jasig.cas.client.validation.Saml11TicketValidator.parseResponseFromServer(Saml11TicketValidator.java:94)
at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:188)
at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:132)
... 38 more
Caused by: org.opensaml.SAMLException
at org.opensaml.SAMLException.getInstance(SAMLException.java:144)
at org.opensaml.SAMLResponse.fromDOM(SAMLResponse.java:179)
at org.opensaml.SAMLResponse.>init<(SAMLResponse.java:124)
at org.jasig.cas.client.validation.Saml11TicketValidator.parseResponseFromServer(Saml11TicketValidator.java:50)
... 40 more


Comments are closed.