AWG Blogs

  • Getting ADB Working for SPH-M840 - Had a SPH-M840 Galaxy Ring Virgin Mobile 3G Android version 4.1.2, attempting to install apps from Android Studio failed to detect device. Installed SAMSUN...
    7 months ago
  • How to check if I have write permissions to an Oracle table - SELECT CASE WHEN COUNT(*) > 0 THEN 'YES' ELSE 'NO' END AS PERMISSIONS FROM ( SELECT privilege FROM ( select * from dba_tab_privs where (grantee = 'MY_USE...
    7 months ago
  • JSF vs Struts 2 - JSF was designed in part by the authors of Struts to create a "Struts" that did a more accurate implementation of MVC (Struts is technically "Model 2") a...
    8 months ago
  • XML Beans vs JAXB - Seems XML Beans is superior: JAXB provides support for the XML schema specification, but handles only a subset of it; XMLBeans supports all of it. Also, by...
    1 year ago
  • Algorithms and OOP - In addition to DCI, "generic programming" as well as the move to functional programming appears to add nuance to the OOP notion of joining behavior with da...
    1 year ago
  • Flyweight vs Singleton - Implementations seems to be virtually identical, differing only in style, where the flyweight object is created and held by associated objects (containers:...
    1 year ago
  • init-param vs context-param - see http://javahash.com/difference-between-servlet-init-and-context-parameter/ for background. Gist: context-param variables are global and accessible thro...
    1 year ago
  • rbenv vs RVM - RVM is responsible not only for changing Ruby versions, but for installing rubies and managing gemsets, as well. ...Along with rbenv [to manage ruby versi...
    2 years ago

Sunday, November 2, 2014

Solving Sruts2 Core Jar File Conflict

I was adding a Struts2 application to an embedded Tomcat 6 instance by adding the context and assigning the path to the Struts2 application programmatically. The Struts2 application's WEB-INF/lib was empty similar to what's known as a "skinny war." When attempting to access a jsp page though I would get the error: "/struts-tags" not found.

This was solved by adding struts2-core-2.3.4.1.jar to the WEB-INF/lib. However then application would not load and I would get:
Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:C:/MyCustomContainer/plugins/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72 - bean - jar:file:/D:/temp/configs/pings/strutssd/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72

So I removed struts2-core-2.3.4.1.jar from the plugins dir leaving only the copy in the WEB-INF/lib. This fixed the problem and the Struts2 application finally worked.

Note this could cause problems if I were to add another Struts2 application to the container although I haven't tried it.

Related problems with workarounds including removing struts-tags.tld and putting in WEB-INF, or adding Class-Path entries  to MANIFEST.MF:
http://stackoverflow.com/questions/19380836/skinny-war-libraries-in-ear-struts-tags-not-found-error
http://stackoverflow.com/questions/6339323/file-struts-tags-not-found-in-struts-1-3
http://stackoverflow.com/questions/19666413/what-is-the-right-way-to-package-struts2-jar-files
http://docs.codehaus.org/display/MAVENUSER/Solving+the+Skinny+Wars+problem