Migrating JSF-Application to Weblogic 12
You should ask yourself why you are upgrading to a newer container without upgrading your application. If the answer is "because the code base is too large" and your old container is working just fine, leave it alone.
But, there are two likely errors: 1) Do you have any jsf api jars embedded in your web-inf/lib? 2) Are you sure you've setup 1.2 support correct? If you're loading jsf2.0 classes, you may need to use a special classloader that reads 1.2 jars first.
EDIT: At minimum, these jars should be provided by your container and should NOT be included in your WEB-INF/lib:
- jsf-impl.jar
- jsf-api.jar
- persistence-api.jar
I'm fairly certain these will also cause problems:
- jta.jar
- jstl.jar
- jsf-facelets.jar
Alexander Rühl
I am a Java fan from (nearly) the beginning and as well an early Java Enterprise developer, architect and nowadays mostly a project manager - yet, there is always more to learn and thus I'm happy to participate in this active and valuable community. I work for SyroCon Consulting GmbH in Eschborn/Germany as a Senior Consultant. Additionally, I am the Competence Lead for Java Enterprise, responsible for developing this area company-wide and always in search for people who like to join us.
Updated on June 20, 2022Comments
-
Alexander Rühl almost 2 years
We developed a Seam 2 based Java EE 5 application and it runs on Weblogic 11g.
Now I tried to deploy the same WAR file to the new Weblogic 12c (12.1.1.0 on my local Windows 7 machine) by following the same steps as on the previous WLS, including the deployment of the required JSF 1.2 library.
The deployment and start of the application works fine, but when I open the URL in the browser, I get an 500 error and the logfile shows the following exception:
java.lang.UnsupportedOperationException at javax.faces.application.Application.getResourceHandler(Application.java:287) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:588) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242) ...
The operation in question in class Application belongs to the 2.0 version of JSF, which I don't understand why the container tries to call it since I stated to use JSF 1.2.
Any ideas what causes the problem and how to simply migrate an existing Java EE 5 application to WLS 12?
Edit 1/2/12: Since there are no answers, maybe a little bounty would help? ;-) No seriously, are there any details I may be able to provide to help me out on that one?
Edit 1/5/12: Related to cj91 request - the project is not Maven based, so there's no POM. But here's the deployment descriptor weblogic.xml:
<?xml version='1.0' encoding='UTF-8'?> <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> <library-ref> <library-name>jsf</library-name> <specification-version>1.2</specification-version> <implementation-version>1.2</implementation-version> <exact-match>false</exact-match> </library-ref> </weblogic-web-app>
And here's the list of jars taken by the ant build:
commons-digester.jar jboss-seam-debug.jar jboss-seam-excel.jar jboss-seam-ioc.jar jboss-seam-mail.jar jboss-seam-pdf.jar jboss-seam-rss.jar jboss-seam-ui.jar jsf-facelets.jar jxl.jar richfaces-impl.jar richfaces-ui.jar standard.jar jstl.jar jsf-api.jar commons-collections-3.2.1.jar commons-lang.jar jboss-seam.jar persistence-api.jar jta.jar jsf-impl.jar darkX.jar glassX.jar laguana.jar antlr-runtime.jar commons-beanutils.jar core.jar drools-templates.jar drools-decisiontables.jar drools-compiler.jar drools-api.jar drools-core.jar janino.jar jboss-el.jar jboss-seam-remoting.jar jbpm-jpdl.jar mvel2.jar richfaces-api.jar spiffy-with_source-all-0.05.jar SuperCSV-1.52.jar commons-logging.jar dom4j.jar javassist.jar cglib.jar antlr.jar slf4j-api.jar slf4j-log4j12.jar hibernate-core.jar hibernate-search.jar hibernate-commons-annotations.jar hibernate-annotations.jar hibernate-entitymanager.jar hibernate-validator.jar jboss-common-core.jar concurrent.jar lucene-core.jar gwt-servlet.jar
I'm sure there are more jars in it than needed, but that's the setting in which it currently runs on a WebLogic 10.3.5.
I suspected the jsf and jstl jars to be the source of the problem, but deleting them from the war didn't change anything.
The question is still - why does WLS 12 tries to execute something from JSF 2.0?
Edit 1/6/12: I managed to solve the original problem - still the application is not running properly (and still this is strange for me, since I didn't expect that one has to change many things in a previously running application when updating to a new release of WLS), but I declare this case here as solved.
For those interested, I did - thanks to the help of the answers and some googling these things:
Change weblogic.xml to:
<?xml version='1.0' encoding='UTF-8'?> <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> <container-descriptor> <prefer-web-inf-classes>false</prefer-web-inf-classes> </container-descriptor> <library-ref> <library-name>jsf</library-name> <specification-version>1.2</specification-version> <implementation-version>1.2.9.0</implementation-version> <exact-match>true</exact-match> </library-ref> </weblogic-web-app>
Deleted the following jars from WEB-INF/lib:
jsf-impl.jar jsf-api.jar persistence-api.jar jta.jar jstl.jar
Within faces-config.xml change view handler to (due to IllegalStateException, see here):
<view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
Within persistence.xml change query factory class to (due to ClassNotFoundException: org.hibernate.hql.ast.HqlToken, see here)
<property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
-
Alexander Rühl over 12 yearsThere is no business reason for that, the production release will be kept on a WLS 11g. It was my intention to try out the new release since they finally managed to release a JEE 6 container. And I thought that it should be capable of running a JEE 5 application without changing the code itself. Concerning your questions, I will check the jars, maybe that's the source of the problem and I'm not using jsf2.0, I did the exact same configuration in WLS than before by installing jsf1.2 as a lib and then my application.
-
Alexander Rühl over 12 yearsOne addition: Application.getResourceHandler() is something from JSF 2.0 - so why is it called at all when JSF 1.2 was specified as required library in the deployment descriptor?
-
Jonathan S. Fisher over 12 yearsCan you post your POM? I'm almost certain you're running into issue #1
-
Alexander Rühl over 12 yearsI did that, only via the admin console.
-
Chase over 12 yearsWhen you look in localhost:7001/console under Deployments, is jsf listed with a type of Library? Also is your implementation-version really only 1.2, usually it is a more specific number. Also, can you get rid of prefer-web-inf-classes?
-
Alexander Rühl over 12 yearsI do have it as library and also with an order prior to my application. Yes, I only need 1.2 - but when I set exact-match to true, what exactly has the version to be (for example the deployable library's MANIFEST says 1.2.9.0)? And, I have not tested setting prefer-web-inf-classes to true. I only wondered, why having that very same setup within 10.5.3 it's not working under the new WLS?
-
Jonathan S. Fisher over 12 yearsadded list of jars I think you should remove
-
Alexander Rühl almost 5 yearsAlways interesting, to get answers to such an old question again, I haven't used Weglogic in many years, but thanks anyhow.