question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error message when EntityManager can't be produced for injection

See original GitHub issue

Describe the bug Follow up on #5521 :

when there are no entities, we automatically disable the Hibernate ORM extension, this implies that code attempting to use an injected EntityManager will get an error as the EntityManager producer is not generated either.

[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type javax.persistence.EntityManager and qualifiers [@Default]

We should find a way to produce a better error message to explain this particular UnsatisfiedResolutionException.

@mkouba could you suggest how this could be done? Does it make sense?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jmartiskcommented, Nov 18, 2019

Maybe a dumb idea - but do we want to forbid the whole application from running in this case? If not, one option would be that the processor can log a warning and include a mock implementation of EntityManager that can be injected, but whose all methods throw a reasonable exception. Not sure what you guys think about letting the application work in this case - but to me it kinda makes sense, at least with devmode, the developer’s workflow could possibly be that they first inject an EM and only then they add an entity.

0reactions
famodcommented, Jun 15, 2020

We just had to add a Dummy entity to one of our “persistence support” Maven modules which is using sequences, to make the QuarkusTest work. This is a bit awkward. Maybe it would come in handy to enable an extension via a annotation (on the test class)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cant inject EntityManager with @PersistenceContext [Error ...
You have a JTA Persistence Unit but not defined a JDBC datasource. I assume that your persistence unit is not created. Have you...
Read more >
JPA problem - EntityManager is not injected - Forums - IBM
I have made the Liberty JPA tutorial to work, but now I am rebuilding the app using injected JTA EntityManager instead of using...
Read more >
Managing Entities - The Java EE 6 Tutorial
The EntityManager API creates and removes persistent entity instances, finds entities by the entity's primary key, and allows queries to be run on...
Read more >
Entity Manager Problem | SAP Community
Entity Manager Problem ... createSupplier(supplier);) I get the following error message: ... EJBException: Cannot perform injection over bean instance ...
Read more >
Upgrading to Drupal 9 Entity.Manager Error
I run the Upgrade Status report before and made sure to update all the ... "entity.manager". in Symfony\Component\DependencyInjection\ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found