java.lang.NoClassDefFoundError: LFinder;

287 views
Skip to first unread message

mic...@pixatel.com

unread,
Jan 21, 2014, 9:26:19 PM1/21/14
to eb...@googlegroups.com
I am trying to setup a new Ebean server and keep running into one brick wall after another.
Currently my issue is that I keep getting java.lang.NoClassDefFoundError: LFinder;

        ServerConfig c = new ServerConfig();

        c.setName("mysql");
       
        c.setDdlGenerate(false);
        c.setDdlRun(false);
        c.setDefaultServer(true);
        c.setRegister(true);
       
        DataSourceConfig dsConfig = new DataSourceConfig();
        System.out.println("Creating a new data source");
       
        dsConfig.setUrl("jdbc:mysql://localhost/test");
        dsConfig.setUsername("user");
        dsConfig.setPassword("password");
        dsConfig.setDriver("com.mysql.jdbc.Driver");
        c.setDataSourceConfig(dsConfig);
        System.out.println("Data source set in server");
       
        System.out.println("creating server factory");
       
        try {
            EbeanServerFactory.create(c);
        } catch (Throwable e) {
            e.printStackTrace();
        }

the above error is occurring on the EbeanServerFactory.create(c)

I also have the stack trace, which has been largely unhelpful to me:
java.lang.NoClassDefFoundError: LFinder;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
    at java.lang.Class.getDeclaredFields(Class.java:1806)
    at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProperties(DeployCreateProperties.java:105)
    at com.avaje.ebeaninternal.server.deploy.parse.DeployCreateProperties.createProperties(DeployCreateProperties.java:54)
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.createDeployBeanInfo(BeanDescriptorManager.java:1036)
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.readEntityDeploymentInitial(BeanDescriptorManager.java:515)
    at com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager.deploy(BeanDescriptorManager.java:235)
    at com.avaje.ebeaninternal.server.core.InternalConfiguration.<init>(InternalConfiguration.java:114)
    at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:204)
    at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:65)
    at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:58)
    at com.ikdam.antakshri.api.business.ConfigureEbeanSetup.<init>(ConfigureEbeanSetup.java:33)
    at com.ikdam.antakshri.api.controllers.AntakshriAPI.init(AntakshriAPI.java:28)
    at spark.servlet.SparkFilter.init(SparkFilter.java:59)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4562)
    at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5240)
    at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5235)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: Finder
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    ... 26 more

I am coming from Play Framework, and due to some serious issues in the framework, i am moving away from it, but I do love Ebeans, so I am trying to just use it.

Also, I tried placing an ebeans.properties file in the base and in the lib directory of my tomcat installation, but I still cannot get Ebeans to read it. Ant help would be appreciated.

Rob Bygrave

unread,
Jan 21, 2014, 11:29:31 PM1/21/14
to ebean@googlegroups
>> Caused by: java.lang.ClassNotFoundException: Finder

Hmm, I'd chuck out a guess that your entity beans extends plays Model class (which in turn is referencing a field of type Finder ... and that is not in your classpath) ?


If not a couple of suggestion would be: 

- Do you have the source code for your @Entity beans... do any of them have a property/field of type LFinder or Finder or do they extend something like the play Model class which in turn references this type (that is not in your classpath).

- run with a debugger and point a break point on DeployCreateProperties.java:105 ... and see what breaks it (this will be a pain if you have lots of entities)

- register only some of your @Entity beans ... to try and narrow down which bean is causing the problem.




--
 
---
You received this message because you are subscribed to the Google Groups "Ebean ORM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ebean+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

mic...@pixatel.com

unread,
Jan 22, 2014, 12:49:14 AM1/22/14
to eb...@googlegroups.com
I have not implemented any beans yet, as I was simply trying to get a connection to the database.
Later, I use this connection to count the fields in an existing table using the hello world example of sql count.
Something tells me that I am not understanding how to initialize the Ebean server properly in my servlet.

Rob Bygrave

unread,
Jan 22, 2014, 4:56:02 PM1/22/14
to ebean@googlegroups
>> DeployCreateProperties.java:105

So at this point in the code EbeanORM THINKS that it has an entity bean ... and it is using reflection to find the methods and fields on the entity bean. This exception is occurring trying to read the fields from that specific 'entity bean'.

However, you are suggesting that you haven't specified any entity beans explicitly for EbeanORM to use .. and that means that EbeanORM will have scanned your classpath for entity beans (and it found at least one).

At this point you could/should run this with a debugger and put a break point in DeployCreateProperties.java ... and see what class/entity bean EbeanORM is trying to 'parse'.

Alternatively note that if you want to explicitly tell EbeanORM which classes to use as entity beans (or listeners or data types etc) then use ServerConfig#addClass(...);  You can also use ServerConfig#addPackage(...); to tell EbeanORM which packages it should scan (rather than explicitly added each entity bean class etc).


Does that help?

mic...@pixatel.com

unread,
Jan 22, 2014, 6:35:16 PM1/22/14
to eb...@googlegroups.com
This did help, and I did that before you replied. I am having a new issue that I am working through relating to enhancement.
I am aware this is another topic altogether, and have been working through forum posts related to it.
One major difference though is that I am using Netbeans (Eclipse is useless with m2e for me).
But I still am unable to get any of the Maven plug-ins related to the enhancing section working, and I really do not understand enhancing at all.
I am not faulting anyone for my incompetence, but not being able to get a good servlet is starting to weigh on me.

Thank you for your replies.

mic...@pixatel.com

unread,
Jan 22, 2014, 6:55:34 PM1/22/14
to eb...@googlegroups.com
Final update: it is now working smoothly in my netbeans environment.
I made alot of changes in my pom.xml related to eclipse, and when I got rid of them netbeans made all of the conversions necessary.
Once again thanks for the help.
Oh and if anyone wants it, here is my working 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.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId></groupId>  <-- left out on purpose
  <artifactId></artifactId> <--left out on purpose
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven Webapp</name>
  <url>http://maven.apache.org</url>
   
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.sparkjava</groupId>
      <artifactId>spark-core</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.28</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.directory.studio</groupId>
        <artifactId>org.apache.commons.codec</artifactId>
        <version>1.8</version>
    </dependency>
    <dependency>
        <groupId>org.avaje.ebeanorm</groupId>
        <artifactId>avaje-ebeanorm</artifactId>
        <version>3.2.5</version>
    </dependency>
    <dependency>
    <groupId>org.avaje.ebeanorm</groupId>
      <artifactId>avaje-ebeanorm-mavenenhancer</artifactId>
      <version>3.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.0</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>webapp</finalName> <-- changed name

    <plugins>
   
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>compile</id>
              <phase>compile</phase>
               <configuration>
               <tasks>
                <property name="compile_classpath" refid="maven.compile.classpath" />
                <echo message="compile classpath: ${compile_classpath}" />
                <taskdef name="ebeanEnhance"
                classname="com.avaje.ebean.enhance.ant.AntEnhanceTask"
                classpath="${compile_classpath}" />
                <ebeanEnhance classSource="${project.build.outputDirectory}"
                packages="com.ikdam.antakshri.api.models.**" transformArgs="debug=1" />
              </tasks>
              <encoding>UTF-8</encoding>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
      </execution>
    </executions>
      </plugin>
    </plugins>
  </build>
</project>
Reply all
Reply to author
Forward
0 new messages