You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "M. Rakowski" <ma...@rakowski.biz> on 2011/09/28 17:49:01 UTC

Re: Struts 2 Annotation Tutorial (additional info)

I wrote:

 > make sure your Hallo-Action is in class HalloController in package
 > foo.actions.bar (foo and bar are random names)

which is not quite correct:
the prefix of the actions-package can be random.
The sub-packages names defines the url namespace.
For example, you can access the foo.actions.HalloController
with /context-path/hallo and the foo.actions.bar.BazController action
with /context-path/bar/baz

Regards, Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Re: Struts 2 Annotation Tutorial (additional info)

Posted by Steve <it...@hotmail.com>.
Hello,

I started up JBoss again and did a find across the log for "at " (that's at with a space at the end) but did not see any stack trace.  I have log level debug turned on and I double checked that nothing rolled off my log file (it starts with "22:43:43,828 INFO  [ServerImpl] Starting JBoss (Microcontainer)...").

Looking at the links you sent me, it could be the second one: WW-3662, where they are getting no stack trace.  I have JBoss 6 and am running Struts-2.2.3 and that issue is with JBoss 7 and Struts_2_2_1_1 but it could be.  It looks like Jason Pyeron is still working on it though.

Steve

-----Original Message-----
From: Lwen.ma [mailto:mlw5415@gmail.com] 
Sent: Saturday, October 01, 2011 6:14 PM
To: Struts Users Mailing List
Subject: Re: Re: Struts 2 Annotation Tutorial (additional info)

With jboss 6 and 7 use 'Convention plugin', See 'https://issues.apache.org/jira/browse/WW-3558'  and 'https://issues.apache.org/jira/browse/WW-3662' plz.


2011-10-02 



Lwen.ma 



???: Lukasz_Lenart
????: 2011-10-01  22:44:26
???: Struts Users Mailing List
??: 
??: Re: Struts 2 Annotation Tutorial (additional info) 
 
2011/10/1 Steve <it...@hotmail.com>:
> Hello Lukasz,
>
> I'm using JBoss 5.1 via Eclipse and JBoss Tools.  When I switched to Tomcat 6 and changed my logger's package it started to work.  Makes you wonder what's up with JBoss?
Do you see any errors in the log ? Could double check ?
Struts 2 has some problems to run properly on JBoss 6/7, so maybe it's the same case.
Thanks in advance
--
Lukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Re: Struts 2 Annotation Tutorial (additional info)

Posted by "Lwen.ma" <ml...@gmail.com>.
With jboss 6 and 7 use 'Convention plugin', See 'https://issues.apache.org/jira/browse/WW-3558'  and 'https://issues.apache.org/jira/browse/WW-3662' plz.


2011-10-02 



Lwen.ma 



发件人: Łukasz_Lenart 
发送时间: 2011-10-01  22:44:26 
收件人: Struts Users Mailing List 
抄送: 
主题: Re: Struts 2 Annotation Tutorial (additional info) 
 
2011/10/1 Steve <it...@hotmail.com>:
> Hello Lukasz,
>
> I'm using JBoss 5.1 via Eclipse and JBoss Tools.  When I switched to Tomcat 6 and changed my logger's package it started to work.  Makes you wonder what's up with JBoss?
Do you see any errors in the log ? Could double check ?
Struts 2 has some problems to run properly on JBoss 6/7, so maybe it's
the same case.
Thanks in advance
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Re: Struts 2 Annotation Tutorial (additional info)

Posted by Łukasz Lenart <lu...@googlemail.com>.
2011/10/1 Steve <it...@hotmail.com>:
> Hello Lukasz,
>
> I'm using JBoss 5.1 via Eclipse and JBoss Tools.  When I switched to Tomcat 6 and changed my logger's package it started to work.  Makes you wonder what's up with JBoss?

Do you see any errors in the log ? Could double check ?
Struts 2 has some problems to run properly on JBoss 6/7, so maybe it's
the same case.


Thanks in advance
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts 2 Annotation Tutorial (additional info)

Posted by Steve <it...@hotmail.com>.
Hello Lukasz,

I'm using JBoss 5.1 via Eclipse and JBoss Tools.  When I switched to Tomcat 6 and changed my logger's package it started to work.  Makes you wonder what's up with JBoss?

Thank you for your assistance.
Steve

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@googlemail.com] 
Sent: Friday, September 30, 2011 12:42 AM
To: Struts Users Mailing List
Subject: Re: Struts 2 Annotation Tutorial (additional info)

2011/9/30 Steve <it...@hotmail.com>:
> Remember, my app server is JBoss.

Which version ? Could you try on Tomcat ?


Regards
-- 
Lukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Annotation Tutorial (additional info)

Posted by Łukasz Lenart <lu...@googlemail.com>.
2011/9/30 Steve <it...@hotmail.com>:
> Remember, my app server is JBoss.

Which version ? Could you try on Tomcat ?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts 2 Annotation Tutorial (additional info)

Posted by Steve <it...@hotmail.com>.
Hello,

Yes, I'm basing it off of the Struts_Annotations_Ant_2_2_1.zip.  I removed the struts.xml like you instructed but still no luck.

I added the "struts.devMode" param to my web.xml file.  So my web.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 <display-name>Struts2_Annotations_Ant</display-name>
 <filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  <init-param>
   <param-name>struts.devMode</param-name>
   <param-value>true</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
</web-app>



I decided that I'd switch from the jar files located inside the " Struts_Annotations_Ant_2_2_1.zip" to the ones from "struts-2.2.3-all " so I can attach the source code.  So the jars in my WEB-INF\lib folder are now:
asm-3.1.jar
asm-commons-3.1.jar
asm-tree-3.1.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-logging-api-1.1.jar
freemarker-2.3.16.jar
javassist-3.11.0.GA.jar
log4j-1.2.16.jar
ognl-3.0.1.jar
struts2-config-browser-plugin-2.2.3.jar
struts2-convention-plugin-2.2.3.jar
struts2-core-2.2.3.jar
xwork-core-2.2.3.jar


Of course that'd didn't make a difference.  I still get:
There is no Action mapped for namespace / and action name hello. - [unknown location]
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)



However now I know that in the DefaultActionProxy.prepare method, the statement:
config = configuration.getRuntimeConfiguration().getActionConfig(namespace, actionName);

results in a null for config.  Namespace is: "/" and actionName is: "hello"

If it helps you any, the Struts Configuration Browser shows nothing under the "default" namespace.  Under "constants" I have the following settings:
logMissingProperties 	false
struts.multipart.saveDir 	
struts.convention.actionNameBuilder 	convention
struts.convention.result.path 	/WEB-INF/content/
struts.objectFactory.spring.useClassCache 	true
struts.url.includeParams 	none
struts.velocity.configfile 	velocity.properties
struts.convention.classes.reload 	false
struts.convention.action.mapAllMatches 	false
struts.convention.relative.result.types 	dispatcher,velocity,freemarker
struts.dispatcher.parametersWorkaround 	false
struts.serve.static 	true
enableOGNLExpressionCache 	true
struts.convention.action.name.lowercase 	true
struts.convention.package.locators.disable 	false
struts.ognl.enableExpressionCache 	true
struts.ui.templateSuffix 	ftl
struts.convention.package.locators 	action,actions,struts,struts2
struts.multipart.parser 	jakarta
struts.velocity.toolboxlocation 	
struts.i18n.reload 	true
struts.freemarker.beanwrapperCache 	false
struts.objectFactory.spring.autoWire 	name
struts.ui.templateDir 	template
struts.url.http.port 	80
struts.ognl.allowStaticMethodAccess 	false
struts.convention.action.checkImplementsAction 	true
struts.enable.DynamicMethodInvocation 	true
struts.ognl.logMissingProperties 	false
struts.convention.action.fileProtocols 	jar
struts.convention.action.disableScanning 	false
devMode 	true
struts.action.extension 	action,,
struts.convention.exclude.parentClassLoader 	true
struts.enable.SlashesInActionNames 	false
struts.convention.default.parent.package 	convention-default
struts.multipart.handler 	jakarta
struts.convention.exclude.packages 	org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*
struts.i18n.encoding 	UTF-8
struts.convention.conventionsService 	convention
struts.convention.package.locators.basePackage 	
struts.multipart.maxSize 	2097152
struts.convention.action.name.separator 	-
struts.tag.altSyntax 	true
struts.convention.redirect.to.slash 	true
struts.freemarker.mru.max.strong.size 	100
struts.convention.action.alwaysMapExecute 	true
struts.convention.interceptorMapBuilder 	convention
struts.freemarker.templatesCache 	false
struts.convention.action.suffix 	Action
struts.mapper.alwaysSelectFullNamespace 	true
struts.convention.result.flatLayout 	true
struts.devMode 	true
allowStaticMethodAccess 	false
struts.freemarker.templatesCache.updateDelay 	0
struts.url.https.port 	443
struts.ui.theme 	xhtml
struts.velocity.contexts 	
struts.xslt.nocache 	false
struts.objectFactory.spring.autoWire.alwaysRespect 	false
struts.configuration.xml.reload 	true
struts.el.throwExceptionOnFailure 	false
struts.serve.static.browserCache 	true
struts.freemarker.wrapper.altMap 	true
struts.convention.actionConfigBuilder 	convention
struts.convention.resultMapBuilder 	convention



Remember, my app server is JBoss.

Thank you,
Steve

-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@googlemail.com] 
Sent: Thursday, September 29, 2011 12:10 AM
To: Struts Users Mailing List
Subject: Re: Struts 2 Annotation Tutorial (additional info)

Did you base on [1] ? If so, please remove struts.xml

[1] http://code.google.com/p/struts2-examples/downloads/detail?name=Struts_Annotations_Ant_2_2_1.zip&can=2&q=


Regards
-- 
Lukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Annotation Tutorial (additional info)

Posted by Łukasz Lenart <lu...@googlemail.com>.
Did you base on [1] ? If so, please remove struts.xml

[1] http://code.google.com/p/struts2-examples/downloads/detail?name=Struts_Annotations_Ant_2_2_1.zip&can=2&q=


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts 2 Annotation Tutorial (additional info)

Posted by Steve <it...@hotmail.com>.
Thank you both for your responses.  

Since I had " <constant name="struts.convention.action.suffix"
value="Controller"/>" listed in my struts.xml file, I tried renaming my
HelloAction class to "HelloController" or "HelloActionController" and tried
various urls to match but no luck.  I even tried removing the
"struts.convention.action.suffix" element but it didn't seem to make any
difference.

I've reverted back and below is what I've currently got.

The URL I use is:
http://localhost:8080/Struts2_Annotations_Ant/hello.action



My HelloAction class is as follows (sorry for forgetting to send it in the
first place):
package org.apache.struts.struts2annotations.action;

import org.jboss.xnio.log.Logger;

import com.opensymphony.xwork2.ActionSupport;

public class HelloAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private static final Logger logger =
Logger.getLogger(HelloAction.class.getName());
	
	private String message;

	public String execute() throws Exception {
		logger.info("In execute method of class Hello");
		message = "Hello from Struts 2 with no XML configurtaion";
		return SUCCESS;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}

}

-----Original Message-----
From: M. Rakowski [mailto:matthias@rakowski.biz] 
Sent: Wednesday, September 28, 2011 10:49 AM
To: user@struts.apache.org
Subject: Re: Struts 2 Annotation Tutorial (additional info)

I wrote:

 > make sure your Hallo-Action is in class HalloController in package  >
foo.actions.bar (foo and bar are random names)

which is not quite correct:
the prefix of the actions-package can be random.
The sub-packages names defines the url namespace.
For example, you can access the foo.actions.HalloController with
/context-path/hallo and the foo.actions.bar.BazController action with
/context-path/bar/baz

Regards, Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org