You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Ron Smits <ro...@gmail.com> on 2014/03/01 12:04:12 UTC

a conondrum

I was testing with some other stuff when I noticed that tomee responds
differently then I expected. So I created a very small test case which even
made less sense. The code can be found here
https://github.com/ronsmits/xml-required-test.

Basically this little project has one domain object (Catalog) en 2 rest
endpoints. All three endpoints are tested and run fine.

When you start the application (mvn clean package tomee:run) and open the
endpoints in a browser the first endpoint (.../rest/catalogs) goes fine.
The second one ../rest/catalogs/filledChild) throws an exception:

JAXBException occurred : name:
com.sun.xml.internal.bind.namespacePrefixMapper, value:
org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.


However this scenario is tested successfully in the testclass
TestRequired and runs without any problems.


What the * is going on here?


Ron

I Haven't Lost My Mind - It's Backed Up On Disk Somewhere

Re: a conondrum

Posted by Ron Smits <ro...@gmail.com>.
Pure informational, the project at
https://github.com/ronsmits/xml-required-test is updated with a jackson
processor. It might serve as a semi decent example?

I Haven't Lost My Mind - It's Backed Up On Disk Somewhere


On Sat, Mar 1, 2014 at 1:31 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> maybe use jackson as serializer which is better when doing javascript
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-03-01 13:26 GMT+01:00 Ron Smits <ro...@gmail.com>:
> > Situation is as follows (look at the example project). when I return a
> > Catalog object that has no children I would want to get the answer
> >
> > {"catalog":{"id": 1,"name":"root","children":[]}}
> >
> > now it returns
> > {"catalog":{"id": 1,"name":"root","children":{"id":"1.1","name":"child
> > 1"}}} when there is only 1 child and
> > {"catalog":{"id": 1,"name":"root","children":[{"id":"1.1","name":"child
> > 1"},{"id":"1.2","name":"child 2"}}} when there are more. This does not
> make
> > angularJS happy :)
> >
> > I solved this years ago but not with tomee,(in jersey you can more easily
> > configure this). But in Tomee it stumps me
> >
> >
> >
> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
> >
> >
> > On Sat, Mar 1, 2014 at 1:15 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com>wrote:
> >
> >> Hi
> >>
> >> which status code is returned? depend also what you return. Depending
> >> the json provider list can need to be wrapped (jaxb based providers)
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014-03-01 13:10 GMT+01:00 Ron Smits <ro...@gmail.com>:
> >> > Thanks setting the scope to test solved it for me. Note on to the two
> >> > reason I made this test project: why does an empty list not show up.
> >> > On Mar 1, 2014 12:51 PM, "Romain Manni-Bucau" <rm...@gmail.com>
> >> wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> just take care of you war, remove container libs from it:
> >> >>
> >> >> rmannibucau@asus:/tmp/xml-required-test$ ls
> >> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
> >> >> jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
> >> >> ziplock-1.6.0.jar
> >> >> rmannibucau@asus:/tmp/xml-required-test$ rm
> >> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*
> >> >>
> >> >> than all works fine (of course you need to do it through maven
> scopes)
> >> >> Romain Manni-Bucau
> >> >> Twitter: @rmannibucau
> >> >> Blog: http://rmannibucau.wordpress.com/
> >> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> >> Github: https://github.com/rmannibucau
> >> >>
> >> >>
> >> >>
> >> >> 2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
> >> >> > I was testing with some other stuff when I noticed that tomee
> responds
> >> >> > differently then I expected. So I created a very small test case
> which
> >> >> even
> >> >> > made less sense. The code can be found here
> >> >> > https://github.com/ronsmits/xml-required-test.
> >> >> >
> >> >> > Basically this little project has one domain object (Catalog) en 2
> >> rest
> >> >> > endpoints. All three endpoints are tested and run fine.
> >> >> >
> >> >> > When you start the application (mvn clean package tomee:run) and
> open
> >> the
> >> >> > endpoints in a browser the first endpoint (.../rest/catalogs) goes
> >> fine.
> >> >> > The second one ../rest/catalogs/filledChild) throws an exception:
> >> >> >
> >> >> > JAXBException occurred : name:
> >> >> > com.sun.xml.internal.bind.namespacePrefixMapper, value:
> >> >> > org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
> >> >> >
> >> >> >
> >> >> > However this scenario is tested successfully in the testclass
> >> >> > TestRequired and runs without any problems.
> >> >> >
> >> >> >
> >> >> > What the * is going on here?
> >> >> >
> >> >> >
> >> >> > Ron
> >> >> >
> >> >> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
> >> >>
> >>
>

Re: a conondrum

Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe use jackson as serializer which is better when doing javascript
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-03-01 13:26 GMT+01:00 Ron Smits <ro...@gmail.com>:
> Situation is as follows (look at the example project). when I return a
> Catalog object that has no children I would want to get the answer
>
> {"catalog":{"id": 1,"name":"root","children":[]}}
>
> now it returns
> {"catalog":{"id": 1,"name":"root","children":{"id":"1.1","name":"child
> 1"}}} when there is only 1 child and
> {"catalog":{"id": 1,"name":"root","children":[{"id":"1.1","name":"child
> 1"},{"id":"1.2","name":"child 2"}}} when there are more. This does not make
> angularJS happy :)
>
> I solved this years ago but not with tomee,(in jersey you can more easily
> configure this). But in Tomee it stumps me
>
>
>
> I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
>
>
> On Sat, Mar 1, 2014 at 1:15 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:
>
>> Hi
>>
>> which status code is returned? depend also what you return. Depending
>> the json provider list can need to be wrapped (jaxb based providers)
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2014-03-01 13:10 GMT+01:00 Ron Smits <ro...@gmail.com>:
>> > Thanks setting the scope to test solved it for me. Note on to the two
>> > reason I made this test project: why does an empty list not show up.
>> > On Mar 1, 2014 12:51 PM, "Romain Manni-Bucau" <rm...@gmail.com>
>> wrote:
>> >
>> >> Hi
>> >>
>> >> just take care of you war, remove container libs from it:
>> >>
>> >> rmannibucau@asus:/tmp/xml-required-test$ ls
>> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
>> >> jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
>> >> ziplock-1.6.0.jar
>> >> rmannibucau@asus:/tmp/xml-required-test$ rm
>> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*
>> >>
>> >> than all works fine (of course you need to do it through maven scopes)
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >>
>> >> 2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
>> >> > I was testing with some other stuff when I noticed that tomee responds
>> >> > differently then I expected. So I created a very small test case which
>> >> even
>> >> > made less sense. The code can be found here
>> >> > https://github.com/ronsmits/xml-required-test.
>> >> >
>> >> > Basically this little project has one domain object (Catalog) en 2
>> rest
>> >> > endpoints. All three endpoints are tested and run fine.
>> >> >
>> >> > When you start the application (mvn clean package tomee:run) and open
>> the
>> >> > endpoints in a browser the first endpoint (.../rest/catalogs) goes
>> fine.
>> >> > The second one ../rest/catalogs/filledChild) throws an exception:
>> >> >
>> >> > JAXBException occurred : name:
>> >> > com.sun.xml.internal.bind.namespacePrefixMapper, value:
>> >> > org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
>> >> >
>> >> >
>> >> > However this scenario is tested successfully in the testclass
>> >> > TestRequired and runs without any problems.
>> >> >
>> >> >
>> >> > What the * is going on here?
>> >> >
>> >> >
>> >> > Ron
>> >> >
>> >> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
>> >>
>>

Re: a conondrum

Posted by Ron Smits <ro...@gmail.com>.
Situation is as follows (look at the example project). when I return a
Catalog object that has no children I would want to get the answer

{"catalog":{"id": 1,"name":"root","children":[]}}

now it returns
{"catalog":{"id": 1,"name":"root","children":{"id":"1.1","name":"child
1"}}} when there is only 1 child and
{"catalog":{"id": 1,"name":"root","children":[{"id":"1.1","name":"child
1"},{"id":"1.2","name":"child 2"}}} when there are more. This does not make
angularJS happy :)

I solved this years ago but not with tomee,(in jersey you can more easily
configure this). But in Tomee it stumps me



I Haven't Lost My Mind - It's Backed Up On Disk Somewhere


On Sat, Mar 1, 2014 at 1:15 PM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> Hi
>
> which status code is returned? depend also what you return. Depending
> the json provider list can need to be wrapped (jaxb based providers)
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-03-01 13:10 GMT+01:00 Ron Smits <ro...@gmail.com>:
> > Thanks setting the scope to test solved it for me. Note on to the two
> > reason I made this test project: why does an empty list not show up.
> > On Mar 1, 2014 12:51 PM, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> just take care of you war, remove container libs from it:
> >>
> >> rmannibucau@asus:/tmp/xml-required-test$ ls
> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
> >> jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
> >> ziplock-1.6.0.jar
> >> rmannibucau@asus:/tmp/xml-required-test$ rm
> >> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*
> >>
> >> than all works fine (of course you need to do it through maven scopes)
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
> >> > I was testing with some other stuff when I noticed that tomee responds
> >> > differently then I expected. So I created a very small test case which
> >> even
> >> > made less sense. The code can be found here
> >> > https://github.com/ronsmits/xml-required-test.
> >> >
> >> > Basically this little project has one domain object (Catalog) en 2
> rest
> >> > endpoints. All three endpoints are tested and run fine.
> >> >
> >> > When you start the application (mvn clean package tomee:run) and open
> the
> >> > endpoints in a browser the first endpoint (.../rest/catalogs) goes
> fine.
> >> > The second one ../rest/catalogs/filledChild) throws an exception:
> >> >
> >> > JAXBException occurred : name:
> >> > com.sun.xml.internal.bind.namespacePrefixMapper, value:
> >> > org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
> >> >
> >> >
> >> > However this scenario is tested successfully in the testclass
> >> > TestRequired and runs without any problems.
> >> >
> >> >
> >> > What the * is going on here?
> >> >
> >> >
> >> > Ron
> >> >
> >> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
> >>
>

Re: a conondrum

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

which status code is returned? depend also what you return. Depending
the json provider list can need to be wrapped (jaxb based providers)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-03-01 13:10 GMT+01:00 Ron Smits <ro...@gmail.com>:
> Thanks setting the scope to test solved it for me. Note on to the two
> reason I made this test project: why does an empty list not show up.
> On Mar 1, 2014 12:51 PM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
>> Hi
>>
>> just take care of you war, remove container libs from it:
>>
>> rmannibucau@asus:/tmp/xml-required-test$ ls
>> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
>> jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
>> ziplock-1.6.0.jar
>> rmannibucau@asus:/tmp/xml-required-test$ rm
>> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*
>>
>> than all works fine (of course you need to do it through maven scopes)
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
>> > I was testing with some other stuff when I noticed that tomee responds
>> > differently then I expected. So I created a very small test case which
>> even
>> > made less sense. The code can be found here
>> > https://github.com/ronsmits/xml-required-test.
>> >
>> > Basically this little project has one domain object (Catalog) en 2 rest
>> > endpoints. All three endpoints are tested and run fine.
>> >
>> > When you start the application (mvn clean package tomee:run) and open the
>> > endpoints in a browser the first endpoint (.../rest/catalogs) goes fine.
>> > The second one ../rest/catalogs/filledChild) throws an exception:
>> >
>> > JAXBException occurred : name:
>> > com.sun.xml.internal.bind.namespacePrefixMapper, value:
>> > org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
>> >
>> >
>> > However this scenario is tested successfully in the testclass
>> > TestRequired and runs without any problems.
>> >
>> >
>> > What the * is going on here?
>> >
>> >
>> > Ron
>> >
>> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
>>

Re: a conondrum

Posted by Ron Smits <ro...@gmail.com>.
Thanks setting the scope to test solved it for me. Note on to the two
reason I made this test project: why does an empty list not show up.
On Mar 1, 2014 12:51 PM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Hi
>
> just take care of you war, remove container libs from it:
>
> rmannibucau@asus:/tmp/xml-required-test$ ls
> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
> jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
> ziplock-1.6.0.jar
> rmannibucau@asus:/tmp/xml-required-test$ rm
> target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*
>
> than all works fine (of course you need to do it through maven scopes)
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
> > I was testing with some other stuff when I noticed that tomee responds
> > differently then I expected. So I created a very small test case which
> even
> > made less sense. The code can be found here
> > https://github.com/ronsmits/xml-required-test.
> >
> > Basically this little project has one domain object (Catalog) en 2 rest
> > endpoints. All three endpoints are tested and run fine.
> >
> > When you start the application (mvn clean package tomee:run) and open the
> > endpoints in a browser the first endpoint (.../rest/catalogs) goes fine.
> > The second one ../rest/catalogs/filledChild) throws an exception:
> >
> > JAXBException occurred : name:
> > com.sun.xml.internal.bind.namespacePrefixMapper, value:
> > org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
> >
> >
> > However this scenario is tested successfully in the testclass
> > TestRequired and runs without any problems.
> >
> >
> > What the * is going on here?
> >
> >
> > Ron
> >
> > I Haven't Lost My Mind - It's Backed Up On Disk Somewhere
>

Re: a conondrum

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

just take care of you war, remove container libs from it:

rmannibucau@asus:/tmp/xml-required-test$ ls
target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/
jaxb-impl-2.2.6.jar  openejb-jee-4.6.0.jar  shrinkwrap-api-1.1.2.jar
ziplock-1.6.0.jar
rmannibucau@asus:/tmp/xml-required-test$ rm
target/apache-tomee/webapps/xmlrequiredtest/WEB-INF/lib/*

than all works fine (of course you need to do it through maven scopes)
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-03-01 12:04 GMT+01:00 Ron Smits <ro...@gmail.com>:
> I was testing with some other stuff when I noticed that tomee responds
> differently then I expected. So I created a very small test case which even
> made less sense. The code can be found here
> https://github.com/ronsmits/xml-required-test.
>
> Basically this little project has one domain object (Catalog) en 2 rest
> endpoints. All three endpoints are tested and run fine.
>
> When you start the application (mvn clean package tomee:run) and open the
> endpoints in a browser the first endpoint (.../rest/catalogs) goes fine.
> The second one ../rest/catalogs/filledChild) throws an exception:
>
> JAXBException occurred : name:
> com.sun.xml.internal.bind.namespacePrefixMapper, value:
> org.apache.cxf.common.jaxb.NamespaceMapper@4b34a9.
>
>
> However this scenario is tested successfully in the testclass
> TestRequired and runs without any problems.
>
>
> What the * is going on here?
>
>
> Ron
>
> I Haven't Lost My Mind - It's Backed Up On Disk Somewhere