Hi Chris,

I was trying one workflow of creating / running an Edgent app - in this case 
trying to use mvn exec:java
I’m lead to believe there’s some problem with poms/deps.
This was using PR-309 content from this am.

The app itself doesn’t use slf4j.  Edgent has a compile time dependency on 
slf4j-api.  At runtime, a single slf4j impl must be present.
The failure below seems to indicate that slf4j-api isn’t present (that seems to 
be where org.slf4j.LoggerFactory is)?
Related to the top level pom specifying “provided” for slf4j-api?

Here’s the flow…

Lacking an Edgent specific archetype template, I faked it:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app 
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

then added these deps to its pom:
   <dependency>
      <groupId>org.apache.edgent.providers</groupId>
      <artifactId>edgent-providers-direct</artifactId>
      <version>1.2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.12</version>
      <scope>runtime</scope>
    </dependency>

then I essentially copied the HelloEdgent.java sample into the generated 
App.java (tweaking package&classname)

then
mvn clean package -DskipTests
mvn exec:java -Dexec.mainClass=“com.mycompany.app.App”
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at 
org.apache.edgent.runtime.jsoncontrol.JsonControlService.<clinit>(JsonControlService.java:50)
        at 
org.apache.edgent.providers.direct.DirectProvider.<init>(DirectProvider.java:60)
        at com.mycompany.app.App.main(App.java:20)
...
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
...

— Dale


Reply via email to