Re: [jackson-user] Windows CentOS differences

2018-08-08 Thread Sean Dawson
Oh ok - thanks so much for the info and that suggestion. Will check it out.


On Wed, Aug 8, 2018 at 2:55 AM, Tatu Saloranta  wrote:

>
>
> On Wed, Aug 8, 2018 at 6:52 AM  wrote:
>
>>
>> Hello, we have a web app that sits in Tomcat and uses RestEasy
>> 3.0.16.Final and Jackson 2.5.2. It's built once, using maven, and then
>> deployed pretty much the same to a Windows 7 and a CentOS 7.2 machines.
>>
>> Just in the last week, we've started to get ProcessingException errors on
>> a couple of our dtos...
>>
>> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
>> Unrecognized field "date" (class ...), not marked as ignorable (0 known
>> properties: ])
>>  at [Source: java.io.BufferedInputStream@44daddab; line: 1, column: 52]
>> (through reference chain: ...["date"])
>>
>> So for one of the dto's, I had to add 3 variables into
>> @JsonIgnoreProperties and for the other, I had to add 
>> @JsonAutoDetect(fieldVisibility
>> = JsonAutoDetect.Visibility.ANY).
>>
>> I don't know why this is. I can't think of anything that's changed in
>> this area recently. Or why it happens only on Linux (all the required
>> libraries are included on both, and they are exactly the same).
>>
>> Could it be a JDK issue? Some difference in configuration of another
>> component like RestEasy or Hibernate ?
>>
>>
> I do not know what specifically could cause this, but I would first
> consider upgrading at least to latest 2.5.x patch version (2.5.5).
> As to root cause I would probably try to thoroughly check that you do not
> somehow have multiple versions of Jackson-databind jar; if multiple exist,
> loading order is arbitrary and could well be OS dependant. And typically
> nothing good comes out of conflicting versions anyway; it is a common cause
> for strange errors. So maybe that could be happening here?
>
> -+ Tatu +-
>
>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "jackson-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jackson-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to jackson-user@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jackson-user" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jackson-user/8CEA11OKlxE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jackson-user] Windows CentOS differences

2018-08-08 Thread Tatu Saloranta
On Wed, Aug 8, 2018 at 6:52 AM  wrote:

>
> Hello, we have a web app that sits in Tomcat and uses RestEasy
> 3.0.16.Final and Jackson 2.5.2. It's built once, using maven, and then
> deployed pretty much the same to a Windows 7 and a CentOS 7.2 machines.
>
> Just in the last week, we've started to get ProcessingException errors on
> a couple of our dtos...
>
> com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
> Unrecognized field "date" (class ...), not marked as ignorable (0 known
> properties: ])
>  at [Source: java.io.BufferedInputStream@44daddab; line: 1, column: 52]
> (through reference chain: ...["date"])
>
> So for one of the dto's, I had to add 3 variables into
> @JsonIgnoreProperties and for the other, I had to add
> @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY).
>
> I don't know why this is. I can't think of anything that's changed in this
> area recently. Or why it happens only on Linux (all the required libraries
> are included on both, and they are exactly the same).
>
> Could it be a JDK issue? Some difference in configuration of another
> component like RestEasy or Hibernate ?
>
>
I do not know what specifically could cause this, but I would first
consider upgrading at least to latest 2.5.x patch version (2.5.5).
As to root cause I would probably try to thoroughly check that you do not
somehow have multiple versions of Jackson-databind jar; if multiple exist,
loading order is arbitrary and could well be OS dependant. And typically
nothing good comes out of conflicting versions anyway; it is a common cause
for strange errors. So maybe that could be happening here?

-+ Tatu +-


> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jackson-user] Windows CentOS differences

2018-08-08 Thread seandawson2015

Hello, we have a web app that sits in Tomcat and uses RestEasy 3.0.16.Final 
and Jackson 2.5.2. It's built once, using maven, and then deployed pretty 
much the same to a Windows 7 and a CentOS 7.2 machines.

Just in the last week, we've started to get ProcessingException errors on a 
couple of our dtos...

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: 
Unrecognized field "date" (class ...), not marked as ignorable (0 known 
properties: ])
 at [Source: java.io.BufferedInputStream@44daddab; line: 1, column: 52] 
(through reference chain: ...["date"])

So for one of the dto's, I had to add 3 variables into 
@JsonIgnoreProperties and for the other, I had to add 
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY).

I don't know why this is. I can't think of anything that's changed in this 
area recently. Or why it happens only on Linux (all the required libraries 
are included on both, and they are exactly the same).

Could it be a JDK issue? Some difference in configuration of another 
component like RestEasy or Hibernate ?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jackson-user] XML Deserialization of @JacksonXmlText in Scala case classes

2018-08-08 Thread Christopher Townson
Hi -- I am wondering if anyone has experienced the following issue with XML 
deserialization to Scala case classes annotated with @JacksonXmlText:

Jackson version: 2.9.6

Given the following case classes:

@JacksonXmlRootElement(localName = "MyDocument")
case class MyDocument(@JacksonXmlProperty(localName = "MyElement")
  somethingWithXmlText: Option[MyElement] = None)


case class MyElement(@JacksonXmlProperty(localName = "anAttribute", isAttribute 
= true)
 anAttribute: Option[String] = None,

 @JacksonXmlText
 theValue: Option[String] = None)



Deserialization fails in the following test scenario:

class CaseClassJacksonXmlTextTest extends WordSpec with MustMatchers {

  private val module = new JacksonXmlModule()
  module.setDefaultUseWrapper(false)
  private val mapper = new XmlMapper(module)
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
  mapper.configure(SerializationFeature.INDENT_OUTPUT, true)
  mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
  mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
  mapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT)
  mapper.registerModule(DefaultScalaModule)

  "my document" should {

"serialization should be commutative" in {
  val doc = MyDocument(Some(MyElement(
anAttribute = Some("foo"),
theValue = Some("bar")
  )))
  val sw = new StringWriter()
  mapper.writeValue(sw, doc)
  val serialized = sw.toString
  val deserialized = mapper.readValue(serialized, classOf[MyDocument])
  deserialized must be(doc)
}

  }

}


Stack trace:

Invalid definition for property `` (of type `MyElement`): Could not find 
creator property with name '' (known Creator properties: [anAttribute, 
theValue])
 at [Source: (StringReader); line: 1, column: 1]
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid 
definition for property `` (of type `MyElement`): Could not find creator 
property with name '' (known Creator properties: [anAttribute, theValue])
 at [Source: (StringReader); line: 1, column: 1]
 at 
com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:62)
 at 
com.fasterxml.jackson.databind.DeserializationContext.reportBadPropertyDefinition(DeserializationContext.java:1446)
 at 
com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:567)
 at 
com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:227)
 at 
com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:137)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:411)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
 at 
com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:444)
 at 
com.fasterxml.jackson.module.scala.deser.OptionDeserializer.createContextual(OptionDeserializerModule.scala:48)
 at 
com.fasterxml.jackson.databind.DeserializationContext.handlePrimaryContextualization(DeserializationContext.java:651)
 at 
com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:484)
 at 
com.fasterxml.jackson.databind.deser.std.DelegatingDeserializer.resolve(DelegatingDeserializer.java:58)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:293)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
 at 
com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
 at 
com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:477)
 at 
com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4190)
 at 
com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4009)
 at 
com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3004)
 at 
CaseClassJacksonXmlTextTest$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(CaseClassJacksonXmlTextTest.scala:34)


I've noticed an issue reported 
https://github.com/FasterXML/jackson-dataformat-xml/issues/198 which 
appears to describe the same problem but has been closed due to 
unreproducibility? My test case is attached.

Any advice on what I might be doing wrong or suggestions