XML : Grade Fat Jar Plugin and Spring: Error Loading XML bean definitions from class path resource

After build my application with grade fat jar plugin as is configured bellow:

  task fatJar(type: Jar) {      manifest {          attributes 'Implementation-Title': 'PACMAN',                  'Implementation-Version': version,                  'Main-Class': 'com.y.y.z.Mainclass'      }      baseName = project.name + '-all'      from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }      with jar  }    

And running this app (fat-jar with all dependencies) as follow:

  -bash-3.2$ java -Dconf.properties=/app/home/wasa/sat/bin/app.properties -jar app-all-1.0.jar    

Two thinks happens:

First is received the spring bootstrap start messages:

  11/01/2016 11:38:59 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@11f23e5: startup date   [Mon Jan 11 11:38:59 BRST 2016]; root of context hierarchy    11/01/2016 11:39:00 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions  INFO: Loading XML bean definitions from class path resource [applicationContext.xml]    

And then after a while thi error/exception raises as described bellow:

  11/01/2016 11:42:12 org.springframework.beans.factory.xml.XmlBeanDefinitionReader warning  Ignored XML validation warning  org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document   'http://www.springframework.org/schema/beans/spring-beans.xsd', because   1) could not find the document;   2) the document could not be read; 3) the root element of the document is not <xsd:schema>.  at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)  ...  at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:287)          at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)    

I also have tried to download the spring-beans.xsd file definition and included it in the resources folder in my project without success.

I'm load the spring xml configuration files as showed bellow:

  public static void main(String[] args) throws Exception {      AbstractApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");      getAllActiveUsersInPeople(context);  }    

My appicationContext.xml is defined as bellow:

  <?xml version="1.0" encoding="UTF-8"?>  <beans xmlns="http://www.springframework.org/schema/beans"         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"         xmlns:context="http://www.springframework.org/schema/context"         xmlns:ldap="http://www.springframework.org/schema/ldap"         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/ldap http://www.springframework.org/schema/ldap/spring-ldap.xsd">    

Someone has the similar problem or a possible solution to fix this issue?

Thanks

No comments:

Post a Comment