Migration from Struts1 to Struts2.5

classic Classic list List threaded Threaded
3 messages Options
JK
Reply | Threaded
Open this post in threaded view
|

Migration from Struts1 to Struts2.5

JK
Hello All,

   We have a web application that was running on Struts1 and need to Migrate
that to the latest version of Struts (meaning 2.5.13). I have done migration
of couple of pages to Strut2 but we have some tile which were defined for
setting Header and Footer. I have a created a tiles.xml and placed the file
in /WEB-INF/ folder and configure the same in web.xml as shown below

<init-param>
                <param-name>definitions-config</param-name>
                <param-value>/WEB-INF/tiles.xml</param-value>
            </init-param>
        <listener>
                <listener-class>
                        org.apache.struts2.tiles.StrutsTilesListener
                </listener-class>
        </listener>

I was encountering the below error message while loading the page.

webapp        E com.ibm.ws.webcontainer.webapp.WebApp
notifyServletContextCreated SRVE0283E: Exception caught while initializing
context: {0}
                                 java.lang.IllegalStateException: Unable to
instantiate container.
        at
org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:60)
        at
com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1732)
        at
com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:415)
        at
com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
        at
com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
        at
com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:904)
        at
com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
        at
com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
        at
com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
        at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1201)
        at
com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1390)
        at
com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
        at
com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:979)
        at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:785)
        at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1403)
        at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2214)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:436)
        at
com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:379)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:127)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:654)
        at
com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5486)
        at
com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5612)
        at
com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:668)
        at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:612)
        at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:508)
        at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:508)
        at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:287)
        at
javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1263)
        at java.security.AccessController.doPrivileged(AccessController.java:620)
        at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:91)
        at
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1257)
        at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1096)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:831)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:813)
        at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
        at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
        at
com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
        at
com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
        at
com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
        at
com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
        at
com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
        at
com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$QueuedWork.run(SSLReadServiceContext.java:1987)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
Caused by: org.apache.tiles.TilesException: Unable to resolve factory class:
'org.apache.struts2.tiles.StrutsTilesContainerFactory'
        at org.apache.tiles.util.ClassUtil.instantiate(ClassUtil.java:75)
        at org.apache.tiles.util.ClassUtil.instantiate(ClassUtil.java:48)
        at
org.apache.tiles.factory.TilesContainerFactory.createFactory(TilesContainerFactory.java:286)
        at
org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:144)
        at
org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
        at
org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
        at
org.apache.struts2.tiles.StrutsTilesListener.createContainer(StrutsTilesListener.java:70)
        at
org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
        ... 52 more

Please help me if i was missing anything. The Jar file that i have placed in
/WEB-INF/lib folder were stated below

struts2-core-2.5.13.jar
struts2-tiles-plugin-2.3.8.jar
tiles-core-2.0.6.jar
tiles-jsp-2.0.6.jar
tiles-api-2.0.6.jar

Please do let me know if you need any information.

Thanks and Regards,
JK



--
Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Migration from Struts1 to Struts2.5

Yasser Zamani-2


On 11/15/2017 6:56 PM, JK wrote:
> Caused by: org.apache.tiles.TilesException: Unable to resolve factory class:
> 'org.apache.struts2.tiles.StrutsTilesContainerFactory'

It seems you don't have Struts Tiles Plugin 2.5.13 in your classpath.
Please try below in your pom.xml:

<dependency>
     <groupId>org.apache.struts</groupId>
     <artifactId>struts2-tiles-plugin</artifactId>
     <version>2.5.13</version>
</dependency>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Migration from Struts1 to Struts2.5

Lukasz Lenart
In reply to this post by JK
2017-11-15 16:26 GMT+01:00 JK <[hidden email]>:
> struts2-core-2.5.13.jar
> struts2-tiles-plugin-2.3.8.jar
> tiles-core-2.0.6.jar
> tiles-jsp-2.0.6.jar
> tiles-api-2.0.6.jar

You are using a wrong version of Tiles, Struts 2.5.13 and the Struts 2
Tiles plugin based on Tiles 3 - you must use Tiles 3.0.7 at least
http://struts.apache.org/maven/struts2-plugins/struts2-tiles-plugin/dependency-management.html


Regards
--
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]