Skip to content

Known issues and how to resolve them

Igor Balos edited this page Jun 18, 2018 · 23 revisions

Date format exception

We noticed that there are cases when you might receive an com.fasterxml.jackson.databind.exc.InvalidFormatException error when using the library.

Error could look something like this:

com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value 
of type java.util.Date from String "2018-04-17T14:50:37.4008047-04:00": not a valid representation 
(error: Failed to parse Date value '2018-04-17T14:50:37.4008047-05:00': Can not parse date "2018-04-17T14:50:37.4008047-0500": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSZ', 
parsing fails (leniency? null))

The reason why you would see this error is since older versions of Jackson library have a problem with parsing fractional timezones.

The issue was fixed in version 2.9.2. Make sure that you are using up to date version of Jackson, and you should not see this issue. Postmark Java library is using newer version in it's pom.xml, but you might have a reference to Jackson in one of your pom files too. Double check version when trying out the library.

InjectionManagerFactory error

If you experience an error which looks something like one below, you are probably using library which is using Jersey (http client):

java.lang.IllegalStateException: InjectionManagerFactory not found.
at org.glassfish.jersey.internal.inject.Injections.lambda$lookupInjectionManagerFactory(Injections.java:98)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.glassfish.jersey.internal.inject.Injections.lookupInjectionManagerFactory(Injections.java:98)
at org.glassfish.jersey.internal.inject.Injections.createInjectionManager(Injections.java:68)

The error is caused by mismatch betwen Jersey client version, and one of solutions from here could help resolve it.

Based on that article, one of our users resolved it by adding following dependency to pom.xml

<dependency>
 <groupId>org.glassfish.jersey.inject</groupId>
 <artifactId>jersey-hk2</artifactId>
 <version>2.27</version>
</dependency>

Using old version of Jersey (1.x) in your project

In case you are using old version of Jersey in your project, you might get errors like.

java.lang.NoClassDefFoundError: javax/ws/rs/core/MultivaluedHashMap

Our library is using version 2.x.

To resolve this issue, you could modify two of our classes to make it work. It should not be too difficult to port the library.

Check out an example at branch:

https://github.com/wildbit/postmark-java/tree/jersey-1.x

(to make it work, Postmark.java and HttpClient.java libraries needed to be modified.)