does not exist or is not a readable directory

本文描述了在使用Eclipse复制并重命名Struts2 Web项目后遇到的部署问题及解决方案,涉及Tomcat启动错误和404问题,并给出具体修改步骤。

对一Web工程fileUpload_struts2_2复制+粘+改名为fileUpload_struts2_3造成的问题:启动Tomcat提示错误RT

1.将fileUpload_struts2_2添加到Tomcat Server,Publish的效果:

   a.%Tomcat%\webapps 下生成 fileUpload_struts2_3 目录

   b.%Tomcat%\conf\Catalina\localhost 下生成 fileUpload_struts2_2.xml,文件内容:

  <?xml version="1.0" encoding="UTF-8"?>
  <Context docBase="E:\Tomcat6.0\webapps\fileUpload_struts2_3" reloadable="true" source="org.eclipse.jst.jee.server:fileUpload_struts2_3"/>
2.启动Tomcat的效果

  c.%Tomcat%\work\Catalina\localhost 下生成 fileUpload_struts2_2 目录

  d.%Tomcat%\work\Catalina\localhost 下生成 fileUpload_struts2_3 目录

  e.控制台报错:

  2012-3-17 22:28:06 org.apache.catalina.startup.HostConfig deployDescriptor
  警告: A docBase E:\Tomcat6.0\webapps\fileUpload_struts2_3 inside the host appBase has been specified, and will be ignored
  2012-3-17 22:28:06 org.apache.catalina.core.StandardContext resourcesStart
  严重: Error starting static Resources
  java.lang.IllegalArgumentException: Document base E:\Tomcat6.0\webapps\fileUpload_struts2 does not exist or is not a readable directory

这里就有问题了,在%Tomcat%\conf\Catalina\localhost下手动配置虚拟路径时一般将文件名取为配置项中的工程名,eclipse默认也是这样生成的

即使删掉,启动Tomcat仍会生成.

3.错误在于复制工程同时也复制了其配置文件,其中复制后的 fileUpload_struts2_3\.settings\org.eclipse.wst.common.compone 文件内容:

  <?xml version="1.0" encoding="UTF-8"?>
  <project-modules id="moduleCoreId" project-version="1.5.0">
      <wb-module deploy-name="fileUpload_struts2">
          <wb-resource deploy-path="/" source-path="/WebContent"/>
          <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
          <property name="context-root" value="fileUpload_struts2"/>
          <property name="java-output-path" value="/fileUpload_struts2/build/classes"/>
      </wb-module>
  </project-modules>
 这文件用来做部署,声明了相关路径  将其中 fileUpload_struts2_2 改为 fileUpload_struts2_3 即可



附:今天遇到的404问题

    描述:访问部署后的Web项目的JSP页面,结果404

    原因:Deploy path 被改到Tomcat下,而没修改Server Path

    解决办法:同时修改两个路径.

    [ 注:默认原始路径  Server Path :workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0

                                    Deploy path :workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps ]




> Task :app:compileDebugJavaWithJavac FAILED FAILURE: Build completed with 5 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeDebugJavaResource'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform httpclient-osgi-4.5.14.jar to match attributes {artifactType=android-java-res, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar > Failed to transform httpclient-win-4.5.14.jar to match attributes {artifactType=android-java-res, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar > Failed to transform httpcore-4.4.16.jar to match attributes {artifactType=android-java-res, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform httpclient-osgi-4.5.14.jar to match attributes {artifactType=enumerated-runtime-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar > Failed to transform httpclient-win-4.5.14.jar to match attributes {artifactType=enumerated-runtime-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar > Failed to transform httpcore-4.4.16.jar to match attributes {artifactType=enumerated-runtime-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 3: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:desugarDebugFileDependencies'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform httpclient-osgi-4.5.14.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar > Failed to transform httpclient-win-4.5.14.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar > Failed to transform httpcore-4.4.16.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 4: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeDebugNativeLibs'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Failed to transform httpclient-osgi-4.5.14.jar to match attributes {artifactType=android-jni, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for ExtractJniTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar. > C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar > Failed to transform httpclient-win-4.5.14.jar to match attributes {artifactType=android-jni, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for ExtractJniTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar. > C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar > Failed to transform httpcore-4.4.16.jar to match attributes {artifactType=android-jni, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for ExtractJniTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar. > C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 5: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':app:debugCompileClasspath'. > Failed to transform httpclient-osgi-4.5.14.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-osgi-4.5.14.jar > Failed to transform httpclient-win-4.5.14.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpclient-win-4.5.14.jar > Failed to transform httpcore-4.4.16.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for IdentityTransform: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar. > File/directory does not exist: C:\android\Notesmaster\httpcomponents-client-4.5.14-bin\lib\httpcore-4.4.16.jar * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== BUILD FAILED in 2m 7s 26 actionable tasks: 26 executed
最新发布
05-26
### 文件打开失败解决方案 当遇到 `Failed to open stream: No such file or directory` 错误时,通常意味着 PHP 尝试访问不存在的文件或目录。以下是详细的排查和解决方法: #### 1. 检查文件路径 确保指定的文件路径是绝对路径而不是相对路径。如果使用的是相对路径,则需要确认当前工作目录是否正确。可以尝试打印出当前的工作目录来验证。 ```php echo getcwd(); // 打印当前工作目录 ``` 对于 Laravel 项目中的 artisan 脚本报错,在 `/xxx/xxx/artisan on line 18` 处出现问题可能是由于 Composer 自动加载配置不完整或者 vendor 目录缺失造成的[^3]。 #### 2. 验证文件存在性 在尝试读取文件之前先检查该文件是否存在并可读写权限正常。 ```php if (!file_exists($filePath)) { echo "File does not exist."; } elseif (!is_readable($filePath)) { echo "File is not readable."; } ``` #### 3. 安装依赖包 如果是第三方库引起的错误(如 PHPSpreadsheet),则需通过 Composer 来安装相应的扩展库。 ```bash composer require phpoffice/phpspreadsheet ``` 这会自动下载所需的类文件到项目的 vendor 文件夹下,并更新 composer.json 和 composer.lock 文件[^4]。 #### 4. 设置正确的存储权限 针对 Android 应用程序开发环境下的文件操作问题,可能是因为外部存储空间访问受限所引起。可以在应用清单文件中添加如下属性以启用旧版存储模式: ```xml <application ... android:requestLegacyExternalStorage="true"> </application> ``` 不过需要注意这种方法仅适用于 API level 29 及以下版本的应用;对于更高版本建议按照官方文档调整数据保存策略[^5]。 #### 5. 清理缓存重置服务提供者 有时修改后的代码未能生效也可能是因为框架内部缓存未及时刷新所致。可以通过 Artisan 命令清理视图和其他类型的缓存资源。 ```bash php artisan config:clear php artisan cache:clear php artisan route:clear php artisan view:clear ``` 另外还需注意加密密钥设置不当也会引发异常提示 “No application encryption key has been specified.” 此时应生成一个新的随机字符串作为 APP_KEY 并将其记录于 .env 文件之中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值