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

  • Home
  • SEARCH
  • 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 6572805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:03:10+00:00 2026-05-25T15:03:10+00:00

In my ejb project I defined an abstract entity class called DataObjectEntity.java, and have

  • 0

In my ejb project I defined an abstract entity class called DataObjectEntity.java, and have all entities extend this class. The purpose is such that common fields can be reused and logging of activities in the system can be easier.

@Entity
@Inheritance(strategy= InheritanceType.TABLE_PER_CLASS)
public abstract class DataObjectEntity implements Serializable {
  private static final long serialVersionUID = 1L;
  @Transient
  protected Logger log = Logger.getLogger(getClass());

  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;
  private PersonEntity createdBy;
  @Temporal(javax.persistence.TemporalType.DATE)
  private Date createdAt;
  private PersonEntity lastModifiedBy;
  @Temporal(javax.persistence.TemporalType.DATE)
  private Date lastModifiedAt;
  private boolean archived;

  public DataObjectEntity() {
    createdAt = new Date();
    lastModifiedAt = new Date();
    archived = false;
  }

  public DataObjectEntity(PersonEntity createdBy) {
    this();
    this.createdBy = createdBy;
    this.lastModifiedBy = createdBy;       
  }

  public void modified(PersonEntity modifiedBy){
    this.lastModifiedBy = modifiedBy;
    this.lastModifiedAt = new Date();
    log.info("Object " + id + " modified by " + modifiedBy.getName());
  }

  public void created(PersonEntity createdBy){
    this.createdBy = createdBy;
    this.lastModifiedBy = createdBy;
    log.info("Object " + id + " created by " + createdBy.getName());
  }

  //getters and setters
}

Then I used netbeans’ built-in feature to generate JSF pages from entity classes. Everything was fine. I could run the project just fine.

But after adding a new entity, I got this NoClassDefFoundError for the super class entity when trying to deploy. The new entity was really simple with a 1-1 relationship defined with one of the pre-existing entity class. I tried everything I could think of: clean&build, restarting glassfish, dropping all tables, generating JSF for the new entity class though I don’t need it… But nothing worked.

Eventually I deleted my new entity and only left some changes on the existing backing beans. And the error still persists. I even checked out a fresh working copy to apply the same changes to the backing beans – turned out that copy deploys fine. One of my teammates is getting exactly the same error when he tries to add a new entity. Any idea what might be the cause?

WARNING: entity/DataObjectEntity_
java.lang.NoClassDefFoundError: entity/DataObjectEntity_
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:927)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1486)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1369)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToClass(ConversionManager.java:438)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:141)
at org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.convertObject(DatasourcePlatform.java:160)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.initializeCanonicalMetamodel(EntityManagerSetupImpl.java:2552)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.getMetamodel(EntityManagerSetupImpl.java:2531)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:484)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:268)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.doJava2DB(PersistenceUnitLoader.java:373)
at org.glassfish.persistence.jpa.JPADeployer$2.visitPUD(JPADeployer.java:435)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:483)
at org.glassfish.persistence.jpa.JPADeployer.iterateInitializedPUsAtApplicationPrepare(JPADeployer.java:465)
at org.glassfish.persistence.jpa.JPADeployer.event(JPADeployer.java:386)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:453)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: entity.DataObjectEntity_
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1519)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1369)
... 53 more

The persistence.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="MyProject-warPU" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/myprojectdb</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

Update: My teammate found a very strange but promising way to fix this: rename the entity java file that reports the NoClassDefFoundError to .class. Wait for glassfish to compile and report errors. Then change it back to .java. Wait for glassfish to compile again then clean and build, deploy. Works every time.

  • 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-05-25T15:03:10+00:00Added an answer on May 25, 2026 at 3:03 pm

    The exception say the class entity/DataObjectEntity_ not DataObjectEntity, note the “_”.

    This is a JPA2 metamodel class that is only used for the type safe version of the Criteria API. It is not required, and should not cause any issues. Does you application still run successfully?

    These model classes are optional and normally not needed, so missing them should not be causing any issue. They are generated only at compile time, either by your IDE, or by the EclipseLinkk meta-model generator that has to be hooked up to your build process.

    You change to resolve the issue make no sense, seems like you may have just had some compile issue with your IDE.

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

Sidebar

Related Questions

I have a large application that uses EJB 2.x entity beans (BMP). This is
I have separated a Java EE project in the following submodules: project-war project-ejb project-ear
I have an EJB Project with a @Singleton EJB defined as: @LocalBean @Singleton @Startup
I have an old EJB (2.1) project that uses xdoclet (1.2.3) to generate the
I have been struggling trying to test a super simple EJB project in netbeans.
I am having a java project with a ant build file, using this ant
I have an EJB project setup in the following way EAR Project EJB Proj
i have this in the server: class Person{...} and @Stateless public class HelloServiceBean implements
I have a ejb project with 1 dependent project (also in my workspace) that
I have a data access EJB project that has a number of EJB's I

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.