Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am using jdk 6.  and the pom.xml is
like
...
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>3.5.1</version>
               <configuration>
                <forceJavacCompilerUse>true</forceJavacCompilerUse>
                <compilerVersion>1.6</compilerVersion>
                   <source>1.6</source>
                   <target>1.6</target>
                   <compilerArgument>-Xlint:all</compilerArgument>  
                   <compilerArgument>-Xlint:-serial</compilerArgument>
                   <showWarnings>true</showWarnings>
                   <showDeprecation>true</showDeprecation>
               </configuration>
           </plugin>
...

However, I still the below compilation errors.  Please help how to fix it.

   annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>


Thanks
Benson
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have the spring annotations jar file?
 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,

Yes, I do.  Actually, If I use the eclipse itself built-in compiler to compile, there is no error.  However, if I choose Maven build in the eclipse, the maven build will clean up the classes in the target and then re-compile , it will throw such compilation errors.

Please help

Thanks
Benson
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the bit of the POM you show doesn't show the jar includes, so I thought I'd better ask.
 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,

I attached the pom.xml as below.  Please check and comment.

<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/maven-v4_0_0.xsd">
 
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.aia</groupId>
 <artifactId>iengage</artifactId>
 <packaging>war</packaging>
 <version>0.0.1-SNAPSHOT</version>
 <name>AIA iEngage API Server</name>
 <url>http://maven.apache.org</url>;
 <profiles>
<profile>
<id>dev</id>
<build>
<resources>
<resource>
<directory>src/main/resources/dev</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</profile>
</profiles>
 <properties>
<!-- -->
<java.version>1.6</java.version>
<spring.version>4.2.1.RELEASE</spring.version>
<slf4j.version>1.7.12</slf4j.version>
<org.log4j-version>1.2.17</org.log4j-version>
<javax.servlet-version>3.1</javax.servlet-version>
<org.springsecurity-version>4.0.2.RELEASE</org.springsecurity-version>
<org.hibernate-version>5.0.1.Final</org.hibernate-version>
<com.fasterxml-jackson-core-version>2.6.2</com.fasterxml-jackson-core-version>
<com.microsoft.sqlserver-version>4.0</com.microsoft.sqlserver-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<basedir>C:\\Projects</basedir>
 </properties>
 <dependencies>
 
   <dependency>
     <groupId>com.microsoft.sqlserver</groupId>
     <artifactId>sqljdbc4</artifactId>
     <version>${com.microsoft.sqlserver-version}</version>
     <scope>compile</scope>
   </dependency>
 
<!--  Junit 4.12 -->      
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.12</version>
     <scope>test</scope>
   </dependency>
 
  <!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<type>jar</type>

<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>${org.springsecurity-version}</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${org.log4j-version}</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>


<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${org.hibernate-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${org.hibernate-version}</version>
</dependency>

<!--  Jackson for JSON parsing -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${com.fasterxml-jackson-core-version}</version>
</dependency>

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20160212</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate4</artifactId>
<version>${com.fasterxml-jackson-core-version}</version>
</dependency>

<!-- JDBC -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>

<!-- PostgreSQL
<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <version>9.4-1203-jdbc41</version>
</dependency>
-->

<!-- JWT -->
<dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt</artifactId>
    <version>0.6.0</version>
</dependency>

<!-- Later add:begin -->
<!-- Apache Commons FileUpload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>

<!-- Apache Commons IO -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Later add:end -->


 </dependencies>
   <build>
       <plugins>
           <plugin>
               <artifactId>maven-eclipse-plugin</artifactId>
               <version>2.9</version>
               <configuration>
                   <additionalProjectnatures>
                       <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                   </additionalProjectnatures>
                   <additionalBuildcommands>
                       <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                   </additionalBuildcommands>
                   <downloadSources>true</downloadSources>
                   <downloadJavadocs>true</downloadJavadocs>
               </configuration>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>3.5.1</version>
               <configuration>
                <forceJavacCompilerUse>true</forceJavacCompilerUse>
                   <source>${java.version}</source>
                   <target>${java.version}</target>
                   <compilerArgument>-Xlint:all</compilerArgument>  
                   <compilerArgument>-Xlint:-serial</compilerArgument>
                   <showWarnings>true</showWarnings>
                   <showDeprecation>true</showDeprecation>
               </configuration>
           </plugin>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>exec-maven-plugin</artifactId>
               <version>1.2.1</version>
               <configuration>
                   <mainClass>org.test.int1.Main</mainClass>
               </configuration>
           </plugin>
       </plugins>
   </build>
   
</project>


Thanks
Benson
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Isn't that class part of Spring-Web?
I don't see that in there.
 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave,

I just added as you taught.  But still got errors as below.

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project iengage: Compilation failure: Compilation failure:
[ERROR] /C:/Projects/AIAIENGAGE/iengage-backend/src/main/java/com/aia/iengage/controller/CmsFileController.java:[37,1] C:\Projects\AIAIENGAGE\iengage-backend\src\main\java\com\aia\iengage\controller\CmsFileController.java:37: annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>
[ERROR] /C:/Projects/AIAIENGAGE/iengage-backend/src/main/java/com/aia/iengage/controller/CmsContestController.java:[34,1] C:\Projects\AIAIENGAGE\iengage-backend\src\main\java\com\aia\iengage\controller\CmsContestController.java:34: annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>
[ERROR] /C:/Projects/AIAIENGAGE/iengage-backend/src/main/java/com/aia/iengage/controller/MobileApiController.java:[27,1] C:\Projects\AIAIENGAGE\iengage-backend\src\main\java\com\aia\iengage\controller\MobileApiController.java:27: annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>
[ERROR] /C:/Projects/AIAIENGAGE/iengage-backend/src/main/java/com/aia/iengage/controller/CmsApiController.java:[38,1] C:\Projects\AIAIENGAGE\iengage-backend\src\main\java\com\aia\iengage\controller\CmsApiController.java:38: annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>
[ERROR] /C:/Projects/AIAIENGAGE/iengage-backend/src/main/java/com/aia/iengage/controller/CmsNewsController.java:[54,1] C:\Projects\AIAIENGAGE\iengage-backend\src\main\java\com\aia\iengage\controller\CmsNewsController.java:54: annotation org.springframework.web.bind.annotation.CrossOrigin is missing <clinit>


 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
However, if I choose Maven Update in eclipse which clean projects and build automatically, it works without any problem.   I really don't know what happen.  I guess it is because of Java 6.
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic