streampipes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Riemer" <rie...@apache.org>
Subject RE: Run Bug Custom Sink
Date Tue, 17 Dec 2019 18:23:14 GMT
Hi Dominick,

this seems to be a packaging issue.
Can you please try to replace your maven-shade-plugin with the spring-boot-maven-plugin like
this:

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
  <execution>
    <goals>
      <goal>repackage</goal>
    </goals>
  </execution>
 </executions>
</plugin>

The correct version should be automatically set from the parent POM. If you have multiple
main methods in your classpath, just add your path to the Init method of StreamPipes in the
execution block:
<configuration>
       <mainClass>YOUR_STREAMPIPES_INIT_CLASS </mainClass>
</configuration>

You can find an example plugin definition here:
https://github.com/apache/incubator-streampipes-extensions/blob/7246d9e98940a0197ceb8aec041f360c0c94f5c4/streampipes-processors-filters-jvm/pom.xml

If it doesn't work, let us know :-)

Just a side note, it seems you are currently running StreamPipes 0.64.0, if you want, you
can also upgrade to the latest version 0.65.0 (if you do so, make sure that both the installation
and also your custom sinks and processors use the same version)

Dominik

From: Dominick Madden <madden@edi.gmbh> 
Sent: Tuesday, December 17, 2019 7:10 PM
To: dev@streampipes.apache.org
Subject: Run Bug Custom Sink

Hello all,
I am encountering an error when trying to run my custom StreamPipes Sink. When I start it
in IntelliJ IDEA everything works as expected. When I create a JAR file with the command
'mvn clean package javadoc:aggregate -U -DskipTests -Denforcer.skip'
it successfully creates the JAR file for my sink. Now when I run the file with 
'java -jar <PATH>.jar' I get the following error:
'''
_______ __                              ______ __
|     __|  |_.----.-----.---.-.--------.|   __ \__|.-----.-----.-----.
|__     |   _|   _|  -__|  _  |        ||    __/  ||  _  |  -__|__ --|
|_______|____|__| |_____|___._|__|__|__||___|  |__||   __|_____|_____|
                                                   |__|
** StreamPipes Pipeline Element Container **17:19:58.572 SP [main] INFO  gmbh.edi.hive_pipeline_elements.Init
- Starting Init on doemski-XPS-13-9370 with PID 15468 (/home/doemski/dev/streampipes_custom_pipeline_elements/HivePipelineElements/target/measurement-sink.jar
started by doemski in /home/doemski/dev/streampipes_custom_pipeline_elements/HivePipelineElements)
17:19:58.574 SP [main] INFO  gmbh.edi.hive_pipeline_elements.Init - No active profile set,
falling back to default profiles: default
17:19:58.659 SP [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories.
If you are using a custom packaging, make sure that file is correct.
	at org.springframework.util.Assert.notEmpty(Assert.java:464)
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getCandidateConfigurations(AutoConfigurationImportSelector.java:173)
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationEntry(AutoConfigurationImportSelector.java:116)
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:396)
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:875)
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801)
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
	at org.streampipes.container.standalone.init.StandaloneModelSubmitter.init(StandaloneModelSubmitter.java:54)
	at gmbh.edi.hive_pipeline_elements.Init.main(Init.java:34)
Process finished with exit code 1
'''
My pom.xml:
'''
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://slack-redir.net/link?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&v=3"
xmlns:xsi="https://slack-redir.net/link?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&v=3"
         xsi:schemaLocation="https://slack-redir.net/link?url=http%3A%2F%2Fmaven.apache.org%2FPOM%2F4.0.0&v=3
https://slack-redir.net/link?url=http%3A%2F%2Fmaven.apache.org%2Fxsd%2Fmaven-4.0.0.xsd&v=3">
    <modelVersion>4.0.0</modelVersion>
    <groupId>gmbh.edi</groupId>
    <artifactId>measurement-sink</artifactId>
    <version>1.0-SNAPSHOT</version>    <properties>
        <sp.version>0.64.0</sp.version>
        <start-class>gmbh.edi.hive_pipeline_elements.Init</start-class>
    </properties>    <dependencies>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-wrapper-standalone</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-sdk</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-container-standalone</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-config</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-dataformat-json</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-dataformat-cbor</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-dataformat-smile</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-dataformat-fst</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-messaging-jms</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>org.streampipes</groupId>
            <artifactId>streampipes-messaging-kafka</artifactId>
            <version>${sp.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>    </dependencies>    <repositories>
        <repository>
            <id>laus</id>
            <name>nexus repository</name>
            <url>https://slack-redir.net/link?url=http%3A%2F%2Flaus.fzi.de%2Fnexus%2Fcontent%2Frepositories%2Fpublic%2F&v=3</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>gmbh.edi.hive_pipeline_elements.Init</mainClass>
                                </transformer>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            </transformers>
                            <filters>                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                        <exclude>META-INF/maven/com.github.jsonld-java/jsonld-java/pom.xml</exclude>
                                        <exclude>META-INF/maven/com.github.jsonld-java/jsonld-java-sesame/pom.xml
                                        </exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
        <finalName>measurement-sink</finalName>
    </build>
</project>
'''
As you can see, the container starts up normally and then crashes due to spring.boot. 

After searching for the error message I tried adding a 'META-INF' folder under 'src/main/resources'
containing a MANIFEST.MF file and a spring.factories file. 

MANIFEST.MF:
'''
Manifest-Version: 1.0
Main-Class: gmbh.edi.hive_pipeline_elements.Init

'''

spring.factories:
'''
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.streampipes.container.standalone.init.StandaloneModelSubmitter
'''

Those added files have changed my output to:
'''

 _______ __                              ______ __
|     __|  |_.----.-----.---.-.--------.|   __ \__|.-----.-----.-----.
|__     |   _|   _|  -__|  _  |        ||    __/  ||  _  |  -__|__ --|
|_______|____|__| |_____|___._|__|__|__||___|  |__||   __|_____|_____|
                                                   |__|
** StreamPipes Pipeline Element Container **

18:53:34.285 SP [main] INFO  gmbh.edi.hive_pipeline_elements.Init - Starting Init on doemski-XPS-13-9370
with PID 6147 (/home/doemski/dev/streampipes_custom_pipeline_elements/HivePipelineElements/target/measurement-sink.jar
started by doemski in /home/doemski/dev/streampipes_custom_pipeline_elements/HivePipelineElements)
18:53:34.287 SP [main] INFO  gmbh.edi.hive_pipeline_elements.Init - No active profile set,
falling back to default profiles: default
18:53:34.362 SP [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories.
If you are using a custom packaging, make sure that file is correct.
    at org.springframework.util.Assert.notEmpty(Assert.java:464)
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getCandidateConfigurations(AutoConfigurationImportSelector.java:173)
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationEntry(AutoConfigurationImportSelector.java:116)
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:396)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:875)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
    at org.streampipes.container.standalone.init.StandaloneModelSubmitter.init(StandaloneModelSubmitter.java:54)
    at gmbh.edi.hive_pipeline_elements.Init.main(Init.java:40)

Process finished with exit code 1
'''

Any help would be appreciated greatly!

Thanks in advance,
Best Regards,
Dominick

-- 

____________________________________________________________
EDI GmbH 
Engineering Data Intelligence
Hermann-Weick-Weg 3 
76229 Karlsruhe (Grötzingen), Deutschland
Dominick Michael Madden
Software Engineer
Telefon:+49 721 79199 155

Email:   mailto:madden@edi.gmbh
WWW:  http://www.edi.gmbh/

Die EDI GmbH wird vertreten durch die Geschäftsführer Dr.-Ing. Mohanad El-Haji und Dr.-Ing.
Thomas Freudenmann. 
Sitz der Gesellschaft ist Karlsruhe, HRB 723936 (Registergericht AG Mannheim) 


Mime
View raw message