dev@javaserverfaces.java.net

Re: [Fwd: Re: cannot be cast to com.sun.faces.application.ApplicationAssociate]

From: Adam Winer <adam.winer_at_oracle.com>
Date: Thu, 02 Aug 2007 13:21:58 -0700

Set the <scope> to "provided" in your pom.xml.

-- Adam


Tom Kalafut wrote:
> Thanks. That did the trick.
>
> Now I just gotta figure out how to (automatically) exclude some of my
> dependency jar files from Maven 2's war plugin so that I don't have to
> manually delete them after every build. The warSourceExcludes tag
> doesn't want to cooperate.
>
> Tom
>
>
> Tom Kalafut
> I3/CG Crew Member
> Trident Systems Inc.
> tommyk_at_tridsys.com
> (919)388-1264
>
> ============
> The opinions expressed in this e-mail may not necessarily reflect the
> opinions of Trident Systems Inc.
>
>
> -----Original Message-----
> Tom Kalafut wrote:
>> Hi. I'm trying to run a JSF 1.2_04 app with Tomcat 6.0.13.
>>
>> I had a problem with ExpressionFactoryImpl but solved that by getting
>> el-ri-1.1.11.jar from facelets, but now I'm stuck again. Anybody seen
>> this puzzling "cannot cast Class ApplicationAssociate to Class
>> ApplicationAssociate" before with JSF 1.2_04?
>>
>> ((Could ""INFO: validateJarFile(C:\Program Files\Apache Software
>> Foundation\Tomcat 6.0\web
>>
>> apps\smfadmin\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See
>> Servlet Spe
>>
>> c 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class""
>> have anything to do with it?))
>>
> The message above means you have Servlet classes included with the web
> application. Since the spec disallows overriding these classes that are
> provided by the container, Tomcat gives you this message.
> I would remove any javax.servlet classes from your web application.
>
> More inline....,
>> Thanks,
>> Tom
>>
>> =====Tomcat Startup Trace=========
>>
>> Aug 2, 2007 1:34:16 PM org.apache.coyote.http11.Http11Protocol init
>>
>> INFO: Initializing Coyote HTTP/1.1 on http-8080
>>
>> Aug 2, 2007 1:34:16 PM org.apache.catalina.startup.Catalina load
>>
>> INFO: Initialization processed in 376 ms
>>
>> Aug 2, 2007 1:34:16 PM org.apache.catalina.core.StandardService start
>>
>> INFO: Starting service Catalina
>>
>> Aug 2, 2007 1:34:16 PM org.apache.catalina.core.StandardEngine start
>>
>> INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
>>
>> Aug 2, 2007 1:34:16 PM org.apache.catalina.startup.HostConfig
>> deployWAR
>>
>> INFO: Deploying web application archive smfadmin.war
>>
>> Aug 2, 2007 1:34:16 PM org.apache.catalina.loader.WebappClassLoader
>> validateJarF
>>
>> ile
>>
>> INFO: validateJarFile(C:\Program Files\Apache Software
>> Foundation\Tomcat 6.0\web
>>
>> apps\smfadmin\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See
>> Servlet Spe
>>
>> c 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
>>
>> Aug 2, 2007 1:34:17 PM com.sun.faces.config.ConfigureListener
>> contextInitialized
>>
>> INFO: Initializing Sun's JavaServer Faces implementation
>> (1.2_04-b16-p02) for co
>>
>> ntext '/smfadmin'
>>
>> Aug 2, 2007 1:34:17 PM com.sun.faces.config.ConfigureListener
>> contextInitialized
>>
>> INFO: Initializing Sun's JavaServer Faces implementation
>> (1.2_04-b16-p02) for co
>>
>> ntext '/smfadmin'
>>
>> Aug 2, 2007 1:34:17 PM org.apache.catalina.core.StandardContext
>> listenerStart
>>
>> SEVERE: Exception sending context initialized event to listener
>> instance of clas
>>
>> s com.sun.faces.config.GlassFishConfigureListener
>>
>> *java.lang.ClassCastException:
>> com.sun.faces.application.ApplicationAssociate can*
>>
>> *not be cast to com.sun.faces.application.ApplicationAssociate*
>>
>> at
>> com.sun.faces.application.ApplicationAssociate.getInstance(Applicatio
>>
>> nAssociate.java:208)
>>
> I'm thinking this is because ApplicationAssociate is loaded in two
> different classloaders.
> The presence of GlassFishConfigureListener in the stacktrace kinda
> confirms this.
> GlassFishConfigureListener was a JSF 1.2 FCS artifact and shouldn't be
> present in
> 1.2_04 P02.
>
> Where have you installed JSF 1.2_04 P02? In WEB-INF/lib of the web
> application, or in TOMCAT_HOME/lib?
>
>> at
>> com.sun.faces.config.JSFVersionTracker.publishInstanceToApplication(J
>>
>> SFVersionTracker.java:269)
>>
>> at
>> com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLi
>>
>> stener.java:551)
>>
>> at
>> com.sun.faces.config.GlassFishConfigureListener.contextInitialized(Gl
>>
>> assFishConfigureListener.java:47)
>>
>> at
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContex
>>
>> t.java:3827)
>>
>> at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4
>>
>> 334)
>>
>> at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
>>
>> .java:791)
>>
>> at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
>>
>> 1)
>>
>> at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
>>
>> at
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
>>
>> at
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714
>>
>> Tom Kalafut
>>
>> I3/CG Crew Member
>>
>> Trident Systems Inc.
>>
>> tommyk_at_tridsys.com <mailto:tommyk_at_tridsys.com>
>>
>> (919)388-1264
>>
>> * *
>>
>> *============***
>>
>> *The opinions expressed in this e-mail may not necessarily reflect the
>
>> opinions of Trident Systems Inc.*
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>