Also here is the source I see for RouteMatchFactory
/*
* Copyright 2011- Per Wendel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package spark.route;
/**
* RouteMatcherFactory
*
* @author Per Wendel
*/
public final class RouteMatcherFactory {
/** The logger. */
private static final org.slf4j.Logger LOG =
org.slf4j.LoggerFactory.getLogger(RouteMatcherFactory.class);
private static RouteMatcher routeMatcher = null;
private RouteMatcherFactory() {}
public static synchronized RouteMatcher get() {
if (routeMatcher == null) {
LOG.debug("creates RouteMatcher");
routeMatcher = new SimpleRouteMatcher();
}
return routeMatcher;
}
}
On Wed, Oct 23, 2013 at 11:35 PM, gunrock seenu <[email protected]>wrote:
> I tried this pom.xml, that did not help either its just seems to be
> missing something .
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>com.tengen</groupId>
> <artifactId>M101J</artifactId>
> <version>1.0-SNAPSHOT</version>
> <packaging>jar</packaging>
>
> <name>M101J</name>
> <url>http://maven.apache.org</url>
>
> <properties>
> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>org.mongodb</groupId>
> <artifactId>mongo-java-driver</artifactId>
> <version>2.11.3</version>
> </dependency>
>
>
>
> <dependency>
> <groupId>com.sparkjava</groupId>
> <artifactId>spark-core</artifactId>
> <version>1.1</version>
> </dependency>
>
> <dependency>
> <groupId>org.slf4j</groupId>
> <artifactId>slf4j-api</artifactId>
> <version>1.7.5</version>
>
> </dependency>
>
>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>4.9</version>
> <scope>test</scope>
> </dependency>
>
> </dependencies>
> </project>
>
>
>
>
> On Wed, Oct 23, 2013 at 11:27 PM, Seenu <[email protected]> wrote:
>
>> It is referenced by spark core
>>
>> I can see slf4j-API getting pulled by the project in IntelliJ
>>
>> I also tried including the dependency in the Pom.xml.
>>
>> The noclassdeffound is still showing.
>>
>> Sent from my iPhone
>>
>> On Oct 23, 2013, at 10:22 AM, Kevin Krumwiede <[email protected]> wrote:
>>
>> > I don't see any reference to slf4j in your pom or your code. Are you
>> > sure you posted the right thing?
>> >
>> > On 10/23/13, Seenu <[email protected]> wrote:
>> >> I am using intellij and maven,
>> >>
>> >> I have used the following pom.xml :
>> >>
>> >> <project xmlns="http://maven.apache.org/POM/4.0.0"
>> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >>
>> >> xsi:schemaLocation="
>> http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd
>> ">
>> >>
>> >> <modelVersion>4.0.0</modelVersion>
>> >>
>> >> <groupId>com.tengen</groupId>
>> >> <artifactId>M101J</artifactId>
>> >> <version>1.0-SNAPSHOT</version>
>> >> <packaging>jar</packaging>
>> >>
>> >> <name>M101J</name>
>> >> <url>http://maven.apache.org</url>
>> >>
>> >> <properties>
>> >> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>> >>
>> >> </properties>
>> >>
>> >> <dependencies>
>> >> <dependency>
>> >> <groupId>org.mongodb</groupId>
>> >> <artifactId>mongo-java-driver</artifactId>
>> >> <version>2.11.3</version>
>> >> </dependency>
>> >>
>> >>
>> >>
>> >> <dependency>
>> >> <groupId>com.sparkjava</groupId>
>> >> <artifactId>spark-core</artifactId>
>> >> <version>1.1</version>
>> >> </dependency>
>> >>
>> >> <dependency>
>> >> <groupId>junit</groupId>
>> >> <artifactId>junit</artifactId>
>> >> <version>4.9</version>
>> >> <scope>test</scope>
>> >> </dependency>
>> >>
>> >> </dependencies>
>> >> </project>
>> >>
>> >> ------------------------------
>> >>
>> >> package com.tengen;
>> >>
>> >>
>> >> import spark.Request;
>> >> import spark.Response;
>> >> import spark.Route;
>> >> import spark.Spark;
>> >>
>> >> /**
>> >> * Created with IntelliJ IDEA.
>> >> * User: seenu
>> >> * Date: 10/19/13
>> >> * Time: 7:44 PM
>> >> * To change this template use File | Settings | File Templates.
>> >> */
>> >> public class HelloWorldSparkStyle {
>> >> public static void main(String[] args){
>> >> Spark.get(new Route("/") {
>> >> @Override
>> >> public Object handle(Request request, Response response) {
>> >> return "Hello World from Spark!"; //To change body of
>> >> implemented methods use File | Settings | File Templates.
>> >> }
>> >> });
>> >> }
>> >> }
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> ----------------------------------
>> >>
>> >>
>> >> when I run, via intellij here is what I see,
>> >>
>> >> /usr/lib/jvm/jdk1.7.0_40/bin/java -Didea.launcher.port=7536
>> >> -Didea.launcher.bin.path=/home/sree/IDEA/idea-IC-129.1359/bin
>> >> -Dfile.encoding=UTF-8 -classpath
>> >>
>> /usr/lib/jvm/jdk1.7.0_40/jre/lib/jfr.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/jsse.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/deploy.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/javaws.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/management-agent.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/charsets.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/jce.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/jfxrt.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/plugin.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/resources.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/rt.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/localedata.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/dnsns.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/sunec.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/jdk1.7.0_40/jre/lib/ext/zipfs.jar:/home/sree/M101J/out/production/main:/home/sree/.m2/repository/org/mongodb/mongo-java-driver/2.11.3/mongo-java-driver-2.11.3.jar:/home/sree/.m2/repository/com/sparkjava/spark-core/1.1/spark-core-1.1.jar:/home/sree/IDEA/idea-IC-129.1359/lib/idea_rt.jar
>> >> com.intellij.rt.execution.application.AppMain
>> >> com.tengen.HelloWorldSparkStyle
>> >> Exception in thread "main" java.lang.NoClassDefFoundError:
>> >> org/slf4j/LoggerFactory
>> >> at
>> spark.route.RouteMatcherFactory.<clinit>(RouteMatcherFactory.java:27)
>> >>
>> >> at spark.Spark.init(Spark.java:299)
>> >> at spark.Spark.addRoute(Spark.java:282)
>> >> at spark.Spark.get(Spark.java:168)
>> >> at
>> com.tengen.HelloWorldSparkStyle.main(HelloWorldSparkStyle.java:18)
>> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >> at
>> >>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> >>
>> >> at
>> >>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >>
>> >> at java.lang.reflect.Method.invoke(Method.java:606)
>> >> at
>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>> >>
>> >> Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
>> >> 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:424)
>> >> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>> >> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> >> ... 10 more
>> >>
>> >> Process finished with exit code 1
>> >>
>> >>
>> >> -----------------------------
>> >>
>> >>
>> >> what could be wrong here? can someone please point me whre to look? I
>> was
>> >> hoping maven would put the slf4j-api into the classpath when I add
>> >> dependency but it is not.
>> >>
>> >> Sent from my iPhone
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>>
>
>