Reputation: 324
When I followed the Kurento Tutorials to run the example Java - Repository
,which needs install the kurento repository server first,I met some problem.
Following the Kurento Repository Server installation guide ,in the last step, I run server at user-level by the commands :
$ cd kurento-repository-server-x.y.z
$ ./bin/start.sh
Unluckily,it shows
$ bash ./start.sh
=========================================================================
Kurento Repository Bootstrap Environment
KREPO_BINARY: /home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/lib/kurento-repo.jar
JAVA: /usr/lib/jvm/jdk1.7.0_80/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation
KREPO_OPTS: -DconfigFilePath=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo.conf.json -Dkurento-repo.log.file=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/logs/kurento-repo.log -Dlogging.config=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo-log4j.properties -Dlog4j.configuration=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo-log4j.properties
=========================================================================
no main manifest attribute, in /home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/lib/kurento-repo.jar
OK,it can not find the class which includes main
method.
So I changed the last command of the start.sh
from
exec $JAVA $JAVA_OPTS $KREPO_OPTS -jar $KREPO_BINARY
to
exec $JAVA $JAVA_OPTS $KREPO_OPTS -cp $KREPO_BINARY org.kurento.repository.KurentoRepositoryServerApp
I am sure that org.kurento.repository.KurentoRepositoryServerApp
includes a main
method after I view the source code.
However, it show another error:
$ bash ./start.sh
=========================================================================
Kurento Repository Bootstrap Environment
KREPO_BINARY: /home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/lib/kurento-repo.jar
JAVA: /usr/lib/jvm/jdk1.7.0_80/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation
KREPO_OPTS: -DconfigFilePath=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo.conf.json -Dkurento-repo.log.file=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/logs/kurento-repo.log -Dlogging.config=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo-log4j.properties -Dlog4j.configuration=/home/lcrc/kurento-java/kurento-repository/kurento-repository-server/target/kurento-repository-server-6.6.1-SNAPSHOT/config/kurento-repo-log4j.properties
=========================================================================
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/Servlet
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: javax.servlet.Servlet
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
How to fix it?
Upvotes: 1
Views: 314
Reputation: 31
Not sure which tag you're working with from the kurento-java repo, but I'm working with current master (6.6.2-SNAPSHOT
).
There were two things I did to get this to work:
1.) Instead of supplying where to find the main, remove the mainClass reference in the pom.xml file and let the spring-boot-maven-plugin
do its magic. Go to the plugin section and remove the configuration for spring-boot-maven-plugin
.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- REMOVE CONFIGURATION BEGIN -->
<!-- <configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
<classifier>exec</classifier>
</configuration> -->
<!-- REMOVE CONFIGURATION END -->
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
2.) After doing this, there's a logback library collision. So exclude the spring-boot-starter-logging
that gets included with spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- ADD EXCLUSION BEGIN -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
<!-- ADD EXCLUSION END -->
</dependency>
Then, you shouldn't have to alter the start.sh
script at all.
Upvotes: 3