Migrating JSF-Application to Weblogic 12
Asked Answered
C

3

6

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"/>
Coachandfour answered 20/12, 2011 at 11:1 Comment(1)
thanks for this post and what you did to fix it!!! I am trying to do the same thing as you and this has helped me a lot. +1!!!Kemme
B
1

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
Benighted answered 2/1, 2012 at 22:31 Comment(4)
There 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.Titty
One 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?Titty
Can you post your POM? I'm almost certain you're running into issue #1Benighted
added list of jars I think you should removeBenighted
S
0

Look at the section entitled "Deploying JSF 1.2 and JSTL Libraries" at http://docs.oracle.com/cd/E24329_01/web.1211/e21049/configurejsfandjtsl.htm

Skipton answered 3/1, 2012 at 20:27 Comment(3)
I did that, only via the admin console.Titty
When 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?Skipton
I 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?Titty
A
0

Note that we are using MyFaces and a very old version at that. We used something like this with WebLogic 12 and got it to work once we removed the servlets line (all of this goes inside container-descriptor stanza):

    <prefer-web-inf-classes>false</prefer-web-inf-classes>
    <prefer-application-packages> 
        <package-name>javax.faces.*</package-name>
        <package-name>com.sun.faces.*</package-name>
        <package-name>com.sun.facelets.*</package-name>
        <package-name>org.apache.myfaces.*</package-name>
        <package-name>org.apache.taglibs.*</package-name>
    </prefer-application-packages> 

   <prefer-application-resources> 
       <resource-name>javax.faces.*</resource-name>
        <resource-name>com.sun.faces.*</resource-name>
        <resource-name>com.sun.facelets.*</resource-name>
        <resource-name>org.apache.myfaces.*</resource-name>
        <resource-name>org.apache.taglibs.*</resource-name>

        <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
        <resource-name>META-INF/services/com.sun.faces.*</resource-name>
   </prefer-application-resources>

This is nothing short of a miracle. :-) Hope this helps someone.

Adel answered 29/7, 2019 at 22:37 Comment(1)
Always interesting, to get answers to such an old question again, I haven't used Weglogic in many years, but thanks anyhow.Titty

© 2022 - 2024 — McMap. All rights reserved.