Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7838549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:08:26+00:00 2026-06-02T15:08:26+00:00

I have a project where the Main-Method-class Bootstrap.class is in the src/test folder. So

  • 0

I have a project where the Main-Method-class “Bootstrap.class” is in the src/test folder. So I use <classpathScope>test</classpathScope>
to be able to execute

mvn exec:java

My problem: I get a “java.lang.IllegalArgumentException: Unknown entity:” cause I´m importing certain classes, which are located at the main/java. Any thoughts on how can I solve this?

This is my Pom:

<?xml version="1.0" encoding="UTF-8"?>
<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>eu.peadrtx</groupId>
<artifactId>register</artifactId>
<packaging>war</packaging>
<version>1.6-SNAPSHOT</version>
<name>eu.peadrtx.register</name>

<properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.4.0</gwtVersion>

    <!-- GWT needs at least java 1.6 -->
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>

    <!-- Don't let your Mac use a crazy non-standard encoding -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<!-- notwendig für einige gwt dependencies -->
<repositories>
    <repository>
        <id>gwt-maven-rewraps</id>
        <url>http://gwt-maven-rewraps.googlecode.com/hg/</url>
    </repository>
    <repository>
        <id>cobogw</id>
        <name>Maven2 Repository for cobogw library</name>
        <url>http://cobogw.googlecode.com/svn/maven2</url>
    </repository>
    <repository>
        <id>openehealth.releases</id>
        <name>Open eHealth Maven Repository</name>
        <url>http://repo.openehealth.org/maven2/releases</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>openehealth.snapshots</id>
        <name>Open eHealth Maven Repository</name>
        <url>http://repo.openehealth.org/maven2/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>java.net</id>
        <name>java.net Maven Repository</name>
        <url>http://download.java.net/maven/2/</url>
    </repository>
    <repository>
        <id>codehaus nexus</id>
        <name>Codehaus Nexus Maven Repository</name>
        <url>https://nexus.codehaus.org/content/repositories/releases/</url>
    </repository>
    <repository>
        <id>codehaus</id>
        <name>Codehaus Maven Repository</name>
        <url>http://repository.codehaus.org</url>
    </repository>
    <repository>
        <id>jboss</id>
        <name>JBoss Maven Repository</name>
        <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
    </repository>
    <repository>
        <id>hapi-sf</id>
        <name>HAPI Sourceforge Repository</name>
        <url>http://hl7api.sourceforge.net/m2</url>
    </repository>
</repositories> 

<dependencies>

    ...

    <!-- dependencies for the Unit tests -->

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>${gwtVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-exec</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20080701</version>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.8.5</version>
    </dependency>       
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.15.0</version>
    </dependency>


</dependencies>

<build>
    <!-- Generate compiled stuff in the folder used for development mode -->
    <outputDirectory>target/www/WEB-INF/classes</outputDirectory>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <testResources>
        <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
        </testResource>
    </testResources>
    <plugins>
        <plugin>
            <groupId>org.bsc.maven</groupId>
            <artifactId>maven-processor-plugin</artifactId>
            <version>2.0.5</version>
            <executions>
                <execution>
                    <id>process</id>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <phase>generate-sources</phase>
                </execution>
            </executions>
        </plugin>

        <!-- GWT Maven Plugin -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.4.0</version>
            <dependencies>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-user</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-dev</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-servlet</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
            </dependencies>
            <!-- JS is only needed in the package phase, this speeds up testing -->
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal> 
                     </goals>
                </execution>  
            </executions>

            <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                documentation at codehaus.org -->

            <!-- add gwt:18n and gwt:css configuration see -> http://mojo.codehaus.org/gwt-maven-plugin/i18n-mojo.html#i18nConstantsBundles -->
            <configuration>
                <extraJvmArgs>-javaagent:target/www/WEB-INF/lib/lombok-0.10.8.jar=ECJ -XX:MaxPermSize=384m -Xmx512m -Xss124m</extraJvmArgs>
                <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
                <runTarget>Register.html</runTarget>
                <!-- Location of the develop-mode web application structure (gwt:run). -->
                <hostedWebapp>target/www</hostedWebapp>
                <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
                <compileReport>true</compileReport>
                <module>eu.paedrtx.register.Register</module>
                <logLevel>INFO</logLevel>
                <style>${gwt.style}</style>
            </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.2.1</version>
          <executions>
            <execution>
              <id>my-execution</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>java</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <mainClass>eu.paedrtx.register.server.utility.Bootstrap</mainClass>
            <classpathScope>test</classpathScope>
          </configuration>
        </plugin>

        <!-- Add source folders to test classpath in order to run gwt-tests as 
            normal junit-tests -->
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <additionalClasspathElements>
                    <additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
                    <additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
                </additionalClasspathElements>
                <useManifestOnlyJar>false</useManifestOnlyJar>
                <forkMode>always</forkMode>
                <!-- Folder for generated testing stuff -->
                <systemProperties>
                    <property>
                        <name>gwt.args</name>
                        <value>-out ${project.build.directory}/${project.build.finalName}</value>
                    </property>
                </systemProperties>
            </configuration>
        </plugin>
        <!-- Copy static web files before executing gwt:run-->
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4.2</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/www</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/main/webapp</directory>
                            </resource>
                        </resources>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </execution>
            </executions>
        </plugin>
         <!-- Delete gwt generated stuff -->
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.3</version>
            <configuration>
            <filesets>
                <fileset><directory>src/main/webapp/register</directory></fileset>
                <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
                <fileset><directory>tomcat</directory></fileset>
                <fileset><directory>www-test</directory></fileset>
                <fileset><directory>.gwt-tmp</directory></fileset>
            </filesets>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.7</version>  <!--  Note 2.8 does not work with AspectJ aspect path -->
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>false</downloadJavadocs>
                <wtpversion>2.0</wtpversion>
                <additionalBuildcommands>
                <buildCommand>
                   <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
                </buildCommand>
                </additionalBuildcommands>
                <additionalProjectnatures>
                    <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
                </additionalProjectnatures>
            </configuration>
         </plugin>
    </plugins>
</build>

The stacktrace:

[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ register ---
[WARNING] 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalArgumentException: Unknown entity: eu.paedrtx.register.server.domain.PaymentDetails
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:675)
    at eu.paedrtx.register.server.repository.Repository.create(Repository.java:54)
    at eu.paedrtx.register.server.utility.Bootstrap.main(Bootstrap.java:75)
    ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.299s
[INFO] Finished at: Wed Apr 04 13:04:14 CEST 2012
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project register: An exception occured while executing the Java class. null: InvocationTargetException: Unknown entity: eu.paedrtx.register.server.domain.PaymentDetails -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project register: An exception occured while executing the Java class. null
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
    at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalArgumentException: Unknown entity: eu.paedrtx.register.server.domain.PaymentDetails
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:675)
    at eu.paedrtx.register.server.repository.Repository.create(Repository.java:54)
    at eu.paedrtx.register.server.utility.Bootstrap.main(Bootstrap.java:75)
    ... 6 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:08:28+00:00Added an answer on June 2, 2026 at 3:08 pm

    I solved this issue.
    the problem was that I had 2 persistence.xml one for testing in test/resources and the other for the app in main/resources. I had to remove the one in test/resources and add an other persistence-unit in the applications persistence.xml .

    see : How to configure JPA for testing in Maven

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java project with class having main method in package com.nik.mypackage. Only
I have a Java project in Eclipse with class MainClass having main method in
I have a Visual Studio solution containing 2 project: main project and test (via
i have any div for show details of project ( class main ). now
I have the following situation. My project has a main.scala.html file and a folder
In my Maven project, I have the following code in the main method: FileInputStream
I have a project with two tabs. Tabs are created in the main class.
I have created simple project with class Main and public static void main and
I have 2 assemblies, A containing the Main method and the Foo class, that
I have a console app that executes a class method (in a different project).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.