I’m working on a legacy Maven-based project. It uses an old version of Datanucleus and (the legacy) Google App Engine SDK. It’s a web application and I can’t (and don’t) see what is wrong with my configuration.
The project is plagued with several “Class was not found in the CLASSPATH” errors such as:
Class "org.datanucleus.enhancer.asm.ASMClassEnhancer" was not found in the CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class "com.element84.goodeatin.RestaurantMakerServlet" was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
(and many more other servlet not found in class path errors)
Downloading from central:
https://repo1.maven.org/maven2/org/datanucleus/datanucleus-rdbms/maven-metadata.xml
Exception in thread “Thread-2” Class
“org.datanucleus.enhancer.asm.ASMClassEnhancer” was not found in the
CLASSPATH. Please check your specification and your CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class
“org.datanucleus.enhancer.asm.ASMClassEnhancer” was not found in the
CLASSPATH. Please check your specification and your CLASSPATH. at
org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:250)
at
org.datanucleus.enhancer.DataNucleusEnhancer.init(DataNucleusEnhancer.java:219)
at
org.datanucleus.enhancer.DataNucleusEnhancer.addClasses(DataNucleusEnhancer.java:370)
at
org.datanucleus.enhancer.EnhancerProcessor$EnhanceRunnable.run(EnhancerProcessor.java:163)
at java.lang.Thread.run(Thread.java:750) Downloaded from central:
https://repo1.maven.org/maven2/org/datanucleus/datanucleus-rdbms/maven-metadata.xml
(6.4 kB at 26 kB/s) Downloading from central:
https://repo1.maven.org/maven2/org/datanucleus/datanucleus-jpa/maven-metadata.xml
Downloading from DN_M2_Repo:
https://www.datanucleus.org/downloads/maven2/org/datanucleus/datanucleus-jpa/maven-metadata.xml
Downloaded from central:
https://repo1.maven.org/maven2/org/datanucleus/datanucleus-jpa/maven-metadata.xml
(1.2 kB at 6.5 kB/s) [INFO] DataNucleus Enhancer (version 1.1.4) :
Enhancement of classes DataNucleus Enhancer completed with success for
2 classes. Timings : input=396 ms, enhance=208 ms, total=604 ms.
Consult the log for full details
Here’s the complete project structure for reference:
goodeatin-appengine
│
│
├── src
│ ├── main
│ ├── java
│ │ └── com
│ │ └── element84
│ │ └── goodeatin
│ │ ├── AsynchronousCommentMakerServlet.java
│ │ ├── Comment.java
│ │ ├── CommentMakerServlet.java
│ │ ├── DefaultTaskQueueServlet.java
│ │ ├── EMF.java
│ │ ├── GoodEatinServlet.java
│ │ ├── MailHandlerServlet.java
│ │ ├── Restaurant.java
│ │ ├── RestaurantInfoRefresherServlet.java
│ │ ├── RestaurantMakerServlet.java
│ │ └── XMPPServlet.java
│ │
│ ├── resources
│ │ └── META-INF
│ │ ├── jdoconfig.xml
│ │ └── persistence.xml
│ │
│ └── webapp
│ ├── images
│ ├── stylesheets
│ └── WEB-INF
│ ├── appengine-web.xml
│ ├── cron.xml
│ ├── logging.properties
│ ├── web.xml
│ ├── header.jsp
│ ├── index.html
│ ├── listView.jsp
│ ├── newComment.jsp
│ ├── newRestaurant.jsp
│ └── tickle.html
│
├── pom.xml
└── README
The POM is quite long but the build is configured this way:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<!-- Include all files and directories under 'src/main/resources' -->
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<!-- ... -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<!-- Ensure classes are packaged within the WAR file -->
<archiveClasses>true</archiveClasses>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/appengine-web.xml</include>
</includes>
</resource>
<!-- Define additional resources for inclusion in the WAR. -->
<resource>
<!-- Source directory for the web configuration files. -->
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<!-- Enables Maven to replace placeholders with POM values. -->
<filtering>true</filtering>
<!-- Destination within the WAR file for these resources. -->
<targetPath>WEB-INF</targetPath>
</resource>
<!-- Include the META-INF directory containing the persistence.xml file -->
<resource>
<directory>${project.build.outputDirectory}/META-INF</directory>
<targetPath>WEB-INF/classes/META-INF</targetPath>
<includes>
<include>persistence.xml</include>
<include>jdoconfig.xml</include>
</includes>
</resource>
<!-- Ensure that the compiled classes are included -->
<resource>
<directory>${project.build.outputDirectory}</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${maven.gae.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
<jvmFlags>
<jvmFlag>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</jvmFlag>
</jvmFlags>
</configuration>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>${datanucleus.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.version}</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-enhancer</artifactId>
<version>${datanucleus.enhancer.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>enhance</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<api>JPA</api>
<enhancerName>ASM</enhancerName>
<persistenceUnit>transactions-optional</persistenceUnit>
<mappingIncludes>**/*.class</mappingIncludes>
</configuration>
</plugin>
<!-- ... --->
</plugins>
</build>
Running the project with mvn appengine:devserver
what is wrong with how the project is structured and packaged that could cause these errors?