struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Spasojevic (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-3662) convention-plugin not work in jboss-7.0.0
Date Sat, 11 Feb 2012 04:27:06 GMT

    [ https://issues.apache.org/jira/browse/WW-3662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206010#comment-13206010
] 

Daniel Spasojevic commented on WW-3662:
---------------------------------------

Hi,

I am not sure if you have found this while applying patches, but it seems that the patch does
not completely fix the problem (at least for WARs deployed inside EARs).

Under AS 7.1, getPhysicalFile returns a file: protocol URL for WARs that are deployed inside
an EAR (e.g. file:/opt/jboss-7.1/standalone/tmp/vfs/deploymentbf6286bf44ddf7db/ear-deployed-war.war-e4ba4d7598ffbb70/),
so:
{code:title=com.opensymphony.xwork2.util.finder.UrlSet.java}
if ("jar".equals(finalUrl.getProtocol()))
{code}
should probably be:
{code:title=com.opensymphony.xwork2.util.finder.UrlSet}
if ("jar".equals(finalUrl.getProtocol()) || "file".equals(finalUrl.getProtocol()))
{code}

Additionally, ClassFinder only checks for and removes WEB-INF/classes when scanning JARs,
so I changed:
{code:title=com.opensymphony.xwork2.util.finder.ClassFinder}
    private void scanDir(File dir, List<String> classNames, String packageName) {
...
                 classNames.add(packageName + name);
...
    }
{code}

to:

{code:title=com.opensymphony.xwork2.util.finder.ClassFinder}
    private void scanDir(File dir, List<String> classNames, String packageName) {
...
                // Classes packaged in an exploded .war (e.g. in a VFS file system) should
not
                // have WEB-INF.classes in their package name.
                classNames.add(StringUtils.removeStart(packageName, "WEB-INF.classes.") +
name);
...
    }
{code}

I made these changes against trunk, and Actions appeared to be found and deployed (if that
is the right word) as expected.

I am not sure why I had to make these changes when others have had success with this patch
- JBoss may be configured differently in my environment.

Thanks to everyone that contributed to the existing patch - it certainly helped.
                
> convention-plugin not work in jboss-7.0.0
> -----------------------------------------
>
>                 Key: WW-3662
>                 URL: https://issues.apache.org/jira/browse/WW-3662
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Convention
>    Affects Versions: 2.2.3
>         Environment: OS:win7, JDK:1.6.0_26, APP:jboss 7.0.0
>            Reporter: lwen.ma
>            Assignee: Maurizio Cucchiara
>             Fix For: 2.5
>
>         Attachments: JBoss7Fix-2.patch, JBoss7Fix.patch, URLUtil.java, xwork-core-2.2.1.2-SNAPSHOT.jar,
xwork-core-2.2.3.1-temporarily-resolved.jar
>
>
> 1. first, replace the xwork-x.x.x.jar with a bug-fixed version, see: https://issues.apache.org/jira/browse/WW-3558,
prevent the bug breaking the deployment
> 2. use follow config in struts.xml
>     <constant name="struts.convention.exclude.parentClassLoader" value="true" />
>     <constant name="struts.convention.action.fileProtocols" value="jar,vfs,vfsfile,vfszip"
/>
>     <constant name="struts.convention.package.locators" value="actions,action" />
>     <constant name="struts.convention.package.locators.disable" value="false" />
>     <constant name="struts.convention.package.locators.basePackage" value="com.mcms.web.actions"
/>
> 3. deploy *.war file to jboss, then start it, get follow error log
> 	17:40:27,711 SEVERE [com.opensymphony.xwork2.util.finder.ClassFinder] Unable to read
URL [vfs:/G:/jboss-as-7.0.0.Final/bin/content/struts2.war/WEB-INF/classes/]: java.io.FileNotFoundException:
G:\jboss-as-7.0.0.Final\bin\content\struts2.war\WEB-INF\classes
>         at java.io.FileInputStream.open(Native Method) [:1.6.0_26]
>         at java.io.FileInputStream.<init>(FileInputStream.java:120) [:1.6.0_26]
>         at java.io.FileInputStream.<init>(FileInputStream.java:79) [:1.6.0_26]
>         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
[:1.6.0_26]
>         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
[:1.6.0_26]
>         at java.net.URL.openStream(URL.java:1010) [:1.6.0_26]
>         at com.opensymphony.xwork2.util.finder.ClassFinder.jar(ClassFinder.java:480)
[xwork-core-2.2.3.jar:]
>         at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:144)
[xwork-core-2.2.3.jar:]
>         at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:376)
[struts2-convention-plugin-2.2.3.jar:]
>         at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:334)
[struts2-convention-plugin-2.2.3.jar:]
>         at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
[struts2-convention-plugin-2.2.3.jar:]
> 4. use follow config in struts.xml
>     <constant name="struts.convention.package.locators" value="actions,action" />
>     <constant name="struts.convention.package.locators.disable" value="false" />
>     <constant name="struts.convention.package.locators.basePackage" value="com.mcms.web.actions"
/>
> 5. deploy *.war file to jboss, then start it. 
>    The war package deployed without any error, but no struts actions will be found(either
use package scan or annotation)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message