<build>
    <plugins>
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-fatjar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.foo.NameOfMainClass</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

Sorry, I needed to use this syntax to make it work, as the site said 
(https://github.com/apache/camel/blob/main/tooling/maven/camel-maven-plugin/src/main/docs/camel-maven-plugin.adoc#camelprepare-fatjar
 

Thanks aagain 😊

-----Ursprüngliche Nachricht-----
Von: Penagos Jaime <jaime.pena...@ub.uni-muenchen.de> 
Gesendet: Donnerstag, 27. Juli 2023 15:16
An: 'users@camel.apache.org' <users@camel.apache.org>
Betreff: AW: Exception with Routes on Windows / Linux, Expected w3c Document

I have still a question about this plugin you recommended... would it be the 
same for an App that also includes Springboot and Camel Rest? 

With that app it worked ok, but now it says 

Error: Could not find or load main class ub.camel.wstest.Application Caused by: 
java.lang.ClassNotFoundException: ub.camel.wstest.Application

When I switch the current plugin I use for packaging the JAR file with the one 
you recommended it says

Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.5.0:shade 
(default) on project FedoraWSIntegrationODLMU: Unable to parse configuration of 
mojo org.apache.maven.plugins:maven-shade-plugin:3.5.0:shade for parameter 
resource: Cannot find 'resource' in class 
org.apache.maven.plugins.shade.resource.ManifestResourceTransformer -> [Help 1]

Thanks again for the help and advice.
Jaime


-----Ursprüngliche Nachricht-----
Von: Penagos Jaime <jaime.pena...@ub.uni-muenchen.de>
Gesendet: Donnerstag, 27. Juli 2023 13:48
An: 'users@camel.apache.org' <users@camel.apache.org>
Betreff: AW: Exception with Routes on Windows / Linux, Expected w3c Document

I am using maven-assembly-plugin by default. Will check the one you sent and 
see i fit works

-----Ursprüngliche Nachricht-----
Von: Claus Ibsen <claus.ib...@gmail.com>
Gesendet: Donnerstag, 27. Juli 2023 13:45
An: users@camel.apache.org
Betreff: Re: Exception with Routes on Windows / Linux, Expected w3c Document

Hi

Are you doing any fat/uber jar by any chance, then see this FAQ 
https://camel.apache.org/manual/faq/how-to-create-executable-jar-camel-main.html#_fat_jar_with_camel_maven_plugin

On Thu, Jul 27, 2023 at 1:33 PM Penagos Jaime < 
jaime.pena...@ub.uni-muenchen.de> wrote:

> Dear Camel community,
>
> I've been facing a weird problem with Camel (3.21.0) and my 
> development process (in Windows) and deployment (in Linux).
>
> I dont have any isses at all while testing / working on Windows. When 
> I deploy the routes on the server, I start getting these exceptions.
>
> --------------------------------------
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.NoTypeConversionAvailableException: No type converter 
> available to convert from type: java.lang.String to the required type:
> org.w3c.dom.Document
>         at
> org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51)
>         at
> org.apache.camel.language.xpath.XPathBuilder.getDocument(XPathBuilder.java:1309)
>         at
> org.apache.camel.language.xpath.XPathBuilder.doInEvaluateAs(XPathBuilder.java:1054)
>         at
> org.apache.camel.language.xpath.XPathBuilder.evaluateAs(XPathBuilder.java:931)
>         at
> org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:898)
>         at
> org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:213)
>         at
> org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:239)
>         at
> org.apache.camel.support.builder.ExpressionBuilder$50.evaluate(ExpressionBuilder.java:1537)
>         at
> org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:45)
>         at
> org.apache.camel.processor.SetHeaderProcessor.process(SetHeaderProcessor.java:48)
>         at
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:477)
>         at
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
>         at
> org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:165)
>         at
> org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:392)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:492)
>         at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:245)
>         at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:206)
>         at
> org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:202)
>         at
> org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:116)
>         at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>         at
> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
>         at
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
>         at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>         at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>         at java.base/java.lang.Thread.run(Thread.java:829)
>
> --------------------------------------
>
> As background, I receive an XML file, then it will be tokenized and 
> then splitted into smaller XML files. The code looks something like this:
>
> from("file:folder?fileName={{exportFile}}&noop=true")
>      .split()
>      .tokenizeXML("object")
>
>      .setHeader("CamelFileName",
> xpath("//object/objectid/text()").append(".xml"))
>      .setHeader("CamelFileContentType", simple("text/xml"))
>      .setBody(simple("<?xml version='1.0'?>${body}"))
>
>      .to("file:folder/exportFiles");
>
>
>                 .
>                 .
>                 .
>
>
> The next steps and routes wont start, this is where the Exception happens.
>
> I set also before the routes the following variables:
>
>        
> context.getGlobalOptions().put("CamelJacksonEnableTypeConverter",
> "true");
>         
> context.getGlobalOptions().put("CamelJacksonTypeConverterToPojo",
> "true");
>
>         PropertiesComponent pc = new PropertiesComponent();
>         pc.setLocation("file:./config.properties");
>         context.setPropertiesComponent(pc);
>
>         context.getStreamCachingStrategy().setSpoolEnabled(true);
>
> context.getStreamCachingStrategy().setSpoolDirectory("./download/tmp");
>         context.getStreamCachingStrategy().setSpoolThreshold(64 * 1024);
>         context.getStreamCachingStrategy().setBufferSize(16 * 1024);
>
>         context.setStreamCaching(true);
>
>
> Because of the transforming objects I have (without this the 
> (un)marshalling  wont work.
>
> I tested these routes and somehow can't find anything that helps. POM 
> has also the dependencies I need. Why wont it work on a Linux server?
>
> Thanks in advance for your time and advice with this problem.
>
> Best regards,
> Jaime Penagos
>


--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to