JAXB javax.xml.bind.UnmarshalException: Unexpected end of element
I'm getting the following UnmarshalException when I try to run Unmarshaller.unmarshal from the command line but not when I run it in WSAD:
2006-04-20 16:11:54,680 REPOST ERROR [main] (RestrictedListResponseConsumer.java:111) javax.xml.bind.UnmarshalException: Unexpected end of element {}:origin_country
at com.b.watchdog.jaxb.generated.response.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(SAXUnmarshallerHandlerImpl.java:580)
at com.b.watchdog.jaxb.generated.response.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:139)
at com.b.watchdog.jaxb.generated.response.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:136)
at com.b.watchdog.jaxb.generated.response.impl.runtime.AbstractUnmarshallingEventHandlerImpl.unexpectedLeaveElement(AbstractUnmarshallingEventHandlerImpl.java:153)
at com.b.watchdog.jaxb.generated.response.impl.runtime.AbstractUnmarshallingEventHandlerImpl.leaveElement(AbstractUnmarshallingEventHandlerImpl.java:63)
at com.b.watchdog.jaxb.generated.response.impl.MessageHeaderTypeImpl$Unmarshaller.leaveElement(MessageHeaderTypeImpl.java:245)
at com.b.watchdog.jaxb.generated.response.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SAXUnmarshallerHandlerImpl.java:141)
at org.iso_relax.verifier.impl.ForkContentHandler.endElement(ForkContentHandler.java:81)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.b.watchdog.jaxb.generated.response.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:140)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:136)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:145)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:163)
at com.b.watchdog.RestrictedListResponseConsumer.consumeResponse(RestrictedListResponseConsumer.java:81)
at com.b.watchdog.RestrictedListResponseConsumer.consumeResponses(RestrictedListResponseConsumer.java:52)
at com.b.watchdog.RestrictedListInterfaceManager.exchangeData(RestrictedListInterfaceManager.java:307)
at com.b.watchdog.RestrictedListInterfaceManager.main(RestrictedListInterfaceManager.java:282)My message is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<list_update_response xsi:schemaLocation="http://www.ab.com list_update_response.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ab.com">
<response_info>
<message_header>
<origin_country>FR</origin_country>
<destination_country>US</destination_country>
<message_datetime>2006-04-18T19:02:00.000+00:00</message_datetime>
</message_header>
</response_info>
<success>
<request_info>
<message_header>
<origin_country>US</origin_country>
<destination_country>FR</destination_country>
<message_datetime>2006-04-20T18:40:31.000+00:00</message_datetime>
</message_header>
</request_info>
</success>
</list_update_response>My XSDs are:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ab.com" xmlns="http://www.ab.com">
<xsd:include schemaLocation="list_update_common.xsd" />
<xsd:element name="description" type="positive_length_token" />
<xsd:element name="error">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" ref="request_info" />
<xsd:element ref="errors" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="errors">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded" minOccurs="1">
<xsd:element ref="validation_error" />
<xsd:element ref="general_logical_error" />
<xsd:element ref="item_logical_error" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="general_logical_error">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="description" />
<xsd:element minOccurs="0" ref="line_number" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="item_logical_error">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="description" />
<xsd:element minOccurs="0" ref="line_number" />
</xsd:sequence>
<xsd:attribute name="item_id" type="item_id" use="required" />
<xsd:attribute name="item_creation_country" type="country_code" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="line_number" type="xsd:positiveInteger" />
<xsd:element name="list_update_response">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="response_info" />
<xsd:choice>
<xsd:element ref="error" />
<xsd:element ref="success" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="response_info">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="message_header" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="success">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="request_info" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="validation_error">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="description" />
<xsd:element ref="line_number" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ab.com" xmlns="http://www.ab.com">
<xsd:simpleType name="country_code">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z]{2}" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="destination_country" type="country_code" />
<xsd:simpleType name="item_id">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[A-Z0-9]{12}" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="message_datetime" type="utc_datetime" />
<xsd:element name="message_header">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="origin_country" />
<xsd:element ref="destination_country" />
<xsd:element ref="message_datetime" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="origin_country" type="country_code" />
<xsd:simpleType name="positive_length_token">
<xsd:restriction base="xsd:token">
<xsd:minLength value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="request_info">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="message_header" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="utc_datetime">
<xsd:restriction base="xsd:dateTime">
<xsd:pattern value=".*(\+00\:00|\-00\:00|Z)" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>Any thoughts?
Thanks.
- Luke
I fixed the problem.
Similar Messages
-
Javax.xml.bind.UnmarshalException
I am using JAXB to parse the xml file. The sample of my xml file is given below:
<rdcData version="1.0" target="NDA-RDC">
<entity event="D" subtype="String" type="I">
<header>
<PI>10408819</PI>
</header>
<content>
<property id="27007">
<currValue classifier="code"/>
<validFrom>20050702</validFrom>
<validTo>20050703</validTo>
</property>
</content>
</entity>
</rdcData>
And at runtime I am gettting the following exception.
javax.xml.bind.UnmarshalException: Unexpected element {}:entity
Someone please help me to solve this problem.HI Smile,
Thanks for the reply.
Here is the complete description of the error.
DefaultValidationEventHandler: [ERROR]: Unexpected element {}:entity
Location: line 3 of file:/C:/new%20eclispe/workspace/RDCLoader/incr.xml
javax.xml.bind.UnmarshalException: Unexpected element {}:entity
at com.reuters.rdcrefdata.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(SAXUnmarshallerHandlerImpl.java:577)
at com.reuters.rdcrefdata.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:139)
at com.reuters.rdcrefdata.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:136)
at com.reuters.rdcrefdata.impl.runtime.AbstractUnmarshallingEventHandlerImpl.unexpectedEnterElement(AbstractUnmarshallingEventHandlerImpl.java:147)
at com.reuters.rdcrefdata.impl.runtime.AbstractUnmarshallingEventHandlerImpl.enterElement(AbstractUnmarshallingEventHandlerImpl.java:60)
at com.reuters.rdcrefdata.impl.RdcDataImpl$Unmarshaller.enterElement(RdcDataImpl.java:176)
at com.reuters.rdcrefdata.impl.runtime.SAXUnmarshallerHandlerImpl.startElement(SAXUnmarshallerHandlerImpl.java:125)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:575)
at com.sun.xml.bind.unmarshaller.InterningXMLReader.startElement(InterningXMLReader.java:74)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:575)
at com.reuters.rdcrefdata.load.Splitter.startElement(Splitter.java:190)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:485)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:326)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1563)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:341)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:828)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:758)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1105)
at com.reuters.rdcrefdata.load.OrganisationRefDataLoader.main(OrganisationRefDataLoader.java:114)
Exception in thread "main"
If you see the first line you will notice that the "SAXUnmarshallerHandlerImpl.java" class which is generated by the jaxb and put into the folder "impl.runtime".
And hence I am sure that the error lies in the classes generated by the jaxb only.
The xml that I have used here is ,
<?xml version="1.0" encoding="UTF-8"?>
<rdcData version="1.0" target="NDA-RDC">
<entity event="U" subtype="ORD" type="Q">
<header>
<PI>5073152</PI>
</header>
<content>
<property id="27207">
<currValue>BAC 5.020 08/22/06 FRN MTN</currValue>
<validFrom>20060301</validFrom>
<validTo>20060306</validTo>
</property>
<property id="27207">
<currValue>BAC 5.400 08/22/06 FRN MTN</currValue>
<validFrom>20060530</validFrom>
<validTo>20060530</validTo>
</property>
</content>
</entity>
</rdcData>
Hope above information will be sufficient for you to help me.
Regards -
Problem with JAXB Unmarshall - javax.xml.bind.UnmarshalException
Hi,
I'm getting an expection while unmarshalling using JAXB. The error is as follows :
DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://www.etrade.com/ee/systemdomainao/search", local:"Context_Id"). Expected elements are <{}contextId>,<{}predicateInterceptor>,<{}isDefaultsearch>,<{}implicitContextSQL>,<{}contextName>,<{}searchId>,<{}implicitContextText>
I've generated JAXB classes using xjc command from my schema. The root element is Search object which has a List of Searchcontext and Columlist object. When I'm trying to unmarshall the XML, I'm getting the above exception. What is baffling, if I comment out the <tns:SearchContext> entry from the XML, unmarshall doesn't throw any exception and populates the columnlist properly. Columnlist and Searchcontext have little difference except that columnlist contains more elements.
Here'e the unmarshall code,
URL metadataURL = this.getClass().getClassLoader().getResource("metadata/search/PARTICIPANT.xml");
JAXBContext jc = JAXBContext.newInstance("com.etrade.ee.systemdomainao.search.domain");
Unmarshaller unmarshaller = jc.createUnmarshaller();
unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
Search search = (Search)unmarshaller.unmarshal(metadataURL);
Any pointers will be highly appreciated.
ThanksXSD :
XSD :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.etrade.com/ee/systemdomainao/search" targetNamespace="http://www.etrade.com/ee/systemdomainao/search" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- Searchcontext type definition -->
<xs:complexType name="Searchcontext">
<xs:sequence>
<xs:element name="Context_Id" type="xs:int"/>
<xs:element name="Search_Id" type="xs:string"/>
<xs:element name="Context_Name" type="xs:string"/>
<xs:element name="Implicit_Context_SQL" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="500"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Implicit_Context_Text" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="500"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Is_Defaultsearch" type="xs:boolean" nillable="true"/>
<xs:element name="Predicate_Interceptor" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
<!-- Searchlist type definition -->
<xs:complexType name="Columnlist">
<xs:sequence>
<xs:element name="Columnlist_Id" type="xs:int"/>
<xs:element name="Search_Id" type="xs:string"/>
<xs:element name="Is_Quicksearchable" type="xs:boolean" nillable="true"/>
<xs:element name="Is_Advancesearchable" type="xs:boolean" nillable="true"/>
<xs:element name="Is_Quicksearchview" type="xs:boolean" nillable="true"/>
<xs:element name="Is_Fullview" type="xs:boolean" nillable="true"/>
<xs:element name="Is_Sortable" type="xs:boolean" nillable="true"/>
<xs:element name="Is_Defaultsort" type="xs:boolean" nillable="true"/>
<xs:element name="Default_SortOrder" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="Display_Order" type="xs:int" nillable="true"/>
<xs:element name="Default_Value" type="xs:string" nillable="true" maxOccurs="6"/>
<xs:element name="Default_Operator" type="xs:string" nillable="true"/>
<xs:element name="Is_Closedset" type="xs:boolean"/>
<xs:element name="Closedset_List_Name" type="xs:string" nillable="true"/>
<xs:element name="Is_RelatedMenu" type="xs:boolean" minOccurs="0"/>
<xs:element name="Column_Name" type="xs:string"/>
<xs:element name="Display_Name" type="xs:string"/>
<xs:element name="Is_UDF" type="xs:boolean" nillable="true"/>
<xs:element name="Table_Name" type="xs:string"/>
<xs:element name="Data_Type" type="xs:string"/>
<xs:element name="Column_Size" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<!-- Search declaration -->
<xs:element name="Search">
<!--<choice>
<xs:interface name="java.io.Serializable" />
</choice>-->
<xs:complexType>
<xs:sequence>
<xs:element name="Search_Id" type="xs:string"/>
<xs:element name="Schema_Set">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SearchContext" type="tns:Searchcontext" maxOccurs="unbounded"/>
<xs:element name="ColumnList" type="tns:Columnlist" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="Search_PrimaryKey_1">
<xs:selector xpath="."/>
<xs:field xpath="tns:Search_Id"/>
</xs:key>
<xs:keyref name="Searchcontext_ForeignKey_1" refer="tns:Search_PrimaryKey_1">
<xs:selector xpath=".//tns:SearchContext"/>
<xs:field xpath="tns:Search_Id"/>
</xs:keyref>
<xs:keyref name="Columnlist_ForeignKey_2" refer="tns:Search_PrimaryKey_1">
<xs:selector xpath=".//tns:ColumnList"/>
<xs:field xpath="tns:Search_Id"/>
</xs:keyref>
<xs:key name="Searchcontext_PrimaryKey_1">
<xs:selector xpath=".//tns:SearchContext"/>
<xs:field xpath="tns:Context_Id"/>
</xs:key>
<xs:key name="Columnlist_PrimaryKey_1">
<xs:selector xpath=".//tns:ColumnList"/>
<xs:field xpath="tns:Columnlist_Id"/>
</xs:key>
</xs:element>
</xs:schema> -
JAXB - Unexpected end of element {} - UnmarshalException Exception
Hi
I am using Jaxb 1.0 Beta on AIX an I am getting javax.xml.bind.UnmarshalException exception when I try to unmarshall XML document. XML document and schema are valid ( I generated both using XML spy )
Interestingly, the code works fine on windows 2000 but when I put the jar ,XML schema and xml document on unix it throws Unmarshall exception.
Here's what I am trying to do.
Code :
JAXBContext jc =
JAXBContext.newInstance( context,
new com.xyz.retail.app.points.pgp.JAXBClassLoader());
if(jc != null)
System.out.println("Got the context");
else
System.out.println("Error in getting context");
System.out.println("");
// create an Unmarshaller
Unmarshaller u = jc.createUnmarshaller();
System.out.println("Created the Unmarshaller");
System.out.println("");
// Unmarshal securities document into Java content tree
SecurityInfo securityInfo =
(SecurityInfo)u.unmarshal( new FileInputStream( secFile ) );
System.out.println("Unmarshaled the Document");
System.out.println("");
Schema :
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Yogesh
-->
<xs:schema targetNamespace="http://www.xyz.com/retail/app/points/pgp/util"
xmlns="http://www.xyz.com/retail/app/points/pgp/util" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="SecurityInfo" type="SecurityInfoType"/>
<xs:complexType name="SecurityInfoType">
<xs:sequence>
<xs:element ref="AirlinePartners"/>
</xs:sequence>
</xs:complexType>
<xs:element name="AirlinePartners">
<xs:complexType>
<xs:sequence>
<xs:element ref="AirlinePartner" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AirlinePartner">
<xs:complexType>
<xs:sequence>
<xs:element name="CardType" type="xs:string"/>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="TPrivate" type="xs:string"/>
<xs:element name="TPassphrase" type="xs:string"/>
<xs:element name="APublic" type="xs:string"/>
<xs:element name="PlainText" type="xs:string"/>
<xs:element name="CypherText" type="xs:string"/>
<xs:element name="TKeyExpiry" type="xs:date" min
Occurs="0"/>
<xs:element name="AKeyExpiry" type="xs:date" min
Occurs="0"/>
</xs:sequence>
</xs:complexType>
/xs:element>
</xs:schema>
XML File :
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Yogesh
-->
<!--Sample XML file generated by XMLSPY v5 rel. 2 U (http://www.xmlspy.com)-->
<SecurityInfo xmlns="http://www.xyz.com/retail/app/points/pgp/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
"http://www.xyz.com/retail/app/points/pgp/util /home/lcards/temp/APSecInfo.xsd">
<AirlinePartners>
<AirlinePartner>
<CardType>x</CardType>
<Description>some card</Description>
<TPrivate>/home/lcards/temp/sachin.asc</TPrivate>
<TPassphrase>worldcup2003</TPassphrase>
<APublic>/home/lcards/temp/sunil.asc</APublic>
<PlainText>/home/lcards/files/outbox/x</PlainText>
<CypherText>/home/lcards/files/outbox/x</CypherText>
<TKeyExpiry>2005-08-15</TKeyExpiry>
<AKeyExpiry>2005-08-15</AKeyExpiry>
</AirlinePartner>
<AirlinePartner>
<CardType>y</CardType>
<Description>Another card</Description>
<TPrivate>/home/lcards/temp/kapil.asc</TPrivate>
<TPassphrase>worldcup1983</TPassphrase>
<APublic>/home/lcards/temp/dilip.asc</APublic>
<PlainText>/home/lcards/files/outbox/y</PlainText>
<CypherText>/home/lcards/files/outbox/y</CypherText>
<TKeyExpiry>2005-08-15</TKeyExpiry>
<AKeyExpiry>2005-08-15</AKeyExpiry>
</AirlinePartner>
</AirlinePartners>
</SecurityInfo>
Output:
Got the context
Created the Unmarshaller
DefaultValidationEventHandler: [ERROR]: Unexpected end of element {}:CardType
javax.xml.bind.UnmarshalException: Unexpected end of element {}:CardType
at com.sun.xml.bind.unmarshaller.UnreportedException.createUnmarshalExce
ption(UnreportedException.java:59)
at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.reportAndThr
ow(SAXUnmarshallerHandlerImpl.java:406)
at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.endElement(S
AXUnmarshallerHandlerImpl.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(Unmarshaller
Impl.java:139)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnm
arshallerImpl.java:129)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnm
arshallerImpl.java:166)
at com.xyz.retail.app.points.pgp.APSecurityInfoFactory.getAPSecInfo
(APSecurityInfoFactory.java:102)
at com.xyz.retail.app.points.pgp.EncryptAndSign.init(EncryptAndSign
.java:183)
at com.xyz.retail.app.points.pgp.EncryptAndSign.encrypt(EncryptAndS
ign.java:581)
at com.xyz.retail.app.points.pos.CreateExportFiles.main(CreateExpor
tFiles.java:149)
Inside readKeys()
java.lang.NullPointerException
at com.xyz.retail.app.points.pgp.EncryptAndSign.readKeys(EncryptAnd
Sign.java:215)
at com.xyz.retail.app.points.pgp.EncryptAndSign.encrypt(EncryptAndS
ign.java:583)
at com.xyz.retail.app.points.pos.CreateExportFiles.main(CreateExpor
tFiles.java:149)
Inside buildCypherTextFileName()
java.lang.NullPointerException
at com.xyz.retail.app.points.pgp.EncryptAndSign.buildCypherTextFile
Name(EncryptAndSign.java:311)
at com.xyz.retail.app.points.pgp.EncryptAndSign.encrypt(EncryptAndS
ign.java:667)
at com.xyz.retail.app.points.pos.CreateExportFiles.main(CreateExpor
tFiles.java:149)
Exception in Main method
Thanks in advance for any help.
Yogesh.I'm having error. I'm using the lastest JWSDP (1.3) with JDK 1.4.2
Here is my XML file:
<?xml version="1.0"?>
<dataQA>
<table name="ELECTORAL_DISTRICT" >
<rules>
<rule number="1.1" description="Check if we have 301 EDs" >
<query result="301" >
<sql>SELECT COUNT(ED_ID) FROM ELECTORAL_DISTRICT</sql>
</query>
</rule>
<rule number="1.3" description="All fields must be populated" >
<query result="0" >
<sql>SELECT COUNT(ED_ID) FROM ELECTORAL_DISTRICT WHERE ED_CODE IS NULL OR ED_NAMEE IS NULL OR ED_NAMEF IS NULL</sql>
</query>
</rule>
</rules>
<reports>
<report number="1.4" name="Listing of EDs" file="ed_list" format="HTML" >
<column name="ED_ID" label="ID" ></column>
<column name="ED_CODE" label="Code" ></column>
<column name="ED_NAMEE" label="English Name" ></column>
<column name="ED_NAMEF" label="French Name" ></column>
<column name="PRVNC_ID" label="Province ID" ></column>
</report>
</reports>
</table>
</dataQA>
And my shema:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="dataQA" type="DataQAType"/>
<xsd:complexType name="DataQAType">
<xsd:sequence>
<xsd:element name="table" type="TableType" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TableType">
<xsd:sequence>
<xsd:element name="rules" type="RulesType" />
<xsd:element name="reports" type="ReportsType" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="RulesType">
<xsd:sequence>
<xsd:element name="rule" minOccurs="1" maxOccurs="unbounded" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="query" type="QueryType" />
</xsd:sequence>
<xsd:attribute name="number" type="xsd:string" />
<xsd:attribute name="description" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ReportsType">
<xsd:sequence>
<xsd:element name="report" minOccurs="1" maxOccurs="unbounded" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="column" type="ColumnType" minOccurs="1" maxOccurs="unbounded" />
<xsd:element name="condition" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="number" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="file" type="xsd:string" />
<xsd:attribute name="format" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ColumnType">
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="label" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="QueryType">
<xsd:sequence>
<xsd:element name="sql" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="result" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
I get the following exception:
DefaultValidationEventHandler: [FATAL_ERROR]: Unexpected end of element {}:report
Location: line 23 of file:/D:/Revise2.5/DataQA/config/test.xml
javax.xml.bind.UnmarshalException: Unexpected end of element {}:report
I'm currenlty in the processing of writting parser with DOM since I haven't found the yet. Is this a bug or I'm doing something wrong.
Thanks in advance for the reply,
- N. Thomassin -
PML parsing problem: Unexpected end of element
Hi everybody,
I'm trying to use Sun's PML-parser (com.sun.autoid.pmlcore.pmlparser.PmlParser) to create an XML file and
then parse it again. So my source looks like that:
Create:
PmlParser pmlParser = new PmlParser();
ObjectFactory objFactory = pmlParser.getPMLObjectFactory();
sensor = objFactory.createSensor();
IdentifierType idType = objFactory.createIdentifierType();
idType.setValue("urn:epc:id:gid:1.700.1");
sensor.setID(idType);
String xml = pmlParser.marshal(sensor);
// and then write to file
Parse:
PmlParser pmlParser = new PmlParser();
Sensor sensor = pmlParser.unmarshalPML(new File(fileName));
That is pretty much straight from Sun's developer guide (817-7897-10.pdf).
The problem is that I always get an exception when trying to "unmarshalPML" the file:
javax.xml.bind.UnmarshalException: Unexpected end of element {}:ID
at com.sun.autoid.epcis.xml.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(SAXUnmarshallerHandlerImpl.java:551)
at com.sun.autoid.epcis.xml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:148)
at com.sun.autoid.epcis.xml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.reportError(AbstractUnmarshallingEventHandlerImpl.java:145)
at com.sun.autoid.epcis.xml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.unexpectedLeaveElement(AbstractUnmarshallingEventHandlerImpl.java:162)
at com.sun.autoid.epcis.xml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.leaveElement(AbstractUnmarshallingEventHandlerImpl.java:72)
at com.sun.autoid.pmlcore.pml.impl.IDImpl$Unmarshaller.leaveElement(IDImpl.java:229)
at com.sun.autoid.epcis.xml.impl.runtime.AbstractUnmarshallingEventHandlerImpl.revertToParentFromLeaveElement(AbstractUnmarshallingEventHandlerImpl.java:343)
at com.sun.autoid.pmlcore.pml.impl.IdentifierTypeImpl$Unmarshaller.leaveElement(IdentifierTypeImpl.java:341) at com.sun.autoid.epcis.xml.impl.runtime.SAXUnmarshallerHandlerImpl.endElement(SAXUnmarshallerHandlerImpl.java:146)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.autoid.epcis.xml.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:142)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:136)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:145)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:163)
at com.sun.autoid.util.XmlParser.unmarshal(XmlParser.java:55)
at com.sun.autoid.pmlcore.pmlparser.PmlParser.unmarshalPML(PmlParser.java:47)
at DOMgui4_PML.xmlToTinyDB.procQuery(xmlToTinyDB.java:58)
at DOMgui4_PML.Server.createConnection(Server.java:68)
at DOMgui4_PML.xmlToTinyDB.main(xmlToTinyDB.java:117)
This occurs with any XML/PML file I try, even with those given in the "PML_Core_Specification_v1.0.pdf" as
examples. I really don't know what the problem is, maybe anybody has an idea..?
Thanks a lot,
DocEWi have installed Sun Rfid Software but pml-util.jar
is not included.
Where can I find it?
please help me -
I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar file in weblogic
classpath in setEnv script. I am getting the following error, when I am trying
to use jaxb
java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
I tried other options also like coping both jar file in jre/ext dir but then I
got security error.
I will appreciate if someone in this newsgroup comments or suugest some solution.
Thanks
JeewanOn 06 Aug 2002, Jeewan wrote:
>
I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar
file in weblogic classpath in setEnv script. I am getting the
following error, when I am trying to use jaxb
java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
I tried other options also like coping both jar file in jre/ext dir
but then I got security error.
I will appreciate if someone in this newsgroup comments or suugest
some solution. Put the jaxb jar file in in your webapp's WEB-INF/lib directory and it
should work fine.
Barry -
I want to marshall a java content tree (generated with jaxb api) in xml stream
in an EJB.
Generated classes are archived in a jar file containing its jaxb.properties, when
I test it
in a classic java process it runs well.
When I try to do it in an EJB with weblogic 8.1 I get the following error:
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package
I've checked:
- jaxb.properties is in the archive file
I've tried to put the jar file in the classpath of the server in the starter script.
I've tried to put reference classpath in the manifest of the ejb jar and of application
ear.
I've tried to put both reference in server classpath and ear/jar manifest.
I still doesn't run.
Any idea?
Thanks a lot
FranckAdd the directory of the generated classes in the classpath.
"franck" <[email protected]> wrote:
>
I want to marshall a java content tree (generated with jaxb api) in xml
stream
in an EJB.
Generated classes are archived in a jar file containing its jaxb.properties,
when
I test it
in a classic java process it runs well.
When I try to do it in an EJB with weblogic 8.1 I get the following error:
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package
I've checked:
- jaxb.properties is in the archive file
I've tried to put the jar file in the classpath of the server in the
starter script.
I've tried to put reference classpath in the manifest of the ejb jar
and of application
ear.
I've tried to put both reference in server classpath and ear/jar manifest.
I still doesn't run.
Any idea?
Thanks a lot
Franck -
How do I marshall a list using javax.xml.bind.annotation?
Hopefully this is so simple a cave man could do it.
I had to remove the Duke Stars for the time being. I found another bug in the program that may have resulted in my array being empty.
I'm trying to marshall a standalone document of my DeckImpl class. It is a deck of cards of course. It contains an array of CardImpl objects that need to be marshalled too. I could not figure out how to marhall the array so I have a marshall(Marshaller m) method that will
initialize the List (see below) with an ArrayList. I figured the marshaller would do the rest but I just get the declaration and a closed <DECK />tag with the correct attributes (see way below) when I comment out the @XmlElementWrapper, or a DECK root node that simply contains a closed <CARDS /> tag with the line enabled. You can see tha CardImpl class is annotated too.
I must be missing something obvious. Please help.
@XmlRootElement(name = "DECK")
@XmlType(name = "DECK")
public class DeckImpl implements Comparable<DeckImpl> {
@XmlAttribute
public int id;
@XmlAttribute
public boolean isShuffled;
@XmlAttribute
public boolean isCut;
public CardImpl[] cards;
@XmlElementWrapper(name="CARDS")
@XmlElements(@XmlElement(name="CARD",type=CardImpl.class))
public List<CardImpl> CARDS;
private static JAXBContext context;
private static Marshaller marshaller;
public DeckImpl(int id, boolean isCut, boolean isShuffled,
CardImpl[] cards) {
this.id = id;
this.isShuffled = isShuffled;
this.isCut = isCut;
this.cards = cards;
try {
context = JAXBContext.newInstance(DeckImpl.class);
marshaller = context.createMarshaller();
} catch (JAXBException ex) {
Logger.getLogger(CardImpl.class.getName()).log(Level.SEVERE, null, ex);
//... class code goes here
/** Generates XML representation of a deck
* @param writer
* @throws javax.xml.bind.JAXBException
public void marshall(Writer writer) throws JAXBException {
CARDS = new ArrayList<CardImpl>(cards.length);
for (CardImpl i : cards) {
CARDS.add(i);
marshaller.marshal(this, writer);
@XmlType(name = "CARD")
public class CardImpl implements Comparable<CardImpl> {
@XmlElement(name = "NAME")
public String name;
@XmlElement(name = "SUIT")
public String suit;
@XmlAttribute
public int value;
@XmlAttribute
public int pointValue;
//... class code
}The output is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><DECK isCut="false" isShuffled="true" id="1"/>Regards,
Bill
Edited by: bthayer on Jan 24, 2009 7:15 AM
Edited by: bthayer on Jan 25, 2009 7:02 AMThere's a bit in here on marshalling.
http://java.sun.com/webservices/docs/1.4/tutorial/doc/index.html
Problem with JAXB (and I could be wrong - try posting on the Web Services / XML forum) is that you can only marshal the generated classes. This may mean that you need to create the object, and populate it using the setter / getter methods.
Castor is much more friendly for this as it can marshall objects using reflections. You may also want to look into XMLBeans (which I have no exp of) -
How do I install javax.xml.bind...
Hi,
I'm kind of a beginner in the java world and I have some serious problems when I'm trying to use JAXB.
I have downloaded JDK 1.5.0_6, Java WebServices Dev Kit 2.0 and when I try to run a simple example I receive these compiler errors:
package javax.xml.bind does not exist
package javax.xml.marshall does not exist......etc.
What do I do wrong. I've tried for 2 days to get this @#$ example to work, can someone help me out please.
Thanksjavax.xml.bind couldn't have been around in 2002, so i'm not sure what is wrong w/ that tutorial.
What I want to do is to create XML data and read and
write it from a file. What is the best way to do
this??You don't need JAXB or binding for this, although it probably can be used for this as well. What you probably need is JAXP, such as SAX or DOM APIs.
I've read about about JAXP in the past in J2EE 1.4 Tutorial:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/J2EETutorial.pdf.
You may want to read up on SAX and DOM there or in another one. I forgot a lot of the stuff, but this should get you started on SAX:
public static void main(String argv[])
if (argv.length != 1) {
System.err.println("Usage: cmd filename");
System.exit(1);
// Use an instance of ourselves as the SAX event handler
DefaultHandler handler = new Echo();
// Use the default (non-validating) parser
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
// Set up output stream
out = new OutputStreamWriter(System.out, "UTF8");
// Parse the input
SAXParser saxParser = factory.newSAXParser();
saxParser.parse( new File(argv[0]), handler );
} catch (Throwable t) {
t.printStackTrace();
System.exit(0);
} -
Im using jaxb (tried both Jaxb1.0/2.0) classes for XML processing in my bpel Process developed using 10.1.3.5.0, and my bpel process compiled and deployed successfully to OAS. The error message I'm receiving now is Whn i try to invoke my by process.
Could anyone please let me know how to resolve this version compatability issue at OAS. I have an immediate requirement.
Error:
java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/Class;)Ljavax/xml/bind/JAXBContext;
at cosmos.ext118.utils.JaxbUtils.readXMLString(JaxbUtils.java:36)
at cosmos.ext118.utils.JaxbUtils.processLotDetails(JaxbUtils.java:58)
at bpel.damagedkitsintegration.ExecLetBxExe0.execute(ExecLetBxExe0.java:81)
at com.collaxa.cube.engine.ext.wmp.BPELXExecWMP.__executeStatements(BPELXExecWMP.java:50)
at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:200)
at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:4174)
at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1680)
at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:238)
at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:335)
at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:6285)
at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1111)
at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.__createAndInvoke(CubeEngineBean.java:128)
at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke(CubeEngineBean.java:171)
at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke(CubeEngineBean.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImplCan any one looked at this issue and please let me know if you the solution?
-
Unable to resolve "javax.xml.bind.InvalidAttributeException"
Hi all,
Iam facing a problem with my jaxb
the compiler is able to identify " javax.xml.bind.Marshaller" but it is not able to identify "javax.xml.bind.MissingContentException ","avax.xml.bind.PredicatedLists ","javax.xml.bind.InvalidContentObjectException ","javax.xml.bind.LocalValidationException "
Im using "jwsdp-1.5" and have set the classpath , could i please be known as to why im facing this problem. when i unjar and check the jaxb file i can find the "Marshaller" class file but i could not see the remaining which i mentioned above.
can anyone tell me as to which version of jaxb should i use?
this is very very urgent, any help in this matter is highly appreciated.
Thanks in advance.Hi John ,
I have the same problem: Getting the javax.jdo Packge . . . .(WHERE ?)
if you found out ow already, please tell me at: [email protected]
thanks,
edan -
Compiler can not find javax.xml.bind package classes
Hi
I have quite simple (I hope) problem. I'm trying to run some jaxb example but when I try to compile it I get:
Test.java:20: package javax.xml.bind does not exist
import javax.xml.bind.JAXBContext;
^
Test.java:21: package javax.xml.bind does not exist
import javax.xml.bind.Marshaller;
^
Test.java:22: package javax.xml.bind does not exist
import javax.xml.bind.Unmarshaller;
^
Test.java:23: package javax.xml.bind does not exist
import javax.xml.bind.Validator;
^I added to my classpath all packages I found to have anything in common with jaxb:
jaxb-api.jar
jaxb-xjc.jar
jaxb-ri.jar
jaxb.libs.jar
jaxp-api.jar
sax.jar
dom.jar
xercesImpl.jar
xalan.jar
jax-qname.jar
namespace.jar
All of those are taken from jwsdp-1.6
Any ideas?
aniaAdd the following .jar files to the CLASSPATH variable.
<JWSDP>/jaxb/lib/jaxb-api.jar
<JWSDP>/jaxb/lib/jaxb-impl.jar
<JWSDP>/jaxb/lib/jaxb-libs.jar
<JWSDP>/jaxb/lib/jaxb-xjc.jar
<JWSDP>/jwsdp-shared/lib/namespace.jar
<JWSDP>/jwsdp-shared/lib/jax-qname.jar
<JWSDP>/jwsdp-shared/lib/relaxngDatatype.jar
<JWSDP> is the directory in which Java Web Service Developer Pack 1.5 is installed. -
Problem testing WebMethod. Throwing javax.xml.bind.JAXBException
Hi guys,
Another Newbie.
Specifications:
NetBeans5.5
Sun App Server 9.0_01 (build b02-p01)
MySQL
Problem: Not able to test run the Webmethod with webparams.
I have an entity class with some methods as shown below
public class Country {
private Integer countryID;
private ServerDatabaseInteraction di;
private String countryName;
/** Creates a new instance of Country */
public Country(ServerDatabaseInteraction di) {
this.di = di;
* Creates a new instance of Country with the specified values.
* @param countryID the countryID of the Country
public Country(Integer countryID) {
this.countryID = countryID;
* Creates a new instance of Country with the specified values.
* @param countryID the countryID of the Country
* @param countryName the countryName of the Country
public Country(Integer countryID, String countryName, ServerDatabaseInteraction di) {
this.di = di;
this.countryID = countryID;
this.countryName = countryName;
* Gets the countryID of this Country.
* @return the countryID
public Integer getCountryID() {
return this.countryID;
* Sets the countryID of this Country to the specified value.
* @param countryID the new countryID
public void setCountryID(Integer countryID) {
this.countryID = countryID;
* Gets the countryName of this Country.
* @return the countryName
public String getCountryName() {
return this.countryName;
* Sets the countryName of this Country to the specified value.
* @param countryName the new countryName
public void setCountryName(String countryName) {
this.countryName = countryName;
public void insert() throws SQLException {
di.update("INSERT INTO Country (CountryName) VALUES ('"+getCountryName()+"')");
public ArrayList list() throws SQLException {
ArrayList queryAL = new ArrayList();
ResultSet rs = di.queryToResultSet("SELECT CountryID, CountryName FROM Country");
while(rs.next()) {
String temp = rs.getInt(1)+"#"+rs.getString(2);
queryAL.add(temp);
return queryAL;
} then I created a Web service having two methods as follows
@WebService
public class CountryWS {
ServerDatabaseInteraction di;
Country country;
public CountryWS() {
try {
di = new ServerDatabaseInteraction();
} catch (Exception ex) {
ex.printStackTrace();
country = new Country(di);
* Web service operation
@WebMethod
public ArrayList listPKobjects() {
try {
return country.list();
} catch (SQLException ex) {
ex.printStackTrace();
return null;
* Web service operation
@WebMethod
public String insert(@WebParam(name = "CountryName") String CountryName) {
// TODO implement operation
country.setCountryName(CountryName);
try {
country.insert();
return "Inserted";
} catch (SQLException ex) {
ex.printStackTrace();
return "Insert Failed";
}Now the problem is Im able to test (by right clicking on webservice from IDE) the webmethod listPKObjects but not the insert method. only difference is the second one is having webparms.
the log shows as follows..
CountryName is not a valid property on class myhost.fli.ws.jaxws.Insert
javax.xml.bind.JAXBException: CountryName is not a valid property on class myhost.fli.ws.jaxws.Insert
at com.sun.xml.ws.encoding.EncoderDecoderBase.getRawAccessor(EncoderDecoderBase.java:128)
at com.sun.xml.ws.encoding.EncoderDecoderBase.getWrapperChildValue(EncoderDecoderBase.java:81)
at com.sun.xml.ws.encoding.soap.EncoderDecoder.fillData(EncoderDecoder.java:78)
at com.sun.xml.ws.encoding.soap.ServerEncoderDecoder.toMessageInfo(ServerEncoderDecoder.java:97)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageInfo(SOAPMessageDispatcher.java:209)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:573)
at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:147)
at com.sun.xml.ws.server.Tie.handle(Tie.java:90)
at com.sun.enterprise.webservice.JAXWSServlet.doPost(JAXWSServlet.java:195)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: javax.xml.bind.JAXBException: CountryName is not a valid property on class myhost.fli.ws.jaxws.Insert
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:816)
at com.sun.xml.ws.encoding.EncoderDecoderBase.getRawAccessor(EncoderDecoderBase.java:124)
... 34 moreCan't find a reason, why one webmethod is working and the other one is not.
Any help would be much appriciated.I'm encountering the same problem, but it's very inconsistent. I've got three web services that I'm deploying. If I clean, rebuild, and redeploy, then different combinations of the three throw this error.
My specifications:
NetBeans 6.0
GlassFish v2
Oracle 10g
In browsing around online, I came across the following link which suggested to me that this issue is known and is being addressed.
https://jax-ws.dev.java.net/issues/show_bug.cgi?id=419
I discovered that the reason that I was getting this error was because my web services all had the same operation names. When I renamed my operations in each service so that they had different names, this fixed the problem.
Hope this helps!
- Erich Musick -
Where to find javax.xml.bind and javax.jdo
One of my application require import javax.xml.bind and javax.jdo packages. I could not find them. Someone can help to let me know where to download them or they come with some other toll\packages?
Thanks
JohnHi John ,
I have the same problem: Getting the javax.jdo Packge . . . .(WHERE ?)
if you found out ow already, please tell me at: [email protected]
thanks,
edan -
Hi Experts,
We are developing a WebDynpro for java application in NWDI for XML File Uploading, we have followed the below given process for that
1) Created one XSD as per the client table structure.
2) Developed one java webserver for the XSD file using jwsdp1.6
3) Copied that generated folder in WebDynpro application
4) Included all the required JAX-B jars as External jar files
5) Finally Compiles the application
When running the application it is throwing the below exception
500 Internal Server Error Web Dynpro Container/SAP J2EE Engine/6.40
Failed to process request. Please contact your system administrator.
Error Summary
While processing the current request, an exception occured which could not be handled by the application or the framework.
If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
Root Cause
The initial exception that caused the request to fail, was:
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
at com.ae.energy.scm.wdp.InternalXMLFileUpload.<init>(InternalXMLFileUpload.java:403)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
We checked entire application to ensure all the required files included, Could you please give us the cause for this exception and please explain us the solution to resolve it.
We are very thankful for all the people who can give their support in resolving this issue.
Thanks in advance,
Sandeep BonamHi Sandeep,
If you are following DC developemnt for your project, then adding the required JAR files as External Jars will not suffice.
As at deployment, these "External Jars" are not considered.
You will need to create and External Library project, for incorporating the required jars.
For creation and use of External Library Project kindly follow Valery's blog:
/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
Hope it Helps.
Regards,
Alka.
Maybe you are looking for
-
My s key does not work on my keyboard.
Nothing I do will get my s key to work. Have replaced the keyboard, ran disk utility, fcsk/sbin -fy in safe mode, zapped the pram, reset smc, re-installed OS 10.6.7 and updated. Only way I can get an s is to copy one from a doc and paste it in as I h
-
Is Serverless Chat Possible???
I have simple question rite moment. that is serverless tcp session possible between computer A to B...while computer A is connected through Proxy at port 8080 and only 8080 is open for connection, and B is connected through modem..................
-
Hi, I have lot of old data in the data base specially Business Partners & Old Campaigns. My client wants to get rid of them. Can I understand how we can achieve archival of Business Partners & Campaigns.Pls guide on steps. If I archive willl I be abl
-
CS3/CS4/CS5 Win/Mac: Right mouse click menu
Hi How can I implement a menu on a right mouse click? Interfaces? Samples? Is it possible to create an own menu? Or append a menu point to an existing menu (right mouse click)? Thanks for every help. Hans
-
Security Update 2014-002 Black boxes and screen sticking
Today after installing the security update 2014-002 on mavericks i am getting black boxes or black backgrounds when shifting screens. In Safari when i am scrolling down it is behaving the same way displaying text and pictures stuck wile moving. Is th