[
https://issues.apache.org/jira/browse/WW-3487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998975#comment-12998975
]
John Liptak commented on WW-3487:
---------------------------------
For a very long discussion of the problem, see
https://jira.springsource.org/browse/SPR-5120
My total hack workaround, since I am always using Spring, was to change
findActions to the following:
@SuppressWarnings("unchecked")
protected Set<Class> findActions() {
Set<Class> classes = new HashSet<Class>();
try {
if (actionPackages != null || (packageLocators != null &&
!disablePackageLocatorsScanning)) {
// By default, ClassFinder scans EVERY class in the specified
// url set, which can produce spurious warnings for non-action
// classes that can't be loaded. We pass a package filter that
// only considers classes that match the action packages
// specified by the user
Test<String> classPackageTest = getClassPackageTest();
UrlSet s = buildUrlSet();
List<URL> urls = s.getUrls();
addSpringUrls(urls);
ClassFinder finder = new ClassFinder(getClassLoaderInterface(),
urls, true, this.fileProtocols, classPackageTest);
Test<ClassFinder.ClassInfo> test = getActionClassTest();
classes.addAll(finder.findClasses(test));
}
} catch (Exception ex) {
if (LOG.isErrorEnabled())
LOG.error("Unable to scan named packages", ex);
}
return classes;
}
private void addSpringUrls(List<URL> urls) {
try {
PathMatchingResourcePatternResolver scanner = new
PathMatchingResourcePatternResolver();
Resource[] resources =
scanner.getResources("classpath:/*");
Set<String> contexts = new HashSet<String>();
for(Resource r : resources) {
String description = r.getDescription();
if(description.contains("FileHandler")) {
/**
* parse out the context from something
that looks like this:
*
FileHandler@24227094[path=WEB-INF/classes/com/qwest/cloud/view
context=file:/C:/programs/Red%20Hat/EnterprisePlatform-5.1.0/jboss-eap-5.1/jboss-as/server/default/tmp/a2165f-6gzykk-gkjxxod8-1-gkjy3coe-aa/helloWeb.war/
real=file:/C:/programs/Red%20Hat/EnterprisePlatform-5.1.0/jboss-eap-5.1/jboss-as/server/default/tmp/a2165f-6gzykk-gkjxxod8-1-gkjy3coe-aa/helloWeb.war/WEB-INF/classes/com/qwest/cloud/view/]
*/
String context =
description.substring(description.indexOf("context=")+8, description.indexOf("
real="));
contexts.add(context);
}
}
for(String context : contexts) {
urls.add(new URL(context + "WEB-INF/classes/"));
}
} catch (Exception e) {
LOG.error("didn't load spring URL",e);
}
}
> The plugin can't find the actions if the war embeded in an ear.
> ---------------------------------------------------------------
>
> Key: WW-3487
> URL: https://issues.apache.org/jira/browse/WW-3487
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: JBoss 5.1
> Reporter: Böszörményi Péter
> Assignee: Lukasz Lenart
> Attachments: struts2-src.tar.gz, struts2.ear
>
>
> If I deploy an ear that contains a war, the plugin can't find the actions
> under JBoss 5.1. If I only deploy the war everything is fine. Tha actions
> defined in struts.xml works perfectly in both cases. I did some
> investigation, and i think the problem is in the method
> org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira