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 400701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:57:56+00:00 2026-05-12T16:57:56+00:00

I have three modules in my Maven project (this is slightly simplified): model contains

  • 0

I have three modules in my Maven project (this is slightly simplified):

  • model contains JPA annotated entity classes
  • persistence instantiates an EntityManager and calls methods on it
  • application creates instances of the classes in model, sets some values and passes them to persistence

model and persistence obviously depend on javax.persistence, but application shouldn’t, I think.

The javax.persistence dependency is moved to a top-level POM’s dependencyManagement section because it occurs in a number of submodules where I only reference that entry.

What’s surprising to me is that I have to reference the dependency in application when I set its scope to provided, whereas I don’t have to when its scope is compile.

With a scope of provided, if I don’t list it in the dependencies for application, the build fails with an error message from javac:

com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.persistence.InheritanceType not found

What’s going on?

  • 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-12T16:57:56+00:00Added an answer on May 12, 2026 at 4:57 pm

    model and persistence obviously depend on javax.persistence, but application shouldn’t, I think.

    That’s true. But transitive dependencies resolution has nothing to do with your problem (and actually, javax.persistence is provided to model and persistence on which application depends with a compile scope so it’s omitted as documented in 3.4.4. Transitive Dependencies).

    In my opinion, you are victim of this bug: https://bugs.java.com/bugdatabase/view_bug?bug_id=6550655

    I have the same issues with an EJB3
    entity that uses the Inheritance annotation:
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)

    A client class using this entity won’t
    compile when the ejb3 annatations are
    not on the classpath, but crash with
    the following message:
    com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.persistence.InheritanceType not found

    […]

    Note that is a special case of bug 6365854 (that is reported to be fixed); the problem here seems to be that the annotation is using an enum as its value.

    The current workaround is to add the missing enum to the CLASSPATH.

    In your case, the "less worse" way to do that would be to add javax.persistence as provided dependency to the application module. But that’s a workaround to the JVM bug, application shouldn’t need that dependency to compile.

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

Sidebar

Related Questions

No related questions found

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.