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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:10:09+00:00 2026-06-01T22:10:09+00:00

I am using JBoss AS 7.1.1 and able to configure a new JTA datasource

  • 0

I am using JBoss AS 7.1.1 and able to configure a new JTA datasource and wire it to my EJB using

@PersistenceContext(unitName="TestPU")
private EntityManager entityManager;

When I tried to use RESOURCE_LOCAL PersistenceUnit I am getting the error saying I can’t inject RESOURCE_LOCAL PU using @PersistenceContext.

I have configured my persistence.xml as follows:

<persistence-unit name="TestPU" transaction-type="RESOURCE_LOCAL">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <properties>   
    <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/xy"/>
        <property name="javax.persistence.jdbc.user" value="root"/>
        <property name="javax.persistence.jdbc.password" value="blah"/>        
        <property name="hibernate.hbm2ddl.auto" value="update" />       
      </properties> 
</persistence-unit>

And in my DAO,

@Stateless
public class UserDAO {
    @PersistenceContext(unitName="TestPU")
    private EntityManager entityManager;


}

When I deployed my app on AS 7.1.1 I am getting the following error.

JBAS011428: Cannot inject RESOURCE_LOCAL container managed EntityManagers using @PersistenceContext
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:169)
    at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:162)
    at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:155)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more

Any solution to use RESOURCE_LOCAL PU with @PersistenceContext?

  • 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-01T22:10:10+00:00Added an answer on June 1, 2026 at 10:10 pm

    JTA : In Java EE environment, transactions are managed by the container & by default its JTA transaction. You can get entity manager by lookup or injection.

    RESOURCE_LOCAL : In Java SE, application have to manage transactions explicitly & resource local transactions are native transactions. You have to create EntityManagerFactory & then can create entity manager from it.

    As you are deploying it in application server, change the transaction-type to JTA in persistence.xml.

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

Sidebar

Related Questions

I am new to JBOSS AS7, and am strictly using MAVEN 3 via command
I'm trying to implement an ejb-call by using JNDI-naming. Setup: JBoss-6.1.0.Final ear-deploy: gwt.war ejb.jar
I am using JBoss 6.1 and I got a secure EJB having methods annotated
Using Jboss portal , how do I retrieve the page properties in a jsp?
Using JBoss AS 6.1.0 Final with default deployment profile. I like to send a
Is using JBoss Cache as distributed state repository a good idea? Can JBoss Cache
I'm using Jboss 7.1.1.final and i have an application with heavy use of JMS.
I'm using JBoss AS 7.1 and Hibernate in Eclipse 3.7.2 to build a Dynamic
We are using JBoss 4.2. We would like to customize the session id which
I'm using JBoss 5.1.0.GA (for JDK6), and jaxws 2.2.6. When I invoke the webservice,

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.