Migrating JSF-Application to Weblogic 12

Alexander Rühl picture Alexander Rühl · Dec 20, 2011 · Viewed 12.9k times · Source

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"/>

Answer

Jonathan S. Fisher picture Jonathan S. Fisher · Jan 2, 2012

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