我有一个需要与TomCat一起部署的WAR,但我不确定WAR文件使用哪个版本的servlet规范.
根据apache的网站(http://tomcat.apache.org/whichversion.html),我需要根据WAR文件使用的规范下载不同的版本.
有什么方法可以解压缩WAR文件并查看一些配置文件吗?
我正在开发一个涉及servlet的项目.使用JD Java Decompiler for Eclipse我可以反编译并读取构成参考库中jar的所有类文件.是否可以以类似的方式读取WAR文件的内容?
另外,有没有办法打破可执行jar文件并读取原始代码?
我在安装mvn后将weblogic.xml放在WEB-INF文件夹下时遇到问题.我的weblogic.xml文件在src/main/resources/weblogic.xml下,我希望它在安装后放在WEB-INF下.(顺便打包是"战争")
我试过这个:
<resources>
<resource>
<directory>src/main/resources</directory>
<targetPath>../resources</targetPath>
<excludes><exclude>web.xml</exclude><exclude>weblogic.xml</exclude></excludes>
</resource>
<resource>
<directory>src/main/resources/config</directory>
<targetPath>..</targetPath>
<includes><include>weblogic.xml</include></includes>
</resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
它正在使用安装,但是当我想要使用eclipse:eclipse的类路径时,它会给出错误:
说明资源路径位置类型无法在输出文件夹'ResponseManager/target/WEB-INF'内嵌套输出文件夹'ResponseManager/target/WEB-INF/resources'ResponseManager构建路径构建路径问题
因为classpath中的这个conf:
<classpathentry kind="src" path="src/main/resources" output="target/WEB-INF/resources" excluding="web.xml|weblogic.xml|**/*.java"/>
<classpathentry kind="src" path="src/main/resources/config" output="target/WEB-INF" including="weblogic.xml" excluding="**/*.java"/>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
有人可以向我解释如何将WAR文件添加到EAR中吗?我有一个EAR文件已经包含一个WAR文件,我有另一个WAR文件,我想添加到这个EAR,所以它可以包含两个WAR并正常工作.
我不知道怎么做但我认为可以手动更改包含在EAR中的application.xml文件.
谢谢!
我一直在论坛上阅读如何阅读/编辑档案中的文件,但仍然无法得到我的答案.主要使用getResourceAsStream,并且必须在其类路径中.
我需要做的是,使用给定的文件路径作为输入读取和更新xml文件,然后将其重新部署到Tomcat.但到目前为止,我还是无法回答如何使用给定的完整路径作为输入编辑WAR归档内的AAR文件中的xml文件.有谁可以帮助我吗?
例如,我想编辑applicationContext.xml文件:
C:/webapp.WAR
从webapp.WAR文件:
webapp.WAR/WEB-INF /服务/ myapp.AAR
来自myapp.AAR:
myapp.AAR/applicationContext.xml中
我尝试使用Web应用程序从java类加载applicationContext.xml
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Run Code Online (Sandbox Code Playgroud)
和
ApplicationContext context = new FileSystemXmlApplicationContext("applicationContext.xml");
Run Code Online (Sandbox Code Playgroud)
我的问题是如何从java类加载applicationContext.xml.applicationContext.xml是WEB-INF.那可能吗?
我正在使用JBoss AS 7.1并尝试部署战争.但我得到以下例外:
17:12:11,146 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_51]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_51]
Caused by: java.lang.IllegalArgumentException: Child container with name already exists
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:804)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:792)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:356)
at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:62)
at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:38)
at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:55) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1549) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl.access$1900(ServiceControllerImpl.java:49) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1780) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1741) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
17:12:11,356 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在Jboss上部署Spring启动应用程序.我按照本教程将我的jar转换为war文件.但是当我尝试在Jboss上运行应用程序时,它会给我这个错误:
17:02:31,462 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter applicationContextIdFilter: java.lang.InstantiationException: org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration$1
at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,472 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter webRequestLoggingFilter: java.lang.InstantiationException: org.springframework.boot.actuate.trace.WebRequestTraceFilter
at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) …
Run Code Online (Sandbox Code Playgroud) 我使用maven打包我的web应用程序,但我发现很多maven jar都在我的war的lib目录中.我不认为它们对我在tomcat下的Web应用程序有用,所以如何排除它们呢?
<dependencies>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.whalin</groupId>
<artifactId>Memcached-Java-Client</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope> …
Run Code Online (Sandbox Code Playgroud) 我试图使用更新版本的Jackson作为JBoss 7 EAP提供.为了解决我的问题,我创建了一个jboss-deployment-structure.xml文件,该文件包含在我的war部署中.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<!--<module name="com.fasterxml.jackson.core.jackson-core" slot="main" />-->
<!--<module name="com.fasterxml.jackson.core.jackson-annotations" slot="main" />-->
<module name="com.fasterxml.jackson.core.jackson-databind" slot="main" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Run Code Online (Sandbox Code Playgroud)
但似乎JBoss使用交付的模块而不是提供的依赖项.
来自本地模块加载器的模块"com.fasterxml.jackson.core.jackson -databind:main"的ModuleClassLoader @ 134593bf(finder:local module finder @ 4bb4de6a(roots:...\jboss-eap-7.0\modules,...\JBoss的-EAP-7.0 \模块\ SYSTEM \层\基))
我发现了一个类似的问题JBoss 7 Classloader - 排除模块实现,但它没有帮助我.
我错过了什么?
war ×10
java ×7
jboss ×3
deployment ×2
maven ×2
servlets ×2
tomcat ×2
classpath ×1
ear ×1
file-io ×1
jar ×1
java-ee ×1
jboss-eap-7 ×1
jboss7.x ×1
maven-2 ×1
maven-plugin ×1
spring ×1
spring-boot ×1
spring-mvc ×1
weblogic ×1
xml ×1