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.
Related
I am using db2 version 10.5 and inserting the values into the DB2JSON, created a simple standalone java program to retrieve all the values from the table(Collection) when I run the query I am getting the following error
Exception in thread "main" java.lang.RuntimeException: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:38)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:14)
at com.ibm.nosql.json.api.BaseResultIterator.next(BaseResultIterator.java:119)
at com.ibm.nosql.json.api.DBCursor.fetchResultsEagerly(DBCursor.java:801)
at com.ibm.nosql.json.api.DBCursor.find(DBCursor.java:895)
at com.ibm.nosql.json.api.DBCursor.hasNext(DBCursor.java:278)
at com.ws.Demo.TestingDemo.main(TestingDemo.java:47)
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.gd.a(gd.java:733)
at com.ibm.db2.jcc.am.gd.a(gd.java:66)
at com.ibm.db2.jcc.am.gd.a(gd.java:120)
at com.ibm.db2.jcc.am.kc.a(kc.java:2868)
at com.ibm.db2.jcc.am.kc.p(kc.java:525)
at com.ibm.db2.jcc.am.kc.Z(kc.java:2747)
at com.ibm.db2.jcc.am.ResultSet.getObjectX(ResultSet.java:1438)
at com.ibm.db2.jcc.am.ResultSet.getObject(ResultSet.java:1413)
at com.ibm.nosql.json.api.DBResultSet.getObject(DBResultSet.java:255)
at com.ibm.nosql.json.api.DBData.getObjectX(DBData.java:66)
at com.ibm.nosql.json.api.DBObjectRowHandler.getObjectID(DBObjectRowHandler.java:58)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:28)
... 6 more
Caused by: java.nio.charset.MalformedInputException: Input length = 290
at com.ibm.db2.jcc.am.r.a(r.java:19)
at com.ibm.db2.jcc.am.kc.a(kc.java:2864)
... 14 more
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:292)
at com.ibm.db2.jcc.am.r.a(r.java:16)
... 15 more
I also went throught few posts where it suggest to use db2.jcc.charsetDecoderEncoder=3 but I have no idea where to use it, and also I few other posts it is suggested touse the lastest version db2jcc.jar, I am using the jars that is present inside the db2 10.5 under sqllib folder. Anyone let me know how to fix this
Add the following environment variable(Java VM arguments) in your tomcat settings
-Ddb2.jcc.charsetDecoderEncoder=3
This worked.
You can set the charset decoder encoder using system property inside your Java code.
For example:
System.setProperty("db2.jcc.charsetDecoderEncoder", "3");
I'm trying to extract the content of a large dataset that contains a mix of files (pdf, doc, ppt).
I'm using tika-app-1.12.jar, when T run my code everything done perfectly then I got this error
Exception in thread "main" org.apache.tika.exception.TikaException:
Unexpected RuntimeException from
org.apache.tika.parser.microsoft.OfficeParser#3ea25501 at
org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:258)
at
org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:256)
at
org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
at
recruitmentprototyp.RecruitmentPrototyp.tikareadDoc(RecruitmentPrototyp.java:135)
at
recruitmentprototyp.RecruitmentPrototyp.doForAll(RecruitmentPrototyp.java:110)
at
recruitmentprototyp.RecruitmentPrototyp.main(RecruitmentPrototyp.java:897)
Caused by: java.lang.IllegalStateException: Pap style 19 claimed to
have itself as its parent, which isn't allowed at
org.apache.poi.hwpf.model.StyleSheet.createPap(StyleSheet.java:232)
at org.apache.poi.hwpf.model.StyleSheet.<init>(StyleSheet.java:120)
at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:346) at
org.apache.tika.parser.microsoft.WordExtractor.parse(WordExtractor.java:81)
at
org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:201)
at
org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:172)
at
org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:256)
... 5 more Java Result: 1
what should I do?!!
I am trying to read an *.xlsx file and i receive quite a lot of errors in the console. I am a beginner at this and please note that if i try to read *.xls files i have no problems there.
This is the code that i use:
public class XlsxTest {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream(new File("autotest2.xlsx"));
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheetAt(0);
FormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
for (Row row : sheet) {
for (Cell cell : row) {
switch (formulaEvaluator.evaluateInCell(cell).getCellType()) {
case Cell.CELL_TYPE_NUMERIC:
System.out.println(cell.getNumericCellValue() + "\t\t");
break;
case Cell.CELL_TYPE_STRING:
System.out.println(cell.getStringCellValue() + "\t\t");
break;
}
}
System.out.println();
}
}
}
When i try to run this i receive the following errors:
Exception in thread "main" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:465)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:173)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:278)
at XlsxTest.main(XlsxTest.java:18)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
... 4 more
Caused by: java.lang.ExceptionInInitializerError
at org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem.fillInType(BuiltinSchemaTypeSystem.java:1025)
at org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem.<clinit>(BuiltinSchemaTypeSystem.java:223)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.xmlbeans.XmlBeans.getNoType(XmlBeans.java:856)
at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:881)
at org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory.parse(Unknown Source)
at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:83)
... 9 more
Caused by: java.lang.RuntimeException: Installation Problem??? Couldn't load messages: Can't find bundle for base name org.apache.xmlbeans.impl.regex.message, locale en_US
at org.apache.xmlbeans.impl.regex.RegexParser.setLocale(RegexParser.java:88)
at org.apache.xmlbeans.impl.regex.RegexParser.<init>(RegexParser.java:78)
at org.apache.xmlbeans.impl.regex.ParserForXMLSchema.<init>(ParserForXMLSchema.java:28)
at org.apache.xmlbeans.impl.regex.RegularExpression.setPattern(RegularExpression.java:2996)
at org.apache.xmlbeans.impl.regex.RegularExpression.setPattern(RegularExpression.java:3009)
at org.apache.xmlbeans.impl.regex.RegularExpression.<init>(RegularExpression.java:2975)
at org.apache.xmlbeans.impl.regex.SchemaRegularExpression.<init>(SchemaRegularExpression.java:27)
at org.apache.xmlbeans.impl.regex.SchemaRegularExpression.<init>(SchemaRegularExpression.java:23)
at org.apache.xmlbeans.impl.regex.SchemaRegularExpression$1.<init>(SchemaRegularExpression.java:44)
at org.apache.xmlbeans.impl.regex.SchemaRegularExpression.buildKnownPatternMap(SchemaRegularExpression.java:43)
at org.apache.xmlbeans.impl.regex.SchemaRegularExpression.<clinit>(SchemaRegularExpression.java:38)
... 19 more
Can anyone help me with this issue? I hope that i provided the necessary information.
Thank you!
Rename jar of lib in zip or simply open org/apache/xmlbeans/impl/regex of loaded lib.
Find file message.properties (and message_xx.properties if necessary).
Put file(s) in used library by org/apache/xmlbeans/impl/regex path.
Profit!
I experienced the very similar exception when using Apache POI: a java.lang.ExceptionInInitializerError, caused by "java.lang.RuntimeException: Installation Problem??? Couldn't load messages: Can't find bundle for base name org.apache.xmlbeans.impl.regex.message" in XMLBeans.
Looked completely weird. Code worked on one machine but failed this way on another for no apparent reason.
After LOTS of debugging hours, I found out the reason was COMPLETELY unrelated to Excel, POI or XMLBeans: my project was located in the folder ending with "!". The solution was simply to rename the folder.
I guess the author had something similar happening, and indeed the linked post about Libre Office has nothing to do with this problem. Instead, the linked post should be the following: Unable to open resources in directories which end with an exclamation mark (!)
Got this error ONLY in junit test. Application runs perfectly fine. So check your case as well.
For test, following Sarck's suggestion worked. #4 is little confusing. So below is simple process.. works fine for 2.6 version of xmlbeans library.
In your project where this is failing, create a file named message.properties under src/test/resources/org/apache/xmlbeans/impl/regex folder. (src/test/resources is typical maven root resource folder). Add following content in that file
parser.parse.1=Wrong character.
parser.parse.2=Invalid reference number.
parser.next.1=A character is required after \\.
parser.next.2='?' is not expected. '(?:' or '(?=' or '(?!' or '(?<' or '(?#' or '(?>'?
parser.next.3='(?<=' or '(?<!' is expected.
parser.next.4=A comment is not terminated.
parser.factor.1=')' is expected.
parser.factor.2=Unexpected end of the pattern in a modifier group.
parser.factor.3=':' is expected.
parser.factor.4=Unexpected end of the pattern in a conditional group.
parser.factor.5=A back reference or an anchor or a lookahead or a lookbehind is expected in a conditional pattern.
parser.factor.6=There are more than three choices in a conditional group.
parser.atom.1=A character in U+0040-U+005f must follow \\c.
parser.atom.2=A '{' is required before a character category.
parser.atom.3=A property name is not closed by '}'.
parser.atom.4=Unexpected meta character.
parser.atom.5=Unknown property.
parser.cc.1=A POSIX character class must be closed by ':]'.
parser.cc.2=Unexpected end of the pattern in a character class.
parser.cc.3=Unknown name for a POSIX character class.
parser.cc.4='-' is invalid here.
parser.cc.5=']' is expected.
parser.cc.6='[' is invalid in a character class. Write '\\['.
parser.cc.7=']' is invalid in a character class. Write '\\]'.
parser.cc.8='-' is an invalid character range. Write '\\-'.
parser.ope.1='[' is expected.
parser.ope.2=')' or '-[' or '+[' or '&[' is expected.
parser.ope.3=The range end code point is less than the start code point.
parser.descape.1=Invalid Unicode hex notation.
parser.descape.2=Overflow in a hex notation.
parser.descape.3='\\x{' must be closed by '}'.
parser.descape.4=Invalid Unicode code point.
parser.descape.5=An anchor must not be here.
parser.process.1=This expression is not supported in the current option setting.
parser.quantifier.1=Invalid quantifier. A digit is expected.
parser.quantifier.2=Invalid quantifier. Invalid quantity or a '}' is missing.
parser.quantifier.3=Invalid quantifier. A digit or '}' is expected.
parser.quantifier.4=Invalid quantifier. A min quantity must be <= a max quantity.
parser.quantifier.5=Invalid quantifier. A quantity value overflow.
Duplicate this file as message_en.properties at same location.
If you are using newer version of xmlbeans jar then get content of this file from Apache source - replace version in url
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
It's my first time to deal with Pentaho Data Integration, so i'm trying to execute the job from the java, but i failed to to this ! although of the job is working good from Spoon.
this is my code:
jobMeta = new JobMeta(LogWriter.getInstance(), "E:\\rubbish\\job.kjb", null);
Job job = new Job(LogWriter.getInstance(), null , jobMeta);
job.start();
job.waitUntilFinished();
and this is the result which has an error !:
!INFO 01-07 16:32:03,305 - Using "C:\Users\AALKHA~1\AppData\Local\Temp\vf
_cache" as temporary files store.
ERROR 01-07 16:32:03,468 - null.0 - Unable to read Job Entry copy info from XML
node : org.pentaho.di.core.exception.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
ERROR 01-07 16:32:03,471 - null.0 - org.pentaho.di.core.exception.KettleStepLoa
erException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:110)
at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:922)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:726)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:693)
at ingramint.steps.fullIntStep.step1(fullIntStep.java:62)
at ingramint.steps.fullIntStep.<init>(fullIntStep.java:32)
at ingramint.libs.menuLib.mainMenu(menuLib.java:75)
at ingramint.Main.main(Main.java:24)
Jul 01, 2014 4:32:03 PM ingramint.steps.fullIntStep step1
SEVERE: null
org.pentaho.di.core.exception.KettleXMLException:
Unable to load the job from XML file [E:\rubbish\job.kjb]
Unable to load job info from XML node
Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
No valid step/plugin specified (jobPlugin=null) for SPECIAL
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:734)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:693)
at ingramint.steps.fullIntStep.step1(fullIntStep.java:62)
at ingramint.steps.fullIntStep.<init>(fullIntStep.java:32)
at ingramint.libs.menuLib.mainMenu(menuLib.java:75)
at ingramint.Main.main(Main.java:24)
Caused by: org.pentaho.di.core.exception.KettleXMLException:
Unable to load job info from XML node
Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
No valid step/plugin specified (jobPlugin=null) for SPECIAL
at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:968)
at org.pentaho.di.job.JobMeta.<init>(JobMeta.java:726)
... 5 more
Caused by: org.pentaho.di.core.exception.KettleXMLException:
Unable to read Job Entry copy info from XML node : org.pentaho.di.core.exceptio
.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
No valid step/plugin specified (jobPlugin=null) for SPECIAL
at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:134)
at org.pentaho.di.job.JobMeta.loadXML(JobMeta.java:922)
... 6 more
Caused by: org.pentaho.di.core.exception.KettleStepLoaderException:
No valid step/plugin specified (jobPlugin=null) for SPECIAL
at org.pentaho.di.job.entry.JobEntryCopy.<init>(JobEntryCopy.java:110)
... 7 more
i'm using theses jars:
kettle-core-3.2.2.jar
kettle-db-3.2.2.jar
kettle-engine-3.2.2.jar
so any suggestions please ?
Thank you,
Once have a look at the code pasted below and it worked. You need to add all the Jars present in the data-integration/lib to the classpath not only the ones you have mentioned above.
public class ExecuteJob {
public static void main(String[] args) throws Exception {
String filename = args[0];
KettleEnvironment.init();
JobMeta jobMeta = new JobMeta(filename, null);
Job job = new Job(null, jobMeta);
job.start();
job.waitUntilFinished();
if (job.getErrors()!=0) {
System.out.println(“Error encountered!”);
} }
}