This content has been marked as final.
Show 4 replies
-
1. Re: Cannot create Seam component, scope is not active
carolinofr Mar 18, 2010 8:43 PM (in response to oyesiji77)i have the to problem :(
-
2. Re: Cannot create Seam component, scope is not active
asookazian Mar 20, 2010 5:32 AM (in response to oyesiji77)I'm not sure what the Seam container means by
scope is not active
. Apparently in this situation the current component's context is not active? Here is the method that is outputting that warning:private static Object getInstance(String name, boolean create, boolean allowAutoCreation, Object result) { Component component = Component.forName(name); create = create || (Init.instance().isAutocreateVariable(name) && allowAutoCreation); if (result==null && create) { result = getInstanceFromFactory(name); if (result==null) { if (component==null) { //needed when this method is called by JSF if ( log.isTraceEnabled() ) log.trace("Seam component not found: " + name); } else if ( component.getScope().isContextActive() ) { result = component.newInstance(); } else { log.warn("Cannot create Seam component, scope is not active: " + name + "(" + component.getScope().name() + ")"); } } } if (result!=null) { if (component!=null) { if ( !component.isInstance(result) ) { if ( component.hasUnwrapMethod() ) return result; ///best way??? throw new IllegalArgumentException( "value of context variable is not an instance of the component bound to the context variable: " + name + ". If you are using hot deploy, you may have attempted to hot deploy a session or " + "application-scoped component definition while using an old instance in the session."); } result = component.unwrap(result); } } return result; }
-
3. Re: Cannot create Seam component, scope is not active
oyesiji77 Mar 20, 2010 8:06 AM (in response to oyesiji77)Yes that's the Module causing the error. But i don't know why??
-
4. Re: Cannot create Seam component, scope is not active
asookazian Mar 20, 2010 3:35 PM (in response to oyesiji77)
Sometimes this is caused by a hot deploy problem and can be rectified by doing a clean redeploy/restart. Other times it may indicate that you have a Seam component name (@Name annotation) the same as a variable name. Check your code carefully to see if your context variable is not already in use as a Seam component name. If it is, change one of them.
This is a somewhat common thing to occur, because if you create a Seam component called myThing, it is only natural that you might end up creating an in-or-out-jected property called myThing as well. One solution would be to always declare your Seam component names with some distinguishable prefix or suffix (like SeamMyThing).