gudii9
asked on
spring maven example issues
Hi,
I am trying below example
http://www.mkyong.com/spring3/spring-3-hello-world-example/
when i do mvn clean install from comand prompt getting below error
spring-context-4.3.3.RELEA SE.jar; invalid END header (bad central directory offset)
when i do internally from STS(like eclipse) editor maven clean is happening fine. While doing maven install getting below errors
COMPILATION ERROR :
[INFO] -------------------------- ---------- ---------- ---------- -----
error reading C:\Users\xyz\.m2\repositor y\org\spri ngframewor k\spring-c ore\4.3.3. RELEASE\sp ring-core- 4.3.3.RELE ASE.jar; invalid LOC header (bad signature)
error reading C:\Users\xyz\.m2\repositor y\org\spri ngframewor k\spring-c ontext\4.3 .3.RELEASE \spring-co ntext-4.3. 3.RELEASE. jar; invalid END header (bad central directory offset)
error reading C:\Users\xyz\.m2\repositor y\org\spri ngframewor k\spring-c ontext\4.3 .3.RELEASE \spring-co ntext-4.3. 3.RELEASE. jar; invalid END header (bad central directory offset)
/C:/gpFolder/stsWorkspace/ SpringDemo 1_03122017 /src/main/ java/com/m kyong/core /App.java: [3,35] package org.springframework.contex t does not exist
/C:/gpFolder/stsWorkspace/ SpringDemo 1_03122017 /src/main/ java/com/m kyong/core /App.java: [4,43] package org.springframework.contex t.support does not exist
how to resolve
my code is
pom.xml is
App.java is
I am trying below example
http://www.mkyong.com/spring3/spring-3-hello-world-example/
when i do mvn clean install from comand prompt getting below error
spring-context-4.3.3.RELEA
when i do internally from STS(like eclipse) editor maven clean is happening fine. While doing maven install getting below errors
COMPILATION ERROR :
[INFO] --------------------------
error reading C:\Users\xyz\.m2\repositor
error reading C:\Users\xyz\.m2\repositor
error reading C:\Users\xyz\.m2\repositor
/C:/gpFolder/stsWorkspace/
/C:/gpFolder/stsWorkspace/
how to resolve
my code is
pom.xml is
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>SpringDemo1_03122017</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- Generic properties -->
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
</dependencies>
</project>
App.java is
package com.mkyong.core;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class App {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
"SpringBeans.xml");
HelloWorld obj = (HelloWorld) context.getBean("helloBean");
obj.printHello();
}
}
HelloWorld class ispackage com.mkyong.core;
/**
* Spring bean
*
*/
public class HelloWorld {
private String name;
public void setName(String name) {
this.name = name;
}
public void printHello() {
System.out.println("Spring 3 : Hello ! " + name);
}
}
please advise
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
This still looks like a corrupt jar file somewhere
ASKER
invalid LOC header (bad signature)