i have developed an application using jsf 1.2. it worked fine with apache tomcat 6. i took the war file on production with websphere 7 and deployed the application. i recieved following error.
E com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0100E: Uncaught init()
exception created by servlet Faces Servlet in application Products_war:
java.lang.IllegalStateException: Application was not properly initialized at startup,
could not find Factory: javax.faces.context.FacesContextFactory
my classpath file has following entries
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/
org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6"/>
<classpathentry kind="con"
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget
/Apache Tomcat v6.0"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
i have made following tries after googling till now..
including following listener in web.xml
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
and removed jsf-api and jsf-impl from the lib folder of my application but to no avail.
plz help.
thanks in advance
WAS 7 already ships with JSF 1.2 bundled which can be either the "Sun RI" (Mojarra) or "MyFaces" (from Apache) implementation which is configureable in the WAS admin console. You need to remove the JSF JAR files from /WEB-INF/lib and you need to remove the listener from the web.xml.
See also:
WAS 7 developer guide - Configuring JavaServer Faces implementation
Another thing to check: We have myfaces configured as a shared library on WebSphere. In troubleshooting my local configuration I had to set the shared library to "Use an isolated class loader for this shared library"
This is identified as part of the requirements for running a third-party JSF implementer:
Be Aware: If the you want to use a third party JSF implementation that is not shipped with the product, then:
Keep the configuration set to the SUN RI.
Add the third party listener to the web.xml file that is required.
Add the third party implementation Java archive (JAR) files to the
application as an isolated shared library.
http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tweb_jsf.html
Maybe this will help someone if the first answer doesn't work for them.
Related
I'm migrating applications from WebSphere 7.0 to WebSphere 8.5. WebSphere 8.5 uses older version of MyFaces (2.0.2) than we use (2.0.7) so I've tried to configure the newer version in the same way as under WAS 7.0, that is, using shared library.
I've configured shared library with the following jars:
myfaces-api-2.0.7.jar
myfaces-impl-2.0.7.jar
commons-logging-1.1.1.jar
commons-digester-1.8.jar
commons-collections-3.2.jar
commons-codec-1.3.jar
I've checked the option Use an isolated class loader for this shared library . I've got the error:
com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E:
[Servlet Error]-[Faces Servlet]: java.lang.IllegalStateException: No
Factories configured for this Application. This happens if the
faces-initialization does not work at all - make sure that you
properly include all configuration settings necessary for a basic
faces application and that all the necessary libs are included. Also
check the logging output of your web application and your container
for any exceptions! If you did that and find nothing, the mistake
might be due to the fact that you use some special web-containers
which do not support registering context-listeners via TLD files and a
context listener is not setup in your web.xml. A typical config looks
like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:196) at
javax.faces.webapp.FacesServlet.init(FacesServlet.java:112) at
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:337)
The same configuration worked on WAS 7.0, with the exception that there was an additional jar configured in the shared library:
C:\IBM\SDP\runtimes\base_v7\optionalLibraries\IBM\JSFProviders\WebSphere-MyFaces20-annotation-provider.jar
What is wrong here? Do I need to specify something in place of that WebSphere-MyFaces20-annotation-provider.jar? I wasn't able to find any example of configuring such shared library for WAS 8.5. There's only that for WAS 7.0, that I've used successfully on WAS 7.0.
There is some related discussion in the WASdev forum but apparently no actual answer yet.
https://www.ibm.com/developerworks/community/forums/html/topic?id=d2261080-de03-4aef-97ce-b60c5b8a517b&ps=25
I am using Prime faces in my application.
I have specification to migrate Tomcat server(6) to Glass fish(v2.1)
I have done it in net beans.
But I am getting HTTP Status 503 Error while running project.
(Working fine while using tomcat 6)
Getting This in console
Initializing Mojarra (1.2_13-b01-FCS) for context '/Prime'
WebModule[/Prime]PWC1275: Exception sending context initialized event to listener
instance of class com.sun.faces.config.ConfigureListener
Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value '2.0' is not
facet-valid with respect to enumeration '[1.2]'. It must be a value from the enumeration.
Why i am getting this error and please give me a solution for this.
Thank You.
Glassfish v2 ships as being a full fledged Java EE 5 container with JSF 1.2 bundled. Your webapp is apparently a JSF 2.0 based one which has JSF 2.0 libraries in /WEB-INF/lib. This will of course conflict with Glassfish's own JSF 1.2 librares with errors like this. Your specific error is caused by having <faces-config version="2.0"> which isn't supported by JSF 1.2.
Whilst backwards compatible with Java EE 5, JSF 2.0 is part of Java EE 6 and thus by default only bundled in Glassfish v3 and so on. That it works in Tomcat is obviously because Tomcat as being a barebones JSP/Servlet container doesn't ship with JSF bundled, but only with JSP/Servlet. So there would be no potential version conflicts with JSF in Tomcat.
You need to tell Glassfish that it should not use its own bundled JSF, but instead the webapp bundled JSF. You can do that by adding the following entries to <sub-web-app> of /WEB-INF/sun-web.xml file:
<class-loader delegate="false"/>
<property name="useBundledJsf" value="true"/>
If you don't have this file, you can find a sample at the bottom of this Glassfish v2.1.1 deployment guide:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD
Application Server 9.0 Servlet 2.5//EN'
'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'>
<sun-web-app>
<!-- Your config here -->
</sun-web-app>
My java web application was working on Apache Tomcat. It needs some third party libraries for its work (jasperreports 3.7.2 in particular). But now it became necessary to move application on WebLogic. And it appears that it uses not the library it was using before (on Tomcat) but some other version of this library (I suspect that one which comes with WebLogic by default). How can i specify concrete version of library and make WebLogic use it? I've never used weblogic before. May be i should type something in deployment descriptors or something like that? Thanks for your replies.
If you have the JAR you want inside WEB-INF/lib in your war, you can tell Weblogic to use that jar over any other jar that might be present in the Classloader.
Use the prefer-web-inf-classes element in a weblogic.xml Web application deployment descriptor (that goes in WEB-INF next to the web.xml)
Here is an example weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
Note: In this usage all WEB_INF/lib classes will be preferred over other versions in the classpath.
i have Web Application which should use JSF 2.0 libraries included in WEB-INF/lib... but it does not... instead of i'm getting exception because my server (JBoss 4.2) also provides JSF libraries...
How can i force my application to use .jar's from WEB-INF/lib ?
Note: When i removed JSF libs from server, my application runs as it should.
Tell JBoss that your WAR already bundles JSF by the following entry in your webapp's web.xml.
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
Why can't you use the server versions of those JARs?
You should be writing and testing your application using the same versions of the JARs that the server you deploy to is using. Synch up....I'd either upgrade JBOSS or downgrade your app.
But, if you must, perhaps this document can tell you how:
http://www.datadisk.co.uk/html_docs/java_app/jboss5/jboss5_deployment.htm
I am familiar with the classloading trouble when using JSF 2 in Websphere 7. I'd like to know if there are similar problems on other fullstack application servers. What about JBoss 5+, WebLogi 10+, etc? Are there any known issues with JSF 2 and if so, what needs to be done to get JSF 2 running on these servers?
Thx
On WebSphere 5.x up to with the current 8.x you need to set the WAR and EAR classloader to PARENT_LAST in the WAS admin console whenever you want to bundle and use your own JSF impl in /WEB-INF/lib.
On JBoss 4.x up to with the current 6.x it's sufficient to add the following context param to /WEB-INF/web.xml to suppress JBoss' builtin JSF deployer.
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
On Glassfish 2.x up to with the current 3.x you need to add the following entries to the /WEB-INF/sun-web.xml (Eclipse with Glassfish plugin should autogenerate the template file if you create a web project with target runtime set to Glassfish).
<class-loader delegate="false" />
<property name="useBundledJsf" value="true" />
On Weblogic, sorry I have no idea, I have never used it.
In WebLogic there is a shared Java EE library that is included with WebLogic for JSF 2.0. It is easy to use and referenced through a deployment descriptor.
Here is a brief how-to for the library concept Jeff mentioned.
http://blog.eisele.net/2009/07/jsf-20-beta-1-on-oracle-weblogic-10gr3.html
Seeing the latest WLS 12c it still is in place but AFAIK you will end up having to revert the web-app classloader in the future in favor of this concept.