Mhh this looks like a bug in Glassfish to me, the entries in the
glassfish-web.xml look correct to me. Problem is generally that
glassfish is not to keen on overrides of its system libs in my
experience. Even while myfaces runs, try to replace Weld for instance
and you run into a mess.
Glassfish as good as it is is an all or nothing pack in many cases.
But it has been some time since I last touched Glassfish, things might
have changed.
Werner
Am 12.03.12 17:40, schrieb José Luis Cetina:
Im triying to start a new project for first time with myfaces, i always
used Mojarra but know i want to change but im having problems at the start:
My only requierement is use Glassfish 3.1.2.1.
Hi i have this WARNING:
*Both MyFaces and the RI are on your classpath. Please make sure to use
only one of the two JSF-implementations.*
Why this happend if im using only jars from myfaces?? maybe for glassfish i
think, i have these in my *glassfish-web.xml* file, under WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish
Application Server 3.1 Servlet 3.0//EN" "
http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<!--Para establecer el charset a utf8 y remover el mensaje de: PWC4011:
Unable to set request character encoding to UTF-8 from context-->
<parameter-encoding default-charset="UTF-8"/>
*<class-loader delegate="false"/>*
*<property name="useBundledJsf" value="true"/>*
<!--<class-loader delegate="true"/>-->
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java
code.</description>
</property>
</jsp-config>
</glassfish-web-app>
---------------- ---------------- ----------------
This is my web.xml
<?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">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>com.ocpsoft.pretty.DEVELOPMENT</param-name>
<param-value>true</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.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>
<param-value>true</param-value>
</context-param>
<listener>
*
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
*
</listener>
<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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
---------------- ---------------- ----------------
Here are my libraries:
--MYFACES
myfaces-api-2.1.6.jar
myfaces-impl-2.1.6.jar
commons-beanutils-1.8.3.jar
commons-digester-1.8.jar
commons-logging-1.8.jar
commons-codec-1.1.1.jar
commons-collections-3.2.jar
--MYFACES CODI
myfaces-extcdi-alternative-implementation-module-1.0.4
myfaces-extcdi-bv1-module-api-1.0.4
myfaces-extcdi-bv1-module-impl-1.0.4
myfaces-extcdi-core-alternative-configuration-1.0.4
myfaces-extcdi-core-api-1.0.4
myfaces-extcdi-core-impl-1.0.4
myfaces-extcdi-jpa1-module-api-1.0.4
myfaces-extcdi-jpa1-module-impl-1.0.4
myfaces-extcdi-jsf20-module-api-1.0.4
myfaces-extcdi-jsf20-module-impl-1.0.4
myfaces-extcdi-jsf-alternative-configuration-1.0.4
myfaces-extcdi-message-module-api-1.0.4
myfaces-extcdi-message-module-impl-1.0.4
myfaces-extcdi-scripting-module-api-1.0.4
myfaces-extcdi-scripting-module-impl-1.0.4
I dont know if because the "WARNING" i have other problem:
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'myBean'
resolved to null,
I have in my beans.xml file under WEB-INF this:
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
</beans>
and in my bean:
@Named
@ViewAccessScoped
@Model
@View(Index.class)
public class MyBean implements Serializable{
public void test(){
//do nothing
}
.....
}
and in my index.xhtml
<h:commandButton value="CLICK" action="#{myBean.test}"/>
if i click my button the i get this error:
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'myBean'
resolved to null
viewId=/index.xhtml
location=C:\Users\user\Documents\NetBeansProjects\testweb\build\web\index.xhtml
phaseId=INVOKE_APPLICATION(5)
Caused by:
javax.el.PropertyNotFoundException - Target Unreachable, identifier
'myBean' resolved to null
at com.sun.el.parser.AstValue.getTarget(AstValue.java:153)
I dont know if this is for the first problem (*Both MyFaces and the RI are
on your classpath. Please make sure to use only one of the two
JSF-implementations.*)
I read i need to have my beans.xml but i have it!!!
Thanks, and sorry for the english, is not my native language
Im using: Netbeans 7.1, *Glassfish 3.1.2.1,* JDK 7u3, MyFaces 2.1.6, CODI
1.0.4, Windows 7.