ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JAXB Marshal error - prefix "xmlns" cannot be boun

Post new topic  Reply to topic
 JAXB Marshal error - prefix "xmlns" cannot be boun « View previous topic :: View next topic » 
Author Message
ytnom_led
PostPosted: Thu Jul 11, 2013 5:43 am    Post subject: JAXB Marshal error - prefix "xmlns" cannot be boun Reply with quote

Newbie

Joined: 10 Jul 2013
Posts: 5

Hi All,

I am trying to use JAXB in v8.0.0.1 to generate an XML message, but the XML generated is not valid. I have manually created an XSD --> generated a message set --> generated JAXB objects --> created new objects in a JavaCompute node --> Cast the object as a JAXBElement --> marshalled the object --> validated the message in the flow (validates fine). But I find that when I validate the XML independently in Broker Toolkit (by creating a new XML file and validating it) then it is not valid as the XML has the following:

Code:
<ns2:MyData xmlns:ns2="http://myExampleSchema/Extended" xmlns:xmlns="http://myExampleSchema/Core">


The error i get when validating is:

Quote:
The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.


I have followed advice I found on the web and added to the package-info.java like the code below…

Code:
@XmlSchema(
namespace = "http://myExampleSchema",
elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = {
@XmlNs(
prefix = "fred",
namespaceURI = "http://myExampleSchema/Core")
})

package my.package.jaxb;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.XmlNsForm;


This seems to have no affect. I have also tried another solution, to create my own NamespacePrefixMapper but I get the error below:

Quote:
Access restriction, the type NamespacePrefixMapper is not accessible due to a restriction on the required library C:\Program Files\IBM\WMBT800\jdk\jre\lib\rt.jar


Any advice about how i can change this prefix would be great,

Thanks for your time

(Please note that i work part time so may not reply immediately)
Back to top
View user's profile Send private message
ytnom_led
PostPosted: Thu Jul 11, 2013 5:44 am    Post subject: Reply with quote

Newbie

Joined: 10 Jul 2013
Posts: 5

Sorry - i was unable to post the URL on my first ever post, the web page I used was http://hwellmann.blogspot.co.uk/2011/03/jaxb-marshalling-with-custom-namespace.html

Last edited by ytnom_led on Mon Jul 15, 2013 2:45 am; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jul 11, 2013 5:52 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Try again with Toolkit 8.0.0.2?

I don't know that there are specific APARs in this area, but it sounds like a bug.

And there are a bunch of important fixes in 8.0.0.2 compared to 8.0.0.1 anyway, so better to get on the bandwagon and put yourself in position to open a PMR.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 11, 2013 6:22 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Sounds like a defect in the product. Please do as mqjeff suggests.
Back to top
View user's profile Send private message
ytnom_led
PostPosted: Thu Jul 11, 2013 6:49 am    Post subject: Reply with quote

Newbie

Joined: 10 Jul 2013
Posts: 5

Thank you for your comments, I can hopefully test on v8.0.0.2 from next week, and a PMR should be on its way. I looked through the APARs but couldn't see anything related either.

In the mean time, could anyone please explain why I wouldn't be able to access the NamespacePrefixMapper?

thank you
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jul 11, 2013 7:56 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Did you also try the following: note the difference in the association with xmlns:
Code:
@XmlSchema(
namespace = "http://myExampleSchema",
elementFormDefault = XmlNsForm.QUALIFIED,
@XmlNs(
prefix = "fred",
namespaceURI = "http://myExampleSchema/Core")
)

package my.package.jaxb;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.XmlNsForm;


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ytnom_led
PostPosted: Mon Jul 15, 2013 11:41 pm    Post subject: Reply with quote

Newbie

Joined: 10 Jul 2013
Posts: 5

Here's an update:-

I have now tested on Z/OS v8.0.0.2 & Windows v8.0.0.1 with the same result. A PMR is open at the minute.

Thank you for your suggestion fjb_saper, but that code had an error when i tried it, I believe it's because XmlSchema is expecting the code below in order to know which attribute to set.
Code:
xmlns =
Back to top
View user's profile Send private message
ytnom_led
PostPosted: Mon Jul 22, 2013 5:54 am    Post subject: Reply with quote

Newbie

Joined: 10 Jul 2013
Posts: 5

Here's an update:-

This is a program error due to be fixed in v8.0.0.3. See http://www-01.ibm.com/support/docview.wss?uid=swg1IC92747 for details
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JAXB Marshal error - prefix "xmlns" cannot be boun
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.