You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sige <si...@yahoo.co.nz> on 2009/05/28 04:25:44 UTC

T5.1.0.5, XMLInputFactory class cast exception

Hi

I have been trying to migrate an web app from T5.0.9 to T5.1.0.5, and failed
to start the application, with the following message:

ERROR Construction of service TemplateParser failed: Error invoking
constructor org.apache.tapestry5.internal.services.TemplateParserImpl(Map,
boolean) (at TemplateParserImpl.java:50) via
org.apache.tapestry5.internal.services.InternalModule.bind(ServiceBinder)
(at InternalModule.java:65) (for service 'TemplateParser'):
com.sun.xml.internal.stream.XMLInputFactoryImpl cannot be cast to
org.codehaus.stax2.XMLInputFactory2
[org.apache.tapestry5.internal.services.InternalModule.TemplateParser]
org.apache.tapestry5.ioc.internal.OperationException: Error invoking
constructor org.apache.tapestry5.internal.services.TemplateParserImpl(Map,
boolean) (at TemplateParserImpl.java:50) via
org.apache.tapestry5.internal.services.InternalModule.bind(ServiceBinder)
(at InternalModule.java:65) (for service 'TemplateParser'):
com.sun.xml.internal.stream.XMLInputFactoryImpl cannot be cast to
org.codehaus.stax2.XMLInputFactory2
	at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:90)
	at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
	at
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
	at
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
	at
org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
	at
org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
	at
org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60)
	at
org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52)
	at
org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
	at
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
	at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
	at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
	at
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
	at
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
	at
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68)
	at
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
	at $TemplateParser_12184efbe5c.delegate($TemplateParser_12184efbe5c.java)
	at
$TemplateParser_12184efbe5c.parseTemplate($TemplateParser_12184efbe5c.java)
	at
org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.parseTemplate(ComponentTemplateSourceImpl.java:151)
	at
org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl.getTemplate(ComponentTemplateSourceImpl.java:135)
	at
$ComponentTemplateSource_12184efbe5b.getTemplate($ComponentTemplateSource_12184efbe5b.java)
	at
org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:197)
	at
org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:183)
	at
org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:157)

my web.xml is like:

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">
   <web-app>    
    <display-name>Search App</display-name>
    <context-param>
        <!-- The only significant configuration for Tapestry 5, this informs
Tapestry
			of where to look for pages, components and mixins. -->
        <param-name>tapestry.app-package</param-name>
        <param-value>org.search.app</param-value>
   </context-param>
    
    <context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/searchApplicationContext.xml</param-value>
	</context-param>
	
	<context-param>
       <param-name>tapestry.use-external-spring-context</param-name>
       <param-value>true</param-value>
    </context-param> 
	
    <filter>
        <filter-name>app</filter-name>
       
<filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
        <!-- <filter-class>org.apache.tapestry.TapestryFilter</filter-class>
-->
    </filter>
    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

I have searched the forum for similar problems without any solution.  It
seems T5.1 has introduced stax2 for parsing xml but not sure if this is
configurable. Could any body help?

Thanks a lot!

Sige
-- 
View this message in context: http://www.nabble.com/T5.1.0.5%2C-XMLInputFactory-class-cast-exception-tp23754162p23754162.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1.0.5, XMLInputFactory class cast exception

Posted by Christian Köberl <ta...@gmail.com>.
Hi committers!

This class cast exception is a major issue! Tapestry will usually not run on
any application server (I tested Glassfish and Websphere CE 2) because the
appservers will use their own implementation of Stax.

The main problem is in
org.apache.tapestry5.internal.services.TemplateParserImpl.<init>(TemplateParserImpl.java:44).
Here, XMLInputFactory2 is asked for an instance - but XMLInputFactory2 does
not implement the method newInstance. This is delegated to XMLInputFactory.
So, the original XMLInputFactory is used - which returns the platform
implementation of Stax.

There is a workaround but a main stream web application framework should run
on JEE compatible web and application servers without tweaking.

Here is the way to replace Woodstox with standard Stax implementation.
http://derkoe.wordpress.com/2009/04/16/tapestry-51-woodstox/ (see also
"Woodstox dependency needed?" on this mailing list).

I also added a JIRA here: https://issues.apache.org/jira/browse/TAP5-745

Chris
-- 
View this message in context: http://n2.nabble.com/T5.1.0.5%2C-XMLInputFactory-class-cast-exception-tp2985027p3062507.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1.0.5, XMLInputFactory class cast exception

Posted by Christian Köberl <ta...@gmail.com>.
Hi Sige!

The problem is that Tapestry uses some special extensions to StaX in the
template parser. Therefore Tapestry casts the XMLInputFactory to the
Woodstox implementation and fails.

Workaround:
 1. add a system parameter
-Djavax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory
 2. restart the application server.

Chris
-- 
View this message in context: http://n2.nabble.com/T5.1.0.5%2C-XMLInputFactory-class-cast-exception-tp2985027p3062167.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1.0.5, XMLInputFactory class cast exception

Posted by zack1403 <za...@gmail.com>.
I have this same issue when I try to redeploy my app in Tomcat 6.  If you try
to redeploy a war file in Tomcat without restarting the server this
exception occurs.  It is really annoying to restart each time I deploy.
Anyone found a workaround for this?

Zack


Thiago H. de Paula Figueiredo wrote:
> 
> On Wed, May 27, 2009 at 11:25 PM, sige <si...@yahoo.co.nz> wrote:
> 
>> Hi
> 
> Hi!
> 
> Your problem looks like mismatched dependencies. Make sure you only
> have 5.1.0.5 Tapestry JARs in your classpath.
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5.1.0.5%2C-XMLInputFactory-class-cast-exception-tp23754162p23933248.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.1.0.5, XMLInputFactory class cast exception

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, May 27, 2009 at 11:25 PM, sige <si...@yahoo.co.nz> wrote:

> Hi

Hi!

Your problem looks like mismatched dependencies. Make sure you only
have 5.1.0.5 Tapestry JARs in your classpath.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org