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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:54:25+00:00 2026-06-14T01:54:25+00:00

I got following exception on IBM Websphere Application server 8.5 when I tried to

  • 0

I got following exception on IBM Websphere Application server 8.5 when I tried to deploy my application on server.
I’m using WS 8.5, EJB 3.1, Java EE 6 in my application.

[11/1/12 11:06:47:208 PKT] 0000005d annotations   E   CWWAM0003E: An exception occurred while validating an annotation: com.ibm.wsspi.amm.validate.ValidationException: CWWAM2302E: The class com.xxx.yyy.services.UsersServiceBean is annotated with an invalid @PersistenceContext declaration; no name is specified.
                             com.ibm.wsspi.amm.validate.ValidationException: CWWAM2302E: The class com.xxx.yyy.services.UsersServiceBean is annotated with an invalid @PersistenceContext declaration; no name is specified.
at com.ibm.ws.amm.validate.persistence.PersistenceContextValidator.validateClassAnnotation(PersistenceContextValidator.java:86)

Below is my Java code.

@PersistenceContext(unitName="myUnit")
@Stateless(name="UsersService")
public class UsersServiceBean implements UsersService {...}
  • 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-14T01:54:26+00:00Added an answer on June 14, 2026 at 1:54 am

    In short, when declaring @PersistenceUnit on a class, you must add a name="..." that you can use to look up the EntityManagerFactory with new InitialContext("java:..."). Alternatively, you can declare an @PersistenceUnit(...) EntityManagerFactory emf; field in your class and omit the name.

    All ref annotations are basically the same as @Resource. Per the commons annotations specification:

    The name element is the JNDI name of the resource. When the Resource
    annotation is applied on a field, the default value of the name
    element is the field name qualified by the class name. When applied on
    a method, the default is the JavaBeans property name corresponding to
    the method qualified by the class name. When applied on a class, there
    is no default and the name MUST be specified.

    The last sentence is relevant, and it makes sense: using @PersistenceUnit (and all other @Resource-like annotations) has two effects:

    1. If you declare the annotation on a field or method, then the container will automatically inject when the instance is created.
    2. The reference is inserted into the java:comp namespace using its name. If you declare the annotation on a field or method, the default name is java:comp/env/com.example.ClassName/targetName.

    If you declare the annotation on a class, then (1) there’s no injection, and (2) there’s no default name so there’s no way to bind into java:comp/env. In that case, the annotation declaration would be pointless, so it’s an error.

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

Sidebar

Related Questions

Using the BitmapFactory.decodeStream function, I've got the following exception 02-22 13:24:34.129: W/System.err(7927): java.io.FileNotFoundException: toto.jpg
I am using following datatype in my database . but I got exception as
When I tried to upload a large size image(2.3MB), I got following exception. I
While migrating a legacy application to spring security I got the following exception: org.springframework.beans.factory.BeanCreationException:
I've got the following exception : javax.mail.MessagingException: Connect failed; nested exception is: java.io.IOException: Connect
While playing with classloaders i got the following exception: Exception in thread main java.lang.ClassCastException:
While running an application, I got the following exception. android.content.res.Resources$ResourcesNotFoundException: Resource ID # 0X7F03000a
I have got the following exception when try to select data from SQL Server
I got the following Design time exception for my control in WPF System.NotImplementedException The
From time to time I got the following exception message on GAE for my

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.