Skip to content
Advertisement

Get “error in opening zip file” on new Smooks()

I get an error when I try to generate a new Smooks instance:

Smooks smooks = new Smooks("conf/smooks-config.xml");

the smooks-config.xml:

<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd">

    <edifact:parser schemaURI="/d03b/EDIFACT-Messages.dfdl.xsd"/>
    <edifact:unparser schemaURI="/d03b/EDIFACT-Messages.dfdl.xsd" unparseOnElement="/Interchange"/>
</smooks-resource-list>

Why? What I do wrong? I use Smooks-2.0.0-M3

Here is the Stacktrace:

org.smooks.api.SmooksException: error in opening zip file
    at org.smooks.engine.DefaultApplicationContext.<init>(DefaultApplicationContext.java:93)
    at org.smooks.engine.DefaultApplicationContextBuilder.build(DefaultApplicationContextBuilder.java:90)
    at org.smooks.Smooks.<init>(Smooks.java:152)
    at org.smooks.Smooks.<init>(Smooks.java:182)
    at de.edi.ProcessorSmooksInit.process(ProcessorSmooksInit.java:23)
    at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:344)
    at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:68)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:172)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
    at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
    at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:101)
    at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)
    at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:220)
    at org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:183)
    at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:176)
    at org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:136)
    at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:105)
    at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)
    at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:454)
    at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:226)
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:190)
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:225)
    at java.util.zip.ZipFile.<init>(ZipFile.java:155)
    at java.util.zip.ZipFile.<init>(ZipFile.java:169)
    at org.smooks.classpath.Scanner.handleArchive(Scanner.java:121)
    at org.smooks.classpath.Scanner.scanClasspath(Scanner.java:104)
    at org.smooks.engine.DefaultApplicationContext.<init>(DefaultApplicationContext.java:91)
    ... 43 more

But I don’t use a Zip-File on any Parts. I use smooks in a Apache Camel processor, but I don’t think that this have any impact.

Advertisement

Answer

Smooks is attempting to load classes from the JARs within its classpath. It cannot unpack a JAR which leads to the error you’re seeing. Perhaps the archive is corrupt? Unfortunately the error message doesn’t indicate which archive but you can easily find out by stepping into the code.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement