3 Replies Latest reply on Oct 19, 2012 2:29 AM by Steve Button-Oracle

    WebLogic 12c and OSGi bundles ClassCastException error

      When I deploy an OSGi bundle to WebLogic 12c there are no errors. However, when I try and access my application I get the following error:

      java.lang.ClassCastException: com.sun.faces.taglib.jsf_core.ViewTag cannot be cast to javax.servlet.jsp.tagext.Tag

      I suspect that WebLogic 12c is loading different versions of the JSF than what I have in my OSGi bundle but I am unable to confirm (I tried to deploy the wls-cat tool but I continue to get 503 errors even after a server restart).

      My bundle currently uses JSF 1.1. After reading various forum posts, I have done the following but have not had any success:

      1. Followed the steps in Re: jsf 1.2 on weblogic 12c (i.e. deploying the jsf-1.2.war, modified my weblogic.xml accordingly in my war and then deployed, etc)
      2. Checked all of my manifest entries (which were correct) and even tried to set the required-bundles to my own JSF in the WEB-INF/lib directories

      Are there any instructions/settings for having OSGi bundles work within WebLogic 12c? Note that my OSGi bundle works correctly in WebLogic 11.

      Side question..I read that even though WebLogic 12c ships JSF 1.2 for backwards compatibility, it is deprecated for this release (as per http://docs.oracle.com/cd/E24329_01/web.1211/e21049/configurejsfandjtsl.htm#i163099). Does that mean that even if I get my bundle deployed/working that if there are other errors/issues in the future then I would not be supported? I am just trying to confirm so that I can make a decision about upgrading my JSF.

      Thanks :)
        • 1. Re: WebLogic 12c and OSGi bundles ClassCastException error
          Just pinging again if anyone has any ideas?

          One other question has come to mind...

          Based on http://docs.oracle.com/cd/E24329_01/web.1211/e21049/configurejsfandjtsl.htm, specifically "In this release, JSF 2.x and JSTL 1.2 have been incorporated directly in the server's classpath", is there a way I can easily change/remove this in order to test? I looked into the console as well as in various start up and env bat files but I have not found anything specific.

          Edited by: 961012 on 28-Sep-2012 12:29
          • 2. Re: WebLogic 12c and OSGi bundles ClassCastException error
            I suppose to simplify my question, how would I configure WebLogic 12c to only use what I have in my OSGi bundle and not use the defaults from the app server?
            • 3. Re: WebLogic 12c and OSGi bundles ClassCastException error
              Steve Button-Oracle
              gday -

              WLS 12c (12.1.1) doesn't recognize OSGi bundles -- if you have a library you wish to use with your web application, then it needs to conform the packaging requirements for the Java EE deployment model you are using.

              If you are getting conflicts with a WLS supplied library (JSF in this case it appears) then you need to specify a filtering classloader definition in a weblogic deployment descriptor so that the web/app classloader is instructed to ignore a specified set of packages/resources from the parent loaders and load them locally.

              By way of an example, assume you have a web application in which you are bundling JSF 1.2 and you want to use this in place of the JSF 2.1 API/impl that is provided by WLS 12.1.1. In that case, you'd create a WEB-INF/weblogic.xml file and provide the following settings within in.
              <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
              Deploying that with your application, in which you have supplied the JSF 1.2 API and implementation jars in the standard WEB-INF/lib directory will direct WLS to use those locally supplied libraries instead of its JSF API/implementation.

              Hope that helps.