You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "rahul.soa" <ra...@googlemail.com> on 2009/05/14 21:47:14 UTC

Re: [Solved] Error: Syntax error, annotations are only available if source level is 5.0

Hell everyone,

This problem is solved. Please dont spend time on it.

The problem was with ant as the ant script by default looks for
/etc/ant.conf file
and the conf file point to an old version of ant which does not know how to
detect java 5 or 6.
So I removed the ant.conf from /etc and point to the ANT_HOME which is set
to the newer version of ant.

Thanks to Jarek for solving this with me.

Regards,
Rahul


Thanks to Jarek for solving this with me.

On Thu, May 14, 2009 at 9:44 AM, rahul.soa <ra...@googlemail.com> wrote:

> Hello everyone,
>
> I am trying to run some samples given under the apache CXF distribution
> (apache-cxf-2.1.5). I have deployed /apache-cxf-2.1.5/samples/*
> java_first_pojo* in tomcat and it works well.
>
> However, when I try to create a war file (by running "ant war") for the
> sample /apache-cxf-2.1.5/samples/*java_first_spring_support*
> I get the following error
>
> "Syntax error, annotations are only available if source level is 5.0"
>
> I am using sun java 1.6 version and its set on path.
>
> Can anyone help me in this?
>
> //quote
>
> [rahul@localhost java_first_spring_support]$ ant war
> Buildfile: build.xml
> maybe.generate.code:
> compile:
>     [javac] Compiling 2 source files to
> /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/build/classes
>     [javac] ----------
>     [javac] 1. ERROR in
> /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/src/demo/spring/HelloWorld.java
> (at line 24)
>     [javac]     @WebService
>     [javac]     ^^^^^^^^^^^
>     [javac] Syntax error, annotations are only available if source level is
> 5.0
>     [javac] ----------
>     [javac] ----------
>     [javac] 2. ERROR in
> /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/src/demo/spring/HelloWorldImpl.java
> (at line 24)
>     [javac]     @WebService(endpointInterface = "demo.spring.HelloWorld")
>     [javac]     ^^^^^^^^^^^
>     [javac] Syntax error, annotations are only available if source level is
> 5.0
>     [javac] ----------
>     [javac] 2 problems (2 errors)
> BUILD FAILED
> /home/rahul/apache-cxf-2.1.5/samples/common_build.xml:113: Compile failed;
> see the compiler error output for details.
> Total time: 2 seconds
>
> //unquote
>
> Many Thanks,
> Rahul
>
>

Re: [Solved] Error: Syntax error, annotations are only available if source level is 5.0

Posted by Daniel Kulp <dk...@apache.org>.
On Thu May 14 2009 3:47:14 pm rahul.soa wrote:
> Hell everyone,
>
> This problem is solved. Please dont spend time on it.
>
> The problem was with ant as the ant script by default looks for
> /etc/ant.conf file
> and the conf file point to an old version of ant which does not know how to
> detect java 5 or 6.
> So I removed the ant.conf from /etc and point to the ANT_HOME which is set
> to the newer version of ant.
>
> Thanks to Jarek for solving this with me.

Cool.   I was just starting to type up some suggestions to add a target 
attribute to javac and such and run ant -version and such to try and debug it.  

Thanks!
Dan


>
> Regards,
> Rahul
>
>
> Thanks to Jarek for solving this with me.
>
> On Thu, May 14, 2009 at 9:44 AM, rahul.soa <ra...@googlemail.com> wrote:
> > Hello everyone,
> >
> > I am trying to run some samples given under the apache CXF distribution
> > (apache-cxf-2.1.5). I have deployed /apache-cxf-2.1.5/samples/*
> > java_first_pojo* in tomcat and it works well.
> >
> > However, when I try to create a war file (by running "ant war") for the
> > sample /apache-cxf-2.1.5/samples/*java_first_spring_support*
> > I get the following error
> >
> > "Syntax error, annotations are only available if source level is 5.0"
> >
> > I am using sun java 1.6 version and its set on path.
> >
> > Can anyone help me in this?
> >
> > //quote
> >
> > [rahul@localhost java_first_spring_support]$ ant war
> > Buildfile: build.xml
> > maybe.generate.code:
> > compile:
> >     [javac] Compiling 2 source files to
> > /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/build/clas
> >ses [javac] ----------
> >     [javac] 1. ERROR in
> > /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/src/demo/s
> >pring/HelloWorld.java (at line 24)
> >     [javac]     @WebService
> >     [javac]     ^^^^^^^^^^^
> >     [javac] Syntax error, annotations are only available if source level
> > is 5.0
> >     [javac] ----------
> >     [javac] ----------
> >     [javac] 2. ERROR in
> > /home/rahul/apache-cxf-2.1.5/samples/java_first_spring_support/src/demo/s
> >pring/HelloWorldImpl.java (at line 24)
> >     [javac]     @WebService(endpointInterface = "demo.spring.HelloWorld")
> >     [javac]     ^^^^^^^^^^^
> >     [javac] Syntax error, annotations are only available if source level
> > is 5.0
> >     [javac] ----------
> >     [javac] 2 problems (2 errors)
> > BUILD FAILED
> > /home/rahul/apache-cxf-2.1.5/samples/common_build.xml:113: Compile
> > failed; see the compiler error output for details.
> > Total time: 2 seconds
> >
> > //unquote
> >
> > Many Thanks,
> > Rahul

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog