You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Harrison <rh...@gmail.com> on 2007/11/29 18:17:37 UTC
Practical Apache Struts2 - compile fails on annotation
Dear All,
I am working through Roughley's book (Struts-2.0.9) and am having trouble
with the first example using annotations. The stack trace I get is:
December 10, 2007
December 10, 2007
org.apache.maven.BuildFailureException: Compilation failure
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
cannot find symbol
symbol: class Result
@Result(name="success",value="/jsp/success.jsp",type=
ServletDispatcherResult.class)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:560)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:459)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation
failure
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
cannot find symbol
symbol: class Result
@Result(name="success",value="/jsp/success.jsp",type=
ServletDispatcherResult.class)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(
AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:539)
... 16 more
Here is the relevant portion of web.xml:
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.fdar.apress.s2,com.apress.s2</param-value>
</init-param>
</filter>
(there is no filter mapping for struts2)
I can't find any setup differences in the Struts Wiki. The only similar
error I found using Google suggested deleting the Struts and openSymphony
jars. I did and Maven re-installed the jars and gave the same error.
Please, what simple/stupid thing am I missing?
--
"In theory there is no difference between theory and practice. In practice
there is."
Yogi Berra
Bob
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Ian Roughley <ia...@fdar.com>.
Weird. I opened the ZCAction.java file, and I can see the imports right
there :-)
--
Ian Roughley
>From Down & Around, Inc.
Consulting * Training / Mentoring * Agile Process * Open Source
web: http://www.fdar.com - email: ian@fdar.com
Robert Harrison wrote:
> Ian/Dave,
> Thanks for the advice. I constructed the project from the command line
> using Maven2 (First time). My OS is Suse10.0. I have imported the project
> into Eclipse but I've just used the IDE for editing and hints and have
> still used the command line for compilation.
>
> The ZCAction.java file compiles if I import org.apache.struts2.config.Resultand
> org.apache.struts2.dispatcher.ServletDispatcherResult (both suggested by
> Eclipse). But both these classes are in the Struts2 core jar which is in the
> Maven repository. File ownership and permissions are set correctly as well.
>
> Bob
>
> On Nov 29, 2007 1:01 PM, Ian Roughley <ia...@fdar.com> wrote:
>
>
>> This is chapter 3, right? I just ran the command "mvn clean compile"
>> from my local copy and everything compiles correctly. Are you compiling
>> from an IDE? If so, do you have all the JAR files in the project?
>>
>> /Ian
>>
>> --
>> Ian Roughley
>> From Down & Around, Inc.
>> Consulting * Training / Mentoring * Agile Process * Open Source
>> web: http://www.fdar.com - email: ian@fdar.com
>>
>>
>>
>> Robert Harrison wrote:
>>
>>> Dear All,
>>> I am working through Roughley's book (Struts-2.0.9) and am having
>>>
>> trouble
>>
>>> with the first example using annotations. The stack trace I get is:
>>> December 10, 2007
>>>
>>> December 10, 2007
>>>
>>> org.apache.maven.BuildFailureException: Compilation failure
>>>
>>>
>>>
>> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
>>
>>> cannot find symbol
>>>
>>> symbol: class Result
>>>
>>> @Result(name="success",value="/jsp/success.jsp",type=
>>> ServletDispatcherResult.class)
>>>
>>> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
>>> DefaultLifecycleExecutor.java:560)
>>>
>>> at
>>>
>>>
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
>>
>>> (DefaultLifecycleExecutor.java:480)
>>>
>>> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
>>> DefaultLifecycleExecutor.java:459)
>>>
>>> at
>>>
>>>
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
>>
>>> (DefaultLifecycleExecutor.java:311)
>>>
>>> at
>>>
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
>>
>>> DefaultLifecycleExecutor.java:278)
>>>
>>> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
>>> DefaultLifecycleExecutor.java:143)
>>>
>>> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>>>
>>> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>>>
>>> at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(
>>>
>> NativeMethodAccessorImpl.java
>>
>>> :39)
>>>
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>
>>> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>
>>> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>
>>> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>
>>> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>>
>>> Caused by: org.apache.maven.plugin.CompilationFailureException:
>>>
>> Compilation
>>
>>> failure
>>>
>>>
>>>
>> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
>>
>>> cannot find symbol
>>>
>>> symbol: class Result
>>>
>>> @Result(name="success",value="/jsp/success.jsp",type=
>>> ServletDispatcherResult.class)
>>>
>>> at org.apache.maven.plugin.AbstractCompilerMojo.execute(
>>> AbstractCompilerMojo.java:516)
>>>
>>> at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
>>>
>>> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
>>> DefaultPluginManager.java:443)
>>>
>>> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
>>> DefaultLifecycleExecutor.java:539)
>>>
>>> ... 16 more
>>>
>>>
>>> Here is the relevant portion of web.xml:
>>>
>>> <filter-name>struts2</filter-name>
>>> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
>>> </filter-class>
>>> <init-param>
>>> <param-name>actionPackages</param-name>
>>> <param-value>com.fdar.apress.s2,com.apress.s2</param-value>
>>> </init-param>
>>> </filter>
>>>
>>> (there is no filter mapping for struts2)
>>>
>>>
>>> I can't find any setup differences in the Struts Wiki. The only similar
>>> error I found using Google suggested deleting the Struts and
>>>
>> openSymphony
>>
>>> jars. I did and Maven re-installed the jars and gave the same error.
>>>
>>>
>>> Please, what simple/stupid thing am I missing?
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Robert Harrison <rh...@gmail.com>.
Okay. Problem solved. My confusion was that, in the book, the imports are
not shown. Eclipse suggested the correct imports and, when included in the
file, the file compiles. My error was in assuming that the filter in
web.xmlwas all that was needed.
Thanks.
Bob
On Nov 29, 2007 1:55 PM, Dave Newton <ne...@yahoo.com> wrote:
> If you "Organize Imports"ed it may have removed the
> imports it couldn't find.
>
> I'd try using one of the Maven plugins and allowing
> Maven dependency management and either turning off
> automatic project building or set up appropriate
> output directories for all the relevant source
> directories.
>
> d.
>
> --- Robert Harrison <rh...@gmail.com> wrote:
>
> > Ian/Dave,
> > Thanks for the advice. I constructed the project
> > from the command line
> > using Maven2 (First time). My OS is Suse10.0. I
> > have imported the project
> > into Eclipse but I've just used the IDE for editing
> > and hints and have
> > still used the command line for compilation.
> >
> > The ZCAction.java file compiles if I import
> > org.apache.struts2.config.Resultand
> >
> org.apache.struts2.dispatcher.ServletDispatcherResult
> > (both suggested by
> > Eclipse). But both these classes are in the Struts2
> > core jar which is in the
> > Maven repository. File ownership and permissions are
> > set correctly as well.
> >
> > Bob
> >
> > On Nov 29, 2007 1:01 PM, Ian Roughley <ia...@fdar.com>
> > wrote:
> >
> > > This is chapter 3, right? I just ran the command
> > "mvn clean compile"
> > > from my local copy and everything compiles
> > correctly. Are you compiling
> > > from an IDE? If so, do you have all the JAR
> > files in the project?
> > >
> > > /Ian
> > >
> > > --
> > > Ian Roughley
> > > From Down & Around, Inc.
> > > Consulting * Training / Mentoring * Agile Process
> > * Open Source
> > > web: http://www.fdar.com - email: ian@fdar.com
> > >
> > >
> > >
> > > Robert Harrison wrote:
> > > > Dear All,
> > > > I am working through Roughley's book
> > (Struts-2.0.9) and am having
> > > trouble
> > > > with the first example using annotations. The
> > stack trace I get is:
> > > > December 10, 2007
> > > >
> > > > December 10, 2007
> > > >
> > > > org.apache.maven.BuildFailureException:
> > Compilation failure
> > > >
> > > >
> > >
> >
>
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > > > cannot find symbol
> > > >
> > > > symbol: class Result
> > > >
> > > >
> >
> @Result(name="success",value="/jsp/success.jsp",type=
> > > > ServletDispatcherResult.class)
> > > >
> > > > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > > > DefaultLifecycleExecutor.java:560)
> > > >
> > > > at
> > > >
> > >
> >
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> > > > (DefaultLifecycleExecutor.java:480)
> > > >
> > > > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> > > > DefaultLifecycleExecutor.java:459)
> > > >
> > > > at
> > > >
> > >
> >
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> > > > (DefaultLifecycleExecutor.java:311)
> > > >
> > > > at
> > >
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> > > > DefaultLifecycleExecutor.java:278)
> > > >
> > > > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> > > > DefaultLifecycleExecutor.java:143)
> > > >
> > > > at
> >
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
> > > >
> > > > at
> >
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
> > > >
> > > > at
> >
> org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
> > > >
> > > > at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > > >
> > > > at sun.reflect.NativeMethodAccessorImpl.invoke(
> > > NativeMethodAccessorImpl.java
> > > > :39)
> > > >
> > > > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > > DelegatingMethodAccessorImpl.java:25)
> > > >
> > > > at
> > java.lang.reflect.Method.invoke(Method.java:585)
> > > >
> > > > at
> >
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> > > >
> > > > at
> >
> org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> > > >
> > > > at
> >
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> > > >
> > > > at
> >
> org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> > > >
> > > > Caused by:
> > org.apache.maven.plugin.CompilationFailureException:
> > > Compilation
> > > > failure
> > > >
> > > >
> > >
> >
>
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > > > cannot find symbol
> > > >
> > > > symbol: class Result
> > > >
> > > >
> >
> @Result(name="success",value="/jsp/success.jsp",type=
> > > > ServletDispatcherResult.class)
> > > >
> > > > at
> >
> org.apache.maven.plugin.AbstractCompilerMojo.execute(
> > > > AbstractCompilerMojo.java:516)
> > > >
> > > > at
> >
> org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
> > > >
> > > > at
> >
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> > > > DefaultPluginManager.java:443)
> > > >
> > > > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > > > DefaultLifecycleExecutor.java:539)
> > > >
> > > > ... 16 more
> > > >
> > > >
> > > > Here is the relevant portion of web.xml:
> > > >
> > > > <filter-name>struts2</filter-name>
> > > >
> >
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> > > > </filter-class>
> > > > <init-param>
> > > > <param-name>actionPackages</param-name>
> > > >
> >
> <param-value>com.fdar.apress.s2,com.apress.s2</param-value>
> > > > </init-param>
> > > > </filter>
> > > >
> > > > (there is no filter mapping for struts2)
> > > >
> > > >
> > > > I can't find any setup differences in the Struts
> > Wiki. The only similar
> > > > error I found using Google suggested deleting
> > the Struts and
> > > openSymphony
> > > > jars. I did and Maven re-installed the jars and
> > gave the same error.
> > > >
> > > >
> > > > Please, what simple/stupid thing am I missing?
> > > >
> > > >
> > > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> === message truncated ===
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Dave Newton <ne...@yahoo.com>.
If you "Organize Imports"ed it may have removed the
imports it couldn't find.
I'd try using one of the Maven plugins and allowing
Maven dependency management and either turning off
automatic project building or set up appropriate
output directories for all the relevant source
directories.
d.
--- Robert Harrison <rh...@gmail.com> wrote:
> Ian/Dave,
> Thanks for the advice. I constructed the project
> from the command line
> using Maven2 (First time). My OS is Suse10.0. I
> have imported the project
> into Eclipse but I've just used the IDE for editing
> and hints and have
> still used the command line for compilation.
>
> The ZCAction.java file compiles if I import
> org.apache.struts2.config.Resultand
>
org.apache.struts2.dispatcher.ServletDispatcherResult
> (both suggested by
> Eclipse). But both these classes are in the Struts2
> core jar which is in the
> Maven repository. File ownership and permissions are
> set correctly as well.
>
> Bob
>
> On Nov 29, 2007 1:01 PM, Ian Roughley <ia...@fdar.com>
> wrote:
>
> > This is chapter 3, right? I just ran the command
> "mvn clean compile"
> > from my local copy and everything compiles
> correctly. Are you compiling
> > from an IDE? If so, do you have all the JAR
> files in the project?
> >
> > /Ian
> >
> > --
> > Ian Roughley
> > From Down & Around, Inc.
> > Consulting * Training / Mentoring * Agile Process
> * Open Source
> > web: http://www.fdar.com - email: ian@fdar.com
> >
> >
> >
> > Robert Harrison wrote:
> > > Dear All,
> > > I am working through Roughley's book
> (Struts-2.0.9) and am having
> > trouble
> > > with the first example using annotations. The
> stack trace I get is:
> > > December 10, 2007
> > >
> > > December 10, 2007
> > >
> > > org.apache.maven.BuildFailureException:
> Compilation failure
> > >
> > >
> >
>
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > > cannot find symbol
> > >
> > > symbol: class Result
> > >
> > >
>
@Result(name="success",value="/jsp/success.jsp",type=
> > > ServletDispatcherResult.class)
> > >
> > > at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > > DefaultLifecycleExecutor.java:560)
> > >
> > > at
> > >
> >
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> > > (DefaultLifecycleExecutor.java:480)
> > >
> > > at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> > > DefaultLifecycleExecutor.java:459)
> > >
> > > at
> > >
> >
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> > > (DefaultLifecycleExecutor.java:311)
> > >
> > > at
> >
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> > > DefaultLifecycleExecutor.java:278)
> > >
> > > at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> > > DefaultLifecycleExecutor.java:143)
> > >
> > > at
>
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
> > >
> > > at
>
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
> > >
> > > at
>
org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
> > >
> > > at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > >
> > > at sun.reflect.NativeMethodAccessorImpl.invoke(
> > NativeMethodAccessorImpl.java
> > > :39)
> > >
> > > at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > > DelegatingMethodAccessorImpl.java:25)
> > >
> > > at
> java.lang.reflect.Method.invoke(Method.java:585)
> > >
> > > at
>
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> > >
> > > at
>
org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> > >
> > > at
>
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> > >
> > > at
>
org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> > >
> > > Caused by:
> org.apache.maven.plugin.CompilationFailureException:
> > Compilation
> > > failure
> > >
> > >
> >
>
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > > cannot find symbol
> > >
> > > symbol: class Result
> > >
> > >
>
@Result(name="success",value="/jsp/success.jsp",type=
> > > ServletDispatcherResult.class)
> > >
> > > at
>
org.apache.maven.plugin.AbstractCompilerMojo.execute(
> > > AbstractCompilerMojo.java:516)
> > >
> > > at
>
org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
> > >
> > > at
>
org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> > > DefaultPluginManager.java:443)
> > >
> > > at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > > DefaultLifecycleExecutor.java:539)
> > >
> > > ... 16 more
> > >
> > >
> > > Here is the relevant portion of web.xml:
> > >
> > > <filter-name>struts2</filter-name>
> > >
>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> > > </filter-class>
> > > <init-param>
> > > <param-name>actionPackages</param-name>
> > >
>
<param-value>com.fdar.apress.s2,com.apress.s2</param-value>
> > > </init-param>
> > > </filter>
> > >
> > > (there is no filter mapping for struts2)
> > >
> > >
> > > I can't find any setup differences in the Struts
> Wiki. The only similar
> > > error I found using Google suggested deleting
> the Struts and
> > openSymphony
> > > jars. I did and Maven re-installed the jars and
> gave the same error.
> > >
> > >
> > > Please, what simple/stupid thing am I missing?
> > >
> > >
> > >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
>
=== message truncated ===
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Robert Harrison <rh...@gmail.com>.
Ian/Dave,
Thanks for the advice. I constructed the project from the command line
using Maven2 (First time). My OS is Suse10.0. I have imported the project
into Eclipse but I've just used the IDE for editing and hints and have
still used the command line for compilation.
The ZCAction.java file compiles if I import org.apache.struts2.config.Resultand
org.apache.struts2.dispatcher.ServletDispatcherResult (both suggested by
Eclipse). But both these classes are in the Struts2 core jar which is in the
Maven repository. File ownership and permissions are set correctly as well.
Bob
On Nov 29, 2007 1:01 PM, Ian Roughley <ia...@fdar.com> wrote:
> This is chapter 3, right? I just ran the command "mvn clean compile"
> from my local copy and everything compiles correctly. Are you compiling
> from an IDE? If so, do you have all the JAR files in the project?
>
> /Ian
>
> --
> Ian Roughley
> From Down & Around, Inc.
> Consulting * Training / Mentoring * Agile Process * Open Source
> web: http://www.fdar.com - email: ian@fdar.com
>
>
>
> Robert Harrison wrote:
> > Dear All,
> > I am working through Roughley's book (Struts-2.0.9) and am having
> trouble
> > with the first example using annotations. The stack trace I get is:
> > December 10, 2007
> >
> > December 10, 2007
> >
> > org.apache.maven.BuildFailureException: Compilation failure
> >
> >
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > cannot find symbol
> >
> > symbol: class Result
> >
> > @Result(name="success",value="/jsp/success.jsp",type=
> > ServletDispatcherResult.class)
> >
> > at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > DefaultLifecycleExecutor.java:560)
> >
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> > (DefaultLifecycleExecutor.java:480)
> >
> > at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> > DefaultLifecycleExecutor.java:459)
> >
> > at
> >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> > (DefaultLifecycleExecutor.java:311)
> >
> > at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> > DefaultLifecycleExecutor.java:278)
> >
> > at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> > DefaultLifecycleExecutor.java:143)
> >
> > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
> >
> > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
> >
> > at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java
> > :39)
> >
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >
> > at java.lang.reflect.Method.invoke(Method.java:585)
> >
> > at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> >
> > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> >
> > at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> >
> > at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> >
> > Caused by: org.apache.maven.plugin.CompilationFailureException:
> Compilation
> > failure
> >
> >
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> > cannot find symbol
> >
> > symbol: class Result
> >
> > @Result(name="success",value="/jsp/success.jsp",type=
> > ServletDispatcherResult.class)
> >
> > at org.apache.maven.plugin.AbstractCompilerMojo.execute(
> > AbstractCompilerMojo.java:516)
> >
> > at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
> >
> > at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> > DefaultPluginManager.java:443)
> >
> > at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> > DefaultLifecycleExecutor.java:539)
> >
> > ... 16 more
> >
> >
> > Here is the relevant portion of web.xml:
> >
> > <filter-name>struts2</filter-name>
> > <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> > </filter-class>
> > <init-param>
> > <param-name>actionPackages</param-name>
> > <param-value>com.fdar.apress.s2,com.apress.s2</param-value>
> > </init-param>
> > </filter>
> >
> > (there is no filter mapping for struts2)
> >
> >
> > I can't find any setup differences in the Struts Wiki. The only similar
> > error I found using Google suggested deleting the Struts and
> openSymphony
> > jars. I did and Maven re-installed the jars and gave the same error.
> >
> >
> > Please, what simple/stupid thing am I missing?
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Ian Roughley <ia...@fdar.com>.
This is chapter 3, right? I just ran the command "mvn clean compile"
from my local copy and everything compiles correctly. Are you compiling
from an IDE? If so, do you have all the JAR files in the project?
/Ian
--
Ian Roughley
>From Down & Around, Inc.
Consulting * Training / Mentoring * Agile Process * Open Source
web: http://www.fdar.com - email: ian@fdar.com
Robert Harrison wrote:
> Dear All,
> I am working through Roughley's book (Struts-2.0.9) and am having trouble
> with the first example using annotations. The stack trace I get is:
> December 10, 2007
>
> December 10, 2007
>
> org.apache.maven.BuildFailureException: Compilation failure
>
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> cannot find symbol
>
> symbol: class Result
>
> @Result(name="success",value="/jsp/success.jsp",type=
> ServletDispatcherResult.class)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:560)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> (DefaultLifecycleExecutor.java:480)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> DefaultLifecycleExecutor.java:459)
>
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.java:311)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:278)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:143)
>
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation
> failure
>
> /home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> cannot find symbol
>
> symbol: class Result
>
> @Result(name="success",value="/jsp/success.jsp",type=
> ServletDispatcherResult.class)
>
> at org.apache.maven.plugin.AbstractCompilerMojo.execute(
> AbstractCompilerMojo.java:516)
>
> at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
>
> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:443)
>
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:539)
>
> ... 16 more
>
>
> Here is the relevant portion of web.xml:
>
> <filter-name>struts2</filter-name>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> </filter-class>
> <init-param>
> <param-name>actionPackages</param-name>
> <param-value>com.fdar.apress.s2,com.apress.s2</param-value>
> </init-param>
> </filter>
>
> (there is no filter mapping for struts2)
>
>
> I can't find any setup differences in the Struts Wiki. The only similar
> error I found using Google suggested deleting the Struts and openSymphony
> jars. I did and Maven re-installed the jars and gave the same error.
>
>
> Please, what simple/stupid thing am I missing?
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Practical Apache Struts2 - compile fails on annotation
Posted by Dave Newton <ne...@yahoo.com>.
\*Compilation\* failure?
Did you import the annotation it's giving you the
error for?
web.xml won't affect compilation, but I don't
understand why you don't have a mapping for the S2
dispatcher (does it default to "/*" or something? I'd
map it explicitly anyway, if that's the case.)
d.
--- Robert Harrison <rh...@gmail.com> wrote:
> Dear All,
> I am working through Roughley's book (Struts-2.0.9)
> and am having trouble
> with the first example using annotations. The stack
> trace I get is:
> December 10, 2007
>
> December 10, 2007
>
> org.apache.maven.BuildFailureException: Compilation
> failure
>
>
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> cannot find symbol
>
> symbol: class Result
>
>
@Result(name="success",value="/jsp/success.jsp",type=
> ServletDispatcherResult.class)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:560)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
> (DefaultLifecycleExecutor.java:480)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
> DefaultLifecycleExecutor.java:459)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.java:311)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
> DefaultLifecycleExecutor.java:278)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
> DefaultLifecycleExecutor.java:143)
>
> at
>
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>
> at
>
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>
> at
>
org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
>
> at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at
>
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>
> at
>
org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>
> at
>
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>
> at
>
org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> Caused by:
> org.apache.maven.plugin.CompilationFailureException:
> Compilation
> failure
>
>
/home/rharri/workspace/app/src/main/java/com/fdar/apress/s2/ZCAction.java:[5,1]
> cannot find symbol
>
> symbol: class Result
>
>
@Result(name="success",value="/jsp/success.jsp",type=
> ServletDispatcherResult.class)
>
> at
>
org.apache.maven.plugin.AbstractCompilerMojo.execute(
> AbstractCompilerMojo.java:516)
>
> at
>
org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
>
> at
>
org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:443)
>
> at
>
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:539)
>
> ... 16 more
>
>
> Here is the relevant portion of web.xml:
>
> <filter-name>struts2</filter-name>
>
>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
> </filter-class>
> <init-param>
> <param-name>actionPackages</param-name>
>
>
<param-value>com.fdar.apress.s2,com.apress.s2</param-value>
> </init-param>
> </filter>
>
> (there is no filter mapping for struts2)
>
>
> I can't find any setup differences in the Struts
> Wiki. The only similar
> error I found using Google suggested deleting the
> Struts and openSymphony
> jars. I did and Maven re-installed the jars and gave
> the same error.
>
>
> Please, what simple/stupid thing am I missing?
>
>
> --
> "In theory there is no difference between theory and
> practice. In practice
> there is."
> Yogi Berra
>
> Bob
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org