I am using docx4j to parse docx file.
I downloaded all JARs from docx4j site docx4j downloads.
When I used it in code, it gives runtime error at very first line of code: -
WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("Global_OPO_Profile_EN.docx")));
Exception is:
INFO org.docx4j.utils.Log4jConfigurator .configure line 45 - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically.
ERROR org.docx4j.jaxb.Context .<clinit> line 64 - PANIC! No suitable JAXB implementation available
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.relationships
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:47)
at org.docx4j.jaxb.Context.<clinit>(Context.java:56)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
INFO org.docx4j.jaxb.Context .<clinit> line 76 - loading Context jc
ERROR org.docx4j.jaxb.Context .<clinit> line 102 - Cannot initialize context
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.wml
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.Context.<clinit>(Context.java:77)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
ERROR org.docx4j.openpackaging.contenttype.ContentTypeManager .parseContentTypesFile line 690 - java.lang.NullPointerException
org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:691)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
... 8 more
Java 1.5 does not include JAXB, so you need to download the JAXB reference implementation, and add it to your class path.
Related
I am getting error while creating SOAP request.
21 May 2018 18:28:20,791 [Worker[3]] INFO [EndpointDescriptionImpl] [1111907bbb5ef75aNTQwZDM5Y2UxNTYxYzY1Mzc2MGJlM2ViOWUxYjNjMzA.] Building AxisService from wsdl: file: /tmp/unpacked_1526941165474/META-INF/wsdl/WS11_WSDL.wsdl 21 May 2018 18:28:20,792 [Worker[3]] ERROR [WSDL11ToAxisServiceBuilder] [1111907bbb5ef75aNTQwZDM5Y2UxNTYxYzY1Mzc2MGJlM2ViOWUxYjNjMzA.] Schema for namespace 'http://ws.abc.com/' already contains type 'doLoginResponse java.lang.RuntimeException: Schema for namespace 'http://ws.abc.com/' already contains type 'doLoginResponse
at org.apache.ws.commons.schema.XmlSchema.addType(XmlSchema.java:311)
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:158)
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:347)
at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:140)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2186)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:306)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:297)
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:265)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.buildAxisServiceFromWSDL(EndpointDescriptionImpl.java:789)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.setupAxisService(EndpointDescriptionImpl.java:651)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:216)
at org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(EndpointDescriptionImpl.java:181)
at org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.updateEndpointDescription(ServiceDescriptionImpl.java:296)
at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.updateEndpoint(DescriptionFactoryImpl.java:268)
at org.apache.axis2.jaxws.description.DescriptionFactory.updateEndpoint(DescriptionFactory.java:96)
at org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:233)
at javax.xml.ws.Service.getPort(Service.java:92)
at com.alestra.ws.AddressWebService_Service.getAddressWebServicePort(AddressWebService_Service.java:51)
Can anyone suggest ?
Using java 1.6 and axis2 jars.
I also observered that in one system same code is working fine but in other code is getting this issue. I think this is not coding issue, may be some jar or other issue but not sure.
I'm using commons-configuration 1.10 and would like to have my configuration file created only when needed.
For now, I have
XMLConfiguration config= new XMLConfiguration(file);
config.setReloadingStrategy(new FileChangedReloadingStrategy());
config.setAutoSave(true);
But, when I try to call
config.setProperty("portal.0.name", portal.getName());
I get
Caused by: org.apache.commons.configuration.ConfigurationException: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
at org.apache.commons.configuration.XMLConfiguration.createDocument(XMLConfiguration.java:914)
at org.apache.commons.configuration.XMLConfiguration.save(XMLConfiguration.java:1034)
at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration$FileConfigurationDelegate.save(AbstractHierarchicalFileConfiguration.java:570)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:557)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:524)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:474)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:441)
at org.apache.commons.configuration.AbstractFileConfiguration.save(AbstractFileConfiguration.java:418)
at org.apache.commons.configuration.AbstractFileConfiguration.possiblySave(AbstractFileConfiguration.java:749)
... 29 more
Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
at org.apache.xerces.dom.CoreDocumentImpl.createElement(Unknown Source)
at org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor.insert(XMLConfiguration.java:1529)
at org.apache.commons.configuration.HierarchicalConfiguration$BuilderVisitor.visitBeforeChildren(HierarchicalConfiguration.java:1734)
at org.apache.commons.configuration.HierarchicalConfiguration$Node.visit(HierarchicalConfiguration.java:1401)
at org.apache.commons.configuration.HierarchicalConfiguration$Node.visit(HierarchicalConfiguration.java:1407)
at org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor.processDocument(XMLConfiguration.java:1504)
at org.apache.commons.configuration.XMLConfiguration.createDocument(XMLConfiguration.java:908)
... 37 more
Which seems to indicate file can't be saved by autosave mechanism.
So, is there something I do bad ?
And how can I create the configuration while creating the file only when needed (cause otherwise it will require some weird XML file copy)
I used portal.0.name where I should have used portal(0).name, which was solved by ... well ... reading the doc.
I am trying to convert the wdsl to java by using axis2 script wsdl2java.sh and getting the following exception
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.databinding.UnmatchedTypeException: No type was mapped to the name OTRS_SessionCreate with namespace http://172.22.1.76/TicketConnector/
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.databinding.UnmatchedTypeException: No type was mapped to the name OTRS_SessionCreate with namespace http://172.22.1.76/TicketConnector/
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:537)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:282)
... 2 more
Caused by: org.apache.axis2.wsdl.databinding.UnmatchedTypeException: No type was mapped to the name OTRS_SessionCreate with namespace http://172.22.1.76/TicketConnector/
at org.apache.axis2.wsdl.databinding.TypeMappingAdapter.getTypeMappingName(TypeMappingAdapter.java:82)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputParamElement(AxisServiceBasedMultiLanguageEmitter.java:3011)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputElement(AxisServiceBasedMultiLanguageEmitter.java:2793)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2358)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2242)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForCallbackHandler(AxisServiceBasedMultiLanguageEmitter.java:1232)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeCallBackHandlers(AxisServiceBasedMultiLanguageEmitter.java:1198)
at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:500)
... 3 more
and the following is the wsdl file ,please guys really need help at this one trying to integrate otrs ,using this file for generating the stubs
plase do help me in this
thanks
When I'm trying to parse the Aramex shipping services WSDL (which is needed to create shipments), a namespace error occurs with following error log:
C:\Program Files\Java\jdk1.6.0_37\bin>wsimport.exe -keep -verbose D:\ATG\aramex\shipping-services-api-wsdl\shipping-services-api-wsdl.wsdl -d D:\ATG\aramex\java\
parsing WSDL...
[WARNING] src-resolve.4.2: Error resolving component 'ser:guid'. It was detected that 'ser:guid' is in namespace 'http://schemas.microsoft.com/2003/10/Serialization/', but components from this namespace are not referenceable from schema document 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'ser:guid'
needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1'.
line 331 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl#types?schema1
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 126 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
[ERROR] (Related to above error) This is the other declaration.
line 57 of file:/D:/ATG/aramex/shipping-services-api-wsdl/shipping-services-api-wsdl.wsdl
How can I get rid of the error?
OK i resolved it. I changed one declaration and after the it worked.
I am a Java developer. I'm working with a legacy system which is using Strtus1.2.9. After I added some jar file to this system and started the Tomcat, some error message display in the console. It seems like some of old xml file can not pass the parse. The tracback is like the following:
ERROR - Digester.error(1463) | Parse Error at line 396 column 35: Element type "var-value" must be declared.
org.xml.sax.SAXParseException: Element type "var-value" must be declared.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1171)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.commons.digester.Digester.parse(Digester.java:1591)
at org.apache.commons.validator.ValidatorResources.<init>(ValidatorResources.java:159)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:237)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:162)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
It seems like some xml has DTD version compatible issue. Why this error never display before. I just add these new jar files:
antlr-runtime-3.1.3.jar
drools-api-5.1.0.jar
drools-compiler-5.1.0.jar
drools-core-5.1.0.jar
drools-decisiontables-5.1.0.jar
drools-templates-5.1.0.jar
flatworm-2.0.1.jar
freemarker.jar
jxl-2.6.10.jar
jxls-reader-0.9.6.jar
mvel2-2.0.16.jar
xml-apis.jar