-
15. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 9, 2011 2:45 PM (in response to yangju.richard.yang.pearson.com)The getAsObject and getAsString are called, but the @PostConstruct never got called.
I am running Jboss as6 final and faces Beta2. I don't have the converter in faces-config.xml, do I have to? -
16. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 9, 2011 2:52 PM (in response to yangju.richard.yang.pearson.com)I could not even start jboss if I move all the jars from web-inf lib to the jboss server lib.
Is there way to show what kind of files in your web-inf/lib and your web.xml, beans.xml and faces-config.xml?
Thanks.
-
17. Re: Injection not working in face converter
ssachtleben.ssachtleben.gmail.com Feb 9, 2011 3:38 PM (in response to yangju.richard.yang.pearson.com)Well I have all my converter in my faces-config like this:
<!-- Converter definitions required on JBoss AS because it fails to scan for annotations --> <converter> <converter-id>inserationConverter</converter-id> <converter-class>de.autowelt.core.converter.InserationConverter</converter-class> </converter>
Not sure if its fixed already but if your converter get called it should be fine. I had class cast exception without adding them to faces-config.xml!
-
18. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 9, 2011 3:47 PM (in response to yangju.richard.yang.pearson.com)Could you post your web.xml please?
-
19. Re: Injection not working in face converter
ssachtleben.ssachtleben.gmail.com Feb 9, 2011 3:50 PM (in response to yangju.richard.yang.pearson.com)web.xml? Nothing special here
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>AutoWelt</display-name> <!-- FACES CONFIGURATION --> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>javax.faces.SEPARATOR_CHAR</param-name> <param-value>-</param-value> </context-param> <context-param> <param-name>com.sun.faces.validateXml</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.seam</url-pattern> </servlet-mapping> <!-- RICHFACES CONFIGURATION --> <context-param> <param-name>org.richfaces.fileUpload.maxRequestSize</param-name> <param-value>268435456</param-value> </context-param> <context-param> <param-name>org.richfaces.skin</param-name> <param-value>autowelt</param-value> </context-param> <context-param> <param-name>org.richfaces.enableControlSkinning</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>org.richfaces.enableControlSkinningClasses</param-name> <param-value>true</param-value> </context-param> <!-- GLOBAL CONFIGURATION --> <session-config> <session-timeout>10</session-timeout> </session-config> <security-constraint> <display-name>Restrict access to XHTML documents</display-name> <web-resource-collection> <web-resource-name>XHTML</web-resource-name> <url-pattern>*.xhtml</url-pattern> </web-resource-collection> <auth-constraint/> </security-constraint> </web-app>
-
20. Re: Injection not working in face converter
lightguard Feb 9, 2011 4:11 PM (in response to yangju.richard.yang.pearson.com)I'm talking about all of the classes in WEB-INF/classes being jarred up and that jar put in WEB-INF/lib.
-
21. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 9, 2011 4:35 PM (in response to yangju.richard.yang.pearson.com)I have tried everything you suggested and it still not working. So I opened a new thread, hopefully this time some seam 3 face developer can give me some direction.
I suspect that this is something to do with several seam 3 modules I have in my war.Thank you very much for your help.
If you can think of any new idea I could try, please let me know by replying this thread. -
22. Re: Injection not working in face converter
ssachtleben.ssachtleben.gmail.com Feb 9, 2011 4:46 PM (in response to yangju.richard.yang.pearson.com)Well i'm using also nearly all seam 3 modules.
You should build up a small war file with minimum on classes where the problem is reproducible and post it into JIRA of seam faces!
-
23. Re: Injection not working in face converter
bleathem Feb 9, 2011 6:08 PM (in response to yangju.richard.yang.pearson.com)Yes, please create a JIRA issue. If you have a reproducible test case, that would help isolate the problem more quickly.
-
24. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 10, 2011 10:48 AM (in response to yangju.richard.yang.pearson.com)https://issues.jboss.org/browse/SEAMFACES-82 is created.
I ended up doing bean lookup in my converter. It is a pain, but works. -
25. Re: Injection not working in face converter
infinity2heaven Feb 13, 2011 2:58 AM (in response to yangju.richard.yang.pearson.com)Were you able to get a workaround for this issue?
I have the same problem and I'm using JBoss AS 6.1.SNAPSHOT (Feb 9th 2011), Mojarra-2.1.0-b11, and Seam-faces-3-beta2. I need to use the latest Mojarra since it has a crucial fix. Also, everything else (Injections) works fine in my app.
In my Converter, similar to yours, I'm trying to inject a @PersistentContext, @Log, and a @UserService – and all are resolved to null. The converter itself is being called without the need to configure faces-config though.
-
26. Re: Injection not working in face converter
yangju.richard.yang.pearson.com Feb 13, 2011 2:20 PM (in response to yangju.richard.yang.pearson.com)As Brian replied to you in https://issues.jboss.org/browse/SEAMFACES-82
you can replace the weld module in your jboss AS. But I would rather wait for the newer version of weld to come out. I prefer not to replace the weld module in jboss AS. I am afraid I might break some other stuff.
The work around I use is that instead of injection, I use manual bean lookup in the converter. Sample code is as follow:
public T findBeanRef(FacesContext context, String beanELName) {
BeanManager bm = (BeanManager) (((ServletContext) context.getExternalContext().getContext())
.getAttribute("org.jboss.seam.faces.javax.enterprise.spi.BeanManager"));
Bean bean = bm.getBeans(beanELName).iterator().next();
CreationalContext ctx = bm.createCreationalContext(bean);
T beanRef = (T) bm.getReference(bean, bean.getClass(), ctx);
return beanRef;
}
Since you have FacesContext in your converter, as long as you know your to be injected bean name, you should be use this generic utility to find it. -
27. Re: Injection not working in face converter
isonisak Feb 23, 2011 3:36 PM (in response to yangju.richard.yang.pearson.com)Sebastian
Why you cannot inject Logger and have instead for. ex.
<p>
private Logger log = Logger.getLogger(StaticDataProducer.class);
</p> -
28. Re: Injection not working in face converter
ssachtleben.ssachtleben.gmail.com Mar 2, 2011 3:28 AM (in response to yangju.richard.yang.pearson.com)Like mentioned before its a weld issue. If the bean lookup fails all injections are null inclusive the logger.
You should use Weld 1.2.0.Beta1!