You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Manolo Nicolas (JIRA)" <ji...@apache.org> on 2012/12/03 12:29:58 UTC

[jira] [Commented] (AXIS2-5444) FileNotFound exception deploying to specific context on Tomcat 7

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

Manolo Nicolas commented on AXIS2-5444:
---------------------------------------

I have the same problem with Axis2 1.5.6
In 1.5.6 the problem is in escape character in url. The # character needs to be escaped.
We need to modify org.apache.axis2.deployment.util.Utils
I've marked the changes with //<--

    public static URL[] getURLsForAllJars(URL url, File tmpDir) {
        FileInputStream fin = null;
        InputStream in = null;
        ZipInputStream zin = null;
        try {
            url=new URL(URIUtil.encodePath(url.toString()));  //<--
            ArrayList array = new ArrayList();
            in = url.openStream();
            String fileName = url.getFile();
            int index = fileName.lastIndexOf('/');
            if (index != -1) {
                fileName = fileName.substring(index + 1);
            }
            final File f = createTempFile(fileName, in, tmpDir);

            fin = (FileInputStream)org.apache.axis2.java.security.AccessController
                    .doPrivileged(new PrivilegedExceptionAction() {
                        public Object run() throws FileNotFoundException {
                            return new FileInputStream(f);
                        }
                    });
            array.add(f.toURI().toURL());  //<--
            zin = new ZipInputStream(fin);

            ZipEntry entry;
            String entryName;
            while ((entry = zin.getNextEntry()) != null) {
                entryName = entry.getName();
                /**
                 * id the entry name start with /lib and end with .jar then
                 * those entry name will be added to the arraylist
                 */
                if ((entryName != null)
                    && entryName.toLowerCase().startsWith("lib/")
                    && entryName.toLowerCase().endsWith(".jar")) {
                    String suffix = entryName.substring(4);
                    File f2 = createTempFile(suffix, zin, tmpDir);
                    array.add(f2.toURI().toURL());  //<--
                }
            }
            return (URL[])array.toArray(new URL[array.size()]);
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (fin != null) {
                try {
                    fin.close();
                } catch (IOException e) {
                    //
                }
            }
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    //
                }
            }
            if (zin != null) {
                try {
                    zin.close();
                } catch (IOException e) {
                    //
                }
            }
        }
    }


                
> FileNotFound exception deploying to specific context on Tomcat 7
> ----------------------------------------------------------------
>
>                 Key: AXIS2-5444
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5444
>             Project: Axis2
>          Issue Type: Bug
>          Components: deployment
>    Affects Versions: 1.6.2
>         Environment: Ubuntu 12.04, Tomcat 7.0.32
>            Reporter: Ben Williams
>
> When I try to deploy the vanilla 1.6.2 axis2.war to a subdirectory context, like /v30/axis2, I get the exception at the bottom of this description during deployment.
> Steps to reproduce:
> 1. Copy axis2.war to ${TOMCAT_HOME}/webapps/v30#axis2.war
> 2. Start Tomcat with "${TOMCAT_HOME}/bin/catalina.sh start"
> Expected result:
> axis2.war deploys to /v30/axis2 context without error and is accessible at http://localhost:8080/v30/axis2
> Actual result:
> FileNotFound exception and this stacktrace printed to console:
> [WARN] Exception extracting jars into temporary directory : java.io.FileNotFoundException: /opt/apache-tomcat-7.0.32/webapps/v30 (No such file or directory) : 
> switching to alternate class loading mechanism
> [ERROR] The mtompolicy-1.6.2.mar module, which is not valid, caused java.io.FileNotFoundException: /opt/apache-tomcat-7.0.32/webapps/v30 (No such file or direc
> tory)
> [INFO] Deploying Exception Occured with java.io.FileNotFoundException: /opt/apache-tomcat-7.0.32/webapps/v30 (No such file or directory)
> java.lang.RuntimeException: java.io.FileNotFoundException: /opt/apache-tomcat-7.0.32/webapps/v30 (No such file or directory)
>   at org.apache.axis2.deployment.util.Utils.findLibJars(Utils.java:780)
>   at org.apache.axis2.deployment.util.Utils.createClassLoader(Utils.java:834)
>   at org.apache.axis2.jaxws.framework.JAXWSDeployer.deployServicesInWARClassPath(JAXWSDeployer.java:99)
>   at org.apache.axis2.jaxws.framework.JAXWSDeployer.init(JAXWSDeployer.java:79)
>   at org.apache.axis2.deployment.DeploymentEngine.initializeDeployers(DeploymentEngine.java:1168)
>   at org.apache.axis2.deployment.DeploymentEngine.setConfigContext(DeploymentEngine.java:1157)
>   at org.apache.axis2.deployment.WarBasedAxisConfigurator.setConfigContext(WarBasedAxisConfigurator.java:349)
>   at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:89)
>   at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
>   at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
>   at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
>   at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
>   at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
>   at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
>   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
>   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
>   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
>   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:968)
>   at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1646)
>   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>   at java.lang.Thread.run(Thread.java:679)
> Caused by: java.io.FileNotFoundException: /opt/apache-tomcat-7.0.32/webapps/v30 (No such file or directory)
>   at java.io.FileInputStream.open(Native Method)
>   at java.io.FileInputStream.<init>(FileInputStream.java:137)
>   at java.io.FileInputStream.<init>(FileInputStream.java:96)
>   at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:87)
>   at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:178)
>   at java.net.URL.openStream(URL.java:1031)
>   at org.apache.axis2.deployment.util.Utils.findLibJars(Utils.java:762)
>   ... 26 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org