[jboss-user] [JBoss Seam] - Re: Help injecting the SessionContext

bfo81 do-not-reply at jboss.com
Wed Aug 2 04:20:28 EDT 2006


Stop, forget what I said. I just had a look at UnsafeObjectFieldAccessorImpl.java and its set-method:

    public void set(Object obj, Object value)
  |         throws IllegalArgumentException, IllegalAccessException
  |     {
  |         ensureObj(obj);
  |         if (isFinal) {
  |             throw new IllegalAccessException("Field is final");
  |         }
  |         if (value != null) {
  |             if (!field.getType().isAssignableFrom(value.getClass())) {
  |                 throw new IllegalArgumentException();
  |             }
  |         }
  |         unsafe.putObject(obj, fieldOffset, value);
  |     }

As you can see, the IllegalArgumentException (that is the root cause auf your exception) is thrown, if the class of a field (namely sessionContext here) doesn't fit the class of the object that should be injected.

Or, to put in a nutshell:

Whatever Seam tries to inject into private SessionContext sessionContext; is not compatible to class SessionContext! Try it like this:

@In(required=false)
  | private Object sessionContext;
  | 
  | ...
  | 
  | log.info("The class of the injected thing is: " + sessionContext.getClass());
Then you will see what's injected and you can start solving the issue.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962378#3962378

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962378



More information about the jboss-user mailing list