war

Using Maven, how to properly deploy WAR depending on J2EE/JPA JAR?

喜欢而已 提交于 2019-11-28 02:06:21
问题 I'm creating a modular Maven project. Project is deployed on Glassfish 3.1. Project (webapp) consists of three modules: "Common", consisting of core functionality (persistence, authentication logic, etc.), built into a JAR "User", depending on Common, built into a WAR "Admin", also depending on Common and WARred Both WAR use heavy annotated (@Entity, @Inject, @EJB, ...) classes from Common. Currently Common is a JAR, but it's not a requirement. The question is: How to properly deploy such

Why do I get a NoSuchMethodError on JodaTime.withYear()?

不打扰是莪最后的温柔 提交于 2019-11-28 01:24:39
I have a maven web app project, where I use JodaTime. JodaTime is not directly referenced in my maven project, but is a part of a transitive dependency. In other words, my web app war, has another project of mine as a direct dependency, and that jar contains JodaTime. I am getting an error after executing these two lines. It compiles fine though. DateTime firstDate = new DateTime(); firstDate = firstDate.withYear(2016); And here is my error: java.lang.NoSuchMethodError: org.joda.time.DateTime.withYear(I)Lorg/joda/time/DateTime; I know that these kinds of errors can happen if I compile and run

Can I list the resources in a given package?

*爱你&永不变心* 提交于 2019-11-28 00:42:09
Lets assume my classes are loaded from a compressed .war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there a library out there that does something like that? Googling revealed only some hacks with listing files. SCdF No, you can't list resources in a package because the JVM simply doesn't know what resources are in what package. See this question . jcfolsom Yes. You can use ClassLoader.getResources("") ; Or you could use ferret

Is there any way to tell maven war plugin to use folder other than target/classes

强颜欢笑 提交于 2019-11-28 00:33:40
问题 when i use maven war plugin, by default, this plug-in will copy all class files(*.class) from target/classes to {warfile}/web-inf/classes. The problem is if i have compiled classes (*.class) that stay in another folder : basedir/other-classes (they are *.class file not *.java file, i know, it is weird. But those classes is generated from 3rd party). Is there any way to tell maven war plugin to copy all classes in (basedir/other-classes) and (target/classes) into {warfile}/web-inf/classes 回答1:

Separating war application name from war file name

不问归期 提交于 2019-11-27 21:08:05
Currently if i deploy a war file on tomcat named say myapp.war , I can access its url by http://localhost/myapp/MyServlet . However what I want is to deploy a war with a version number in the war file name and still have the same url. For eg, I want to deploy myapp-1.1.0.war and still have the url be http://localhost/myapp/MyServlet Of course I need to keep updating the war and the version number will keep changing, so I cant hardcode the war filename anywhere. Is there any setting in web.xml I can use to keep the same url for the app regardless of the war filename? The solution is to stop

跟我学习dubbo-构建Dubbo服务消费者Web应用的war包并在Tomcat中部署(6)

谁说胖子不能爱 提交于 2019-11-27 20:20:53
Dubbo 服务消费者 Web 应用 war 包的部署 IP: xx.xx.xx.xx 部署容器: apache-tomcat-7.0.57 端口: 8080 应用: jeesml-web.war 1、 下载(或上传)最新版的 Tomcat7: $ wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57 .tar.gz 2、 规范安装目录: /home/jeesml/jeesml/web/xxx-tomcat 如: /home/jeesml/jeesml/web/jeesml-tomcat 3、 解压安装 $ mkdir –p /home/jeesml/jeesml/web $ tar -zxvf apache-tomcat-7.0.57.tar.gz $ mv apache-tomcat-7.0.57 /home/jeesml/jeesml/web/jeesml-tomcat 4、 移除/home/jeesml/jeesml/web/jeesml-tomcat/webapps 目录下的所有文件: $ rm -rf /home/jeesml/jeesml/web/jeesml-tomcat/webapps/* 5、 上传 Dubbo 服务消费者 Web 应用

Deploying Java webapp to Tomcat 8 running in Docker container

吃可爱长大的小学妹 提交于 2019-11-27 20:09:33
问题 I am pretty new to Tomcat and Docker - so I am probably missing a Tomcat fundamental somewhere in this question. What I am trying to do is build a Docker container that runs a SpringBoot Restful web service that just returns some static data. This is all running on OSX so I am using Boot2Docker as well. I've written my own Dockerfile to build the container that my app runs in: FROM tomcat:8.0.20-jre8 RUN mkdir /usr/local/tomcat/webapps/myapp COPY /1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.war /usr

How to make maven place all jars common to wars inside the same EAR to EAR root?

左心房为你撑大大i 提交于 2019-11-27 19:56:12
问题 We have a solution with numerous wars. Wars are similar in the sense they all use hibernate and spring. This means that we have a number of same jars inside each war. This is becoming a problem, because the size of the ear is starting to grow out of proportion. I would like to use Maven to calculate dependencies and to place all jars common to multiple wars to the root of the EAR. I tried organizing my project using j2ee archetype (maven-archetype-j2ee-simple), but all wars are still packaged

EAR vs separate EJB + WAR

狂风中的少年 提交于 2019-11-27 18:01:54
What's the difference in deploying application as EAR (with 1 EJB and 1 WAR module) vs separate modules? I want to use GlassFish 3 web profile but it does not support EAR archive. Can I simply use EJB and WAR as separate modules? Any other options? There seems to be some confusion between 3 variants of deployment: An EAR that includes an EJB and WEB module Deploying a separate EJB module and a separate WEB module Deploying a WEB module that includes EJB classes or an EJB jar. In the first situation, you have logically one application, but one that is divided in two tiers. The WEB module is

How to setup angular 4 inside a maven based java war project

℡╲_俬逩灬. 提交于 2019-11-27 17:38:19
I'm becoming a bit crazy because I can't find a guide to setup an angular 4 app inside a java war project that will be built with maven. This is because I want to run it into a wildfly server. Any help? Thanks I had similar requirement to have one source project which has java web-services project as well as angular project(an angular-cli based project) and maven build should create a war with all angular files in it. I used maven-frontend-plugin with few configuration changes for base path. The goal was to create a war file with all the java code in it plus all the aot compiled angular code