Skip to content
Advertisement

“unable to locate Spring NamespaceHandler” error

I’m creating a stand-alone Sava application with Spring, to handle the JDBC access. The application works fine on every test and I decided that I need a jar to be deployed our clients.

They might not have spring in their classpath, so I used maven-assembly-plugin to handle the jar creation with dependencies.

However when I try to run the application:

JavaScript

Which throws the following error:

JavaScript

The applicationContext.xml file is in projectbase/src/main/resources. And its placed at target/packagename base.

The applicationContext.xml

JavaScript

Advertisement

Answer

I found the error, the bug lies in an unfixed bug in the maven-assembly plugin. I used the following workaround:

First commented out the maven-assembly code in my pom. Then I copied the dependencies to a lib folder at the target using the maben-dependency-plugin:

JavaScript

Then I used the maven-jar-plugin to setup my executable jar:

JavaScript

Finally I created a bash script that is deployed with the application that runs my app with its libs and any provided arguments:

JavaScript

I should have built the app in python =/

Advertisement