Skip to content
Advertisement

Struts2.5.12 – NPE while using getText method from ActionSupport


I am migrating a project from Struts 2.3.3 to Struts 2.5.12 and I see NullPointerException when using the getText method from ActionSupport class.

My action class extends ActionSupport class. I have package.properties file also packaged in the war file.

My action class looks like:

JavaScript

And in package.properties file I have

JavaScript

I see the below exception when the bean for my action class is instantiated. Does anyone know if I am doing anything wrong here?

JavaScript

The Project Structure is:
enter image description here

And the WAR built has structure as:
enter image description here

Below jar files are added to WEB-INF/lib in the WAR file:
classworlds-1.1.jar
com.springsource.org.aopalliance-1.0.0.jar
commons-betwixt-0.8.jar
commons-chain-1.2.jar
commons-digester-1.8.jar
commons-fileupload-1.2.1.jar
commons-httpclient-3.1.jar
commons-io-2.4.jar
commons-lang3-3.6.jar
commons-validator-1.3.1.jar
freemarker-2.3.23.jar
gson-2.1.jar
httpclient-4.3-beta1.jar
httpclient-osgi-4.3.jar
httpcore-4.2.2.jar
javassist-3.18.0-GA.jar
jaxrpc-api-1.1.jar
jcifs-1.3.17.jar
log4j-api-2.8.2.jar
ognl-3.1.12.jar
oro-2.0.8.jar
serializer-2.7.1.jar
spring-aop-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-context-support-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
spring-jdbc-3.0.5.RELEASE.jar
spring-jms-3.0.5.RELEASE.jar
spring-orm-3.0.5.RELEASE.jar
spring-remoting-2.0.8.jar
spring-tx-3.0.5.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
struts2-core-2.5.12.jar
struts2-json-plugin-2.5.12.jar
struts2-spring-plugin-2.5.12.jar
struts2-tiles-plugin-2.5.12.jar
tiles-api-3.0.7.jar
tiles-autotag-core-runtime-1.2.jar
tiles-core-3.0.7.jar
tiles-el-3.0.7.jar
tiles-freemarker-3.0.7.jar
tiles-jsp-3.0.7.jar
tiles-ognl-3.0.7.jar
tiles-request-api-1.0.6.jar
tiles-request-freemarker-1.0.6.jar
tiles-request-jsp-1.0.6.jar
tiles-request-servlet-1.0.6.jar
tiles-servlet-3.0.7.jar
tiles-template-3.0.7.jar
wsdl4j-1.5.1.jar
xml-apis-1.3.02.jar

Advertisement

Answer

You should not use a file with name struts-default.xml. This is a configuration file that is loaded by default. The default configuration file name for the application is struts.xml.

Rename this file

JavaScript

to

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement