?
Solved

Dependency injection - @In attribute requires non-null value

Posted on 2011-02-23
14
Medium Priority
?
617 Views
Last Modified: 2012-05-11
Hi experts,

I am working on jboss seam project and having error dependency injection.
I have auto generated Authenticator class :


@Name("authenticator")
public class Authenticator {

       @In(create= true)
	private String projectYear;
...

        public boolean authenticate() {
...

              private projectYear = "2001";
...

         public String getProjectYear() {
		return projectYear;
	}

	public void setProjectYear(String projectYear) {
		this.projectYear = projectYear;
	}
++++++++++++++

Open in new window




I have this error:
@In attribute requires non-null value: authenticator.projectYear


Another question is:

authenticator.getProjectYear():

The above gives me null in other class. Why is that? (I can still set projectYear though.)

thanks,
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
ID: 34962850
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 34964081
I think its ur Seam version problem ? can you tell which version your using ?
0
 

Author Comment

by:dkim18
ID: 34964105
I am using jboss-4.2.3.GA
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 92

Expert Comment

by:objects
ID: 34964720
what value is being injected for projectYear
0
 

Author Comment

by:dkim18
ID: 34964734
"2011" or "2010"
0
 
LVL 92

Expert Comment

by:objects
ID: 34964788
where is that value coming from?
0
 

Author Comment

by:dkim18
ID: 34964828
I am setting it Authenticator class.

@Name("authenticator")
public class Authenticator {

...

if ("khsa".equals(credentials.getUsername()) && "khsa2011".equals(credentials.getPassword())) {

                        identity.addRole("khsa2011");
                        
                        projectYear = "2001";

                        return true;
}

************

And I am trying to access projectYear  from other class.
0
 

Author Comment

by:dkim18
ID: 34964835
sorry, it should be:
projectYear = "2011";
0
 
LVL 92

Expert Comment

by:objects
ID: 34964895
but your annotation defines that the value will be injected
If its not being injected then remove the annotation
0
 

Author Comment

by:dkim18
ID: 34964942
I tried removing the annotation. I still get null for this line of code.

authenticator.getProjectYear():
0
 
LVL 92

Expert Comment

by:objects
ID: 34965008
is it getting authenticated?
0
 

Author Comment

by:dkim18
ID: 34965032
no. I am just trying to set projectYear depends on id&password and get that value from other class.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34965056
you're setting it in authenticate() from what I can see.
If you're not calling that method, and you're not injecting it then its not going to be set
0
 

Author Closing Comment

by:dkim18
ID: 35416823
the solution wasn't completed.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question