I am writing a project in RAD 9.6.1 with UI being developed in JSF 2.0. When I try to deploy my app on Websphere 9.0 I am getting the below error. I tried doing a Google but could not get any solution out of this tried all possible suggestions. the solutions I tried to get this fixed. I am deploying the app as an ear under which I have the war configured.
it works with Tomcat and jboss fine.
getting null pointer exception from the following line in component
static {
FacesContext facesContext = FacesContext.getCurrentInstance();
ValueExpression vex = facesContext.getApplication()
.getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{GenericDAO}",
ICRUDDAO.class); //this line give null pointer exception at initialization
dao = (ICRUDDAO) vex.getValue(facesContext.getELContext());
}
i solved the problem adding shared library of mojarra jsf implemention the server suppourt myfaces only Here's [a link]
https://www.ibm.com/developerworks/community/blogs/devTips/entry/Using_a_Custom_JSF_implementation_with_WebSphere_Liberty_Profile?lang=en
Related
We are migrating our application from JSF (MyFaces, Trinidad) 1.2 to JSF (MyFaces, Trinidad) 2.0. I have done the all basic changes like updating the XMLNS for Faces-Config, updating the Web.xml to support 3.0, removed Facelets, el-api, el-ri Jars.
When I set the classloaderMode to PARENT_LAST in Websphere 8.5.5 for picking our MyFaces & Trinidad jar, I'm getting the below error.
A java: URL name was used, but Naming was not configured to handle java: URL names. The likely cause is a user in error attempting to specify a java: URL name in a non-J2EE client or server environment. Throwing ConfigurationException
But I'm NOT getting the same exception when I set the classloaderMode to PARENT_FIRST. How can I resolve this problem? Please help me.
The error sounds like you have include WAS JNDI classes in your WAR, which when combined with PARENT_LAST causes the JDK JNDI to use those uninitialized classes rather than the ones included with WAS. You should not repackage WAS JARs in your application.
I'm using JSF2.0 (Mojarra 2.0.6) under WAS7 application server. My web module facet is set to support (servlet API) version - 2.5. Also Im using RSA8.0.4.
I can see below exception during server start-up. Can any one suggest?
com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0100E: Uncaught init() exception created by servlet Faces Servlet in application FATCAKycApplication:
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:851)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:309)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:219)
I think this question is very similar to what you are experiencing, you could try the approach described in BalusC's answer
we have a lot of tests that uses Myfaces Test Framework for JSF 2.0.
http://myfaces.apache.org/test/index.html
Problem is we can't get it to work with JSF 2.1. Does anyone know a workaround or a way to solve this?
When we run the tests we get the following error: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
It works fine with jsf 2.0 though.
A typical use case in our code:
// code block;
assertFalse("Error message not expected. ", facesContext
.getMessages().hasNext());
JSF 2.1 has a few syntax changes so my guess would be that's the problem.
MyFaces Test 2.0 works with 2.0 and 2.1. In fact, MyFaces 2.1 uses myfaces-test20-1.0.4 as test dependency, and inside the code you can find a lot of tests using that library.
I am having some trouble with JSF2 and websphere 7.0. I have searched in the internet but nothing. The thing looks to be that websphere puts its 1.2 libraries and override my 2.0 libs. The app is working fine in apache-tomcat
Thirst of all, when i try to get an xhtml page (with simple html the app works, the problem is with jsf) the server shows the error:
could not find factory: javax.faces.context.FacesContextFactory
i've read that i had to use the "parent last" option in the class loader section, but it didn't worked. Then i went to jsp and jsf options on the web module properties, and there i can choose between Sun reference implementation 1.2 and MyFaces 1.2, the sun was selected, so i choose myfaces and now the error is another one: if i try to go to "something.xhtml", it redirects to "something.jsf", which doesn't exists..
any idea?
thanks!
It seems that you didn't include the JSF implementation on your classpath.
Here's how I solved it.
Use the following library: javax.faces-2.1.7.jar
If you are on PrimeFaces 3.1: primefaces-3.1.1.jar
Application Server instance: Class Loading - Parent Last
Enterprise Application instance (war Module): Class Loading - Parent Last
Make sure to remove all Servlet Container libraries such as those needed by Tomcat.
I have been struggling with the unholy alliance that is WebSphere 7+ and Mojarra 2.0.4 and have run into something of a showstopper.
I followed the directions as specified at this forum post and got Mojarra 2.0.4 initializing properly: http://forum.primefaces.org/viewtopic.php?f=3&t=6860
Basically I created an isolated classloader shared library that refers externally to the Mojarra and Primefaces jars, added the shared library to the webapp and reversed the classloader to go PARENT_LAST. All of that works.
When I attempt to access my web app http://server:port/context/index.xhtml it is hitting the FacesServlet correctly but then instantly the Request Dispatcher is redirecting to index.jsp???
I don't have any JSP specified ANYWHERE in my code, my app, my web.xml, and in fact I specified DEFAULT-SUFFIX to be .xhtml and that didn't help. All my web pages are .xhtml extension and FacesServlet is mapped correctly to *.xhtml.
I have tried adding XHTML as a mime type to WebSphere, disabling the Request Dispatcher, all to no avail. I have been able to get this running correctly on Tomcat 6-7, JBoss 6 and Glassfish 3 with no problems but for some reason WebSphere insists on a JSP file extension?
I appreciate any help you might have.
WAS7 sometimes does not undeploy the web applications properly. Clearing WAS_PROFILE_HOME/temp and WAS_PROFILE_HOME/wstemp may help.