Menu
  • HOME
  • TAGS

Deploye two wars with different domain name but same context-path in same jboss-4.0.3

Tag: tomcat,jboss,web-deployment,contextpath

I've two web application wars STORE_ABC.war and STORE_DEF.war and single JBoss server running on my machine. I want to deploye both war with same context path in my jboss as follows.

http://localhost:8080/home For STORE_ABC.war

http://testsite1:8080/home For STORE_DEF.war

jboss-web.xml for STORE_ABC.war and STORE_DEF.war

<jboss-web>
   <context-root>/</context-root>
</jboss-web>

How could I achieve above configuration?

Best How To :

I have added another host vhost2 to server.xml inside folder ${jboss-home}server\default\deploy\jbossweb-tomcat55.sar folder as follows:

<Server>
<Service name="jboss.web"
  className="org.jboss.web.tomcat.tc5.StandardService">
  <Connector port="8080" address="${jboss.bind.address}"
     maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
     emptySessionPath="true"
     enableLookups="false" redirectPort="443" acceptCount="100"
     connectionTimeout="20000" disableUploadTimeout="true"/>

  <Connector protocol="HTTP/1.1" port="8081" address="${jboss.bind.address}" 
    redirectPort="${jboss.web.https.port}" />


  <Connector port="8089" address="${jboss.bind.address}"
     emptySessionPath="true" enableLookups="false" redirectPort="443" 
     protocol="AJP/1.3"/>

  <Connector port="8445" address="${jboss.bind.address}"
       maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
       emptySessionPath="true"
       scheme="https" secure="true" clientAuth="false" 
       keystoreFile="${jboss.server.home.dir}/conf/bookstore.keystore"
       keystorePass="bookstore" sslProtocol = "TLS" allowTrace="true"/>

   <Engine name="jboss.web" defaultHost="localhost">
     <Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
        certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
        />
    <Host name="localhost"
        autoDeploy="false" deployOnStartup="false" deployXML="false">
     </Host>
    <Host name="vhost2" autoDeploy="false" 
              deployOnStartup="false" deployXML="false">
                   <Alias>testsite1</Alias>  
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                   prefix="vhost2" suffix=".log" pattern="common" 
                   directory="${jboss.server.home.dir}/log"/>
            <DefaultContext cookies="true" crossContext="true" override="true"/>
        </Host>
  </Engine>
</Service>
</Server>

then I added a new file jboss-web.xml in STORE-DEF.war inside WEB-INF folder as follows:

<jboss-web>
   <context-root>/</context-root>
  <virtual-host>testsite1</virtual-host>
</jboss-web>

Now I am able to access STORE-ABC.war from URL http://localhost:8080/home and STORE-DEF.war from URL http://testsite1:8080/home.

Note- Do not forget to add 127.0.0.1 testsite1 in hosts file.

Tomcat 7 PermGen Space or Failed to Create JVM

java,eclipse,tomcat,tomcat7,permgen

Problem solved : Downloaded a new Tomcat (7.0.62) : https://tomcat.apache.org/download-70.cgi Added Arguments at the launch of my Tomcat : -Xms256m -Xmx512m -XX:MaxPermSize=128m ...

@Resource datasource breaking DB connection

java,jpa,jdbc,jboss,wildfly

There are a few possibilities what could go wrong. First, you are opening the connection in initParser(), but closing it in finalizeParser(), without using finally. If an exception is thrown, the connection is not closed. It would still be better to use try-with-resources. Another potential problem is that the class...

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver [Eclipse, Tomcat]

java,mysql,eclipse,tomcat,jdbc

It should be in your Webcontent/WEB-INF/lib folder not Webcontent/META-INF/lib

Intellij web application on tomcat server shows http://localhost:8080/index.jsp instead of http://localhost:8080/myapp/index.jsp

java,jsp,tomcat,servlets,intellij-idea

You can enter your application URL in the 'Edit Connfiguration' of your tomcat server. Click on Edit Configuration Enter you application URL in the start up page Note:- Most probably above solution will work, if it doesn't then you might need to change the application context to '\myApp' in deployment...

Remote debugging tomcat with OpenShift

eclipse,tomcat,openshift,remote-debugging

You should read through the Developer Portal's pages on Port Forwarding (https://developers.openshift.com/en/managing-port-forwarding.html) to make sure that you are using it correctly. You will want to connect to your local loopback address: 127.0.0.1 along with the correct forwarded port once you have run the port-forwarding command.

Get the currently used protocol name from HttpServletRequest?

java,spring,tomcat

The protocol is HTTP/1.1, since it is a specific version of HTTP. The scheme as given by ServletRequest#getSchemeitself is http: new URL(httpRequest.getScheme(), httpRequest.getServerName(), httpRequest.getServerPort(), httpRequest.getContextPath().concat("/foo/bar.html")); ...

Tomcat 7.0 + Chrome dont show JSON

java,json,rest,tomcat,jersey

Seeing from your previous question, you seem to missing a provider for JSON/POJO support. You can see this answer for all the jars and dependencies you need to add to your project. Note: The linked answer shows 2.17 jars for Jersey, but you are using 2.18. The answer also provides...

How to deploy WildFly datasource with Arquillian?

java,jboss,integration-testing,wildfly-8,jboss-arquillian

You could use separate standalone*.xml for arquillian testing and specify your datasource there. For instance, in arquillian.xml: <configuration> ... <property name="serverConfig">standalone-test.xml</property> ... </configuration> and datasource can be described in the <datasources> section of that standalone...

CORS Request Error Tomcat 7 & Java Servlet

java,tomcat,servlets

OK, I got it. The problem was a pretty simple one, but it was causing me so much trouble. I'm programming with eclipse and I'm new to this IDE. Eclipse seems to use it's own copy of Tomcat in a binary .metadata-folder in my workspace. If anyone else has this...

Wildcard with Service Stop/Start

batch-file,tomcat,kill

You can use WMIC commands with wildcards to accomplish this: wmic service where "name like 'tomcat%'" call stopservice See Wildcard Services restart on the Super User site....

Using client certificate with Apache Axis 1

web-services,tomcat,axis,client-certificates

The solutions is to use JVM-Paramters for truststore and keystore. java -Djavax.net.ssl.trustStore=/some/path/myTruststore.jks -Djavax.net.ssl.trustStorePassword=abc -Djavax.net.ssl.keyStore=/some/path/myKeystore.p12 -Djavax.net.ssl.keyStorePassword=defg -Djavax.net.ssl.keyStoreType=PKCS12 ...

How to set HttpServletResponse on Jboss EAP 6.2?

java,spring-mvc,jboss

Unfortunately the only way I could get this working for Jboss was creating a different method for IE9: @RequestMapping(value = "/ie9", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE) public String fooIE9(@RequestParam("arquivo") MultipartFile arquivo) throws JsonProcessingException { ObjectWriter ow = new ObjectMapper().writer(); return ow.writeValueAsString(uploadService.saveFile(arquivo)); } ...

Tomcat support for HTTP/2.0?

tomcat,https,tomcat7,tomcat8,http2

I'm the HTTP/2 implementer in Jetty, and I watch out other projects implementing HTTP/2. Tomcat's Mark Thomas has outlined support for HTTP/2 for Tomcat 9. Considering that Servlet 4.0 is going to have as a target HTTP/2 support, and that HTTP/2 support requires ALPN support in the JDK (which also...

CAS Redirect Loop

java,tomcat,single-sign-on,cas

It was nothing to do with my configuration. I watched several videos and understood that my configuration do not have any problems. The problem is with the 4.0.0 release. I do not know if any one else faced the same problem. My Solution: I took latest source (4.0.2) and built...

How to shutdown a Tomcat's instance that wont shutdown? [duplicate]

java,tomcat,netbeans,tomee

The problem is the same as Mugi4ok. So it is a possible duplicate. The full answer was found here...

How To find a WebSocket from a REST bean

rest,jboss,websocket

A Websocket connection starts with a HTTP handshake. On the handshake you also receive cookies (e.g. the session ID cookie) so you get access to the HTTP session. From the JSR 356 Java API for WebSocket spec: Because websocket connections are initiated with an http request, there is an association...

Use JSF, JPA, JTA, JAAS, CDI, Bean Validation with Tomcat? [closed]

jsf,tomcat,jpa,cdi,jta

Yes. Except of JAAS. ​​​​​​​​...

Idea 14 - Maven 3 - pass parameters

java,maven,tomcat,intellij-idea

You can define profile specific properties directly in pom.xml like so: <profile> <id>localhost</id> <properties> <augage_env>local</augage_env> </properti‌​es> </profile> More information can be found in Maven documentation for build profiles....

Express.js server with Apache Tomcat

node.js,tomcat,express

I don't believe that combining express.js (simple web server for Node.JS platform) and Apache Tomcat (Servlet container from JVM world) make sense at all. I bet that you are confusing Apache Web Server with Apache Tomcat. They are two completely separate projects. If that is the case than notice that...

How to load config.properties file in a Seam Application using web.xml context-param

jboss,seam,web.xml

Move the config.properties file into WEB-INF/classes. It will not be accessible from the class loader if it's just in WEB-INF....

Placing secure data in Java web application

java,security,tomcat

Using a servlet does not make anything secure by itself. You dont need a Java tool to connect, you can even use Telnet, any scripting language or create your own socket. Just use a download servlet from somewhere and at least Basic authentication ("information hiding" is no security aspect ;)....

Cannot find a package in yum repo list

tomcat,centos,yum

Your Yum is configured to search for the default yum repositories and if it can't find the package in that repository, you need to specify the appropriate repository hosting the package. You could specify this using https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Managing_Yum_Repositories.html The below articles might help you install tomcat-native http://linuxfreaks.in/tomcat-native-library-apr-installation-on-centos/...

Tomcat servlet the requested resource is unavailable

java,tomcat,servlets

Your web.xml file needs to be inside the WEB-INF folder instead of next to it. If it's not in the right location, Tomcat won't parse it and your URL patterns will not be correctly configured. If you're using the Servlet 3.0 (or higher) API, you could also configure your servlet...

Spring Boot configure a Domain/Host to access in a www.website.com fashion

tomcat,nginx

Technically you could do that in Tomcat. However, to start the application with port 80 or 443 you would have to run it with root permissions. Thus i'd recommend to configure and Apache HTTP or an Nginx server as reverse proxy (you can find many tutorials for that topic).

Failed to execute goal on project. Unable to find POM in project

java,maven,jboss

You need to add redhat repo in your pom.xml or setting.xml. Install and Use the Maven Repository such as: <repositories> <repository> <id>jboss-enterprise-techpreview-group</id> <name>JBoss Enterprise Technology Preview Maven Repository Group</name> <url>http://maven.repository.redhat.com/techpreview/all/</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots>...

How to get some utf-8 characters using hibernate and spring mvc in database?

java,spring,hibernate,spring-mvc,tomcat

first remove this line <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> and this add into header tag <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> then add into web.xml <filter> <filter-name>encoding-filter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value>...

Spring boot war file deploy on Tomcat

tomcat,deployment,spring-boot,war

Just tried this here, and could reproduce the exact same behaviour. As silly as it sounds, most likely you are running your external tomcat under a Java 1.7 JRE (speculation), while having compiled your code against 1.8 (we know this from your pom). Strangely, there is no error, and the...

Meaning of connectionTimeout in tomcat

java,eclipse,tomcat

Taken from here: https://tomcat.apache.org/tomcat-7.0-doc/config/http.html connectionTimeout The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml...

Netbeans project deployment failure

java,tomcat,netbeans,localhost

I have noticed that, I was able to run same project few days back, but not at my workplace. Here, I'm using proxy to access internet. Also, noticed that, it is trying to deploy my project on my LAN ip address. So, I removed my LAN cable and remove proxy...

Wildfly Kafka clients module javax/management/JMException not found

java-ee,jboss,wildfly,kafka

I think you need an additional dependency: <dependencies> <module name="javax.api"/> ... </dependencies> ...

Spring Boot War file gets 404 on ec2

tomcat,amazon-ec2,spring-boot,.war

I've answered a similar question here. You are running your external tomcat under a Java 1.7 JRE, while having compiled your code against 1.8. Strangely, there is no error, and the app appears in the manager app, but then you get a 404 when you're trying to access it. One...

How to use a local tomcat version with maven

java,maven,tomcat

I found a solution here: https://tomcat.apache.org/maven-plugin-trunk/executable-war-jar.html Ex you set the serverXml to point to your local tomcat installation. <project> ... <packaging>war or pom</packaging> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.3-SNAPSHOT</version> <executions> <execution> <id>tomcat-run</id> <goals>...

Disable direct access to application via Tomcat

apache,tomcat

You could consider using the proxy_ajp instead of proxy_http. But you can also use the RemoteAddrValve to define restrictions based on IP address: <Engine name="Catalina" defaultHost="localhost"> ... ... ... <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1"/> ... </Engine> ...

Trying to setup tomcat to use servlets

java,tomcat,servlets,invokerequired

I've just take a quick look up to the book and on page 407, there are the lines that you have to decomment or/else if not exist, add. From the book; <!-- <servlet> <servlet-name>invoker</servlet-name> <servlet-class> org.apache.catalina.servlets.InvokerServlet </servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> --> Anything located in between the "<!--"...

How to use two port numbers for a single java web application?

java,eclipse,tomcat,servlets,port

Find out which tomcat installation eclipse is using. Under your tomcat installation there is a conf/server.xml file. You add a new HTTP connector for the port you desire there and restart tomcat. Now you have tomcat listening to the extra port you added. <Connector port="4121" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />...

Deploye two wars with different domain name but same context-path in same jboss-4.0.3

tomcat,jboss,web-deployment,contextpath

I have added another host vhost2 to server.xml inside folder ${jboss-home}server\default\deploy\jbossweb-tomcat55.sar folder as follows: <Server> <Service name="jboss.web" className="org.jboss.web.tomcat.tc5.StandardService"> <Connector port="8080" address="${jboss.bind.address}" maxThreads="250" strategy="ms" maxHttpHeaderSize="8192" emptySessionPath="true" enableLookups="false" redirectPort="443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"/> <Connector protocol="HTTP/1.1"...

java.lang.AbstractMethodError: org.jboss.arquillian.config.descriptor.impl.EngineDefImpl.getDeploymentExportExploded()Ljava/lang/Boolean;

java,jboss,spock,wildfly-8,jboss-arquillian

The problem was an incompatible version of arquillian library. I've set all arquillian libs at 1.1.8.Final and now it works....

Write a Java Program to connect to HornetQ Messaging Service in Jboss EAP 6.3?

java,jboss,jms,hornetq

Click this jboss link; which contains quickstart program which resolves mentioned problem. 1) Download the code; Import pom.xml of run jboss-helloworld-jms in netbeans. Run clean build. 2) Use this link to resolve maven build problems: Pom not found 3) Following is snippet which used to connect to server private static...

Axis2 keeps generating files in temp folder when running on tomcat

java,tomcat,soap,axis2,axis

This turned out to be caused by a class being constantly re-created which is initializing a new Context on each service call. In a nutshell: The Axis2 (temp files) issue does not reproduce on Axis2 1.5.4. Temp fles are generated only on the creation of a new Axis2 Context. Temp...

Tomcat v7.0 Server at localhost failed to start (Only with specific WebApp)

java,tomcat,tomcat7

Hello You should check your web.xml file because you have 2 servlets DOMServlet and edu.unsw.comp9321.DOMServlet refering to the same url-pattern, if you are not mapping the servlets in the web.xml check in your code the classes anotated with @WebServlet. other important point is that maybe you have a deployed another...

Javamail ClassCastException when sending multipart messages

java,jboss,jax-ws,javamail,classloader

There was a bug in the interaction between JavaMail and JAX-WS. The latest versions of the JDK include a fix for this bug. Upgrade to JDK 1.8, or the latest version of JDK 1.7. A workaround may be to do this after JAX-WS is initialized: MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();...

Valid “protocols” for HornetQ

java,jboss,jms,hornetq

You may want to refer to specific JNDI Reference for specific versions. JBOSS AS 7.2 is covered here: https://docs.jboss.org/author/display/AS72/JNDI+Reference (note that in JBOSS AS 7.x, jnp is no longer supported, older JBOSS versions do support the jnp:// and access via the standard naming services). Another link: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Web_Platform/5/html/Administration_And_Configuration_Guide/Naming_on_JBoss-The_Naming_InitialContext_Factories.html. ...

how to uninstall tomcat from AWS linux?

linux,tomcat,amazon-web-services

sudo yum remove tomcat7 tomcat7-webapps.

Refactoring some legacy camel code, is this code unnecessary or am I missing something?

jboss,apache-camel,jbossfuse

Yes the fabric endpoint has built in load balancing where it round robin among the online endpoints. But it does not have built in redelivery, so if you remove the above, you lose out the maximumFailoverAttempts functionality. But Apache Camel provides general error handler where you can also configure it...

how to manage multiple war application in tomcat server?

java,maven,tomcat,servlets

Use same tomcat server, but copy and rename your web application to something different. For eg, original application name app, copy and rename as following. webapp -> app1 app2 app3 Running tomcat server per each war application need to maintain many server. This is a bad idea....

access tomcat deployed application (aws) by domain name (www.mydomain.com)

tomcat,amazon-ec2,dns,ip

I solved my problem with the help of above answer provide by noname and some google help. As I have unzipped tomcat so, did some env setup as followed- in server.xml changed port 8080 to 80 sudo apt-get authbind. touch /etc/authbind/byport/80. chmod 500 /etc/authbind/byport/80. created setenv.sh in /usr/local/tomcat/bin folder. did...

How to Setup a Docker Tomcat Container on Mac OS X

osx,tomcat,docker

Information: Because Docker only runs on Linux you will need to install some kind of virtual instance on your local machine. An easy and popular way to do that is to install Boot2docker and VirtualBox. VirtualBox is a dependency of Boot2docker. You can download, setup and install the latest versions...

Is there a way to cluster different machines running Tomcat instances

tomcat,amazon-ec2

Confirmed, @sri asked for load balancer in AWS. Please go through the document aws elb Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances in the cloud. It enables you to achieve greater levels of fault tolerance in your applications, seamlessly providing the required amount of...

Each SLF4J log message contains a nested message

java,jboss,slf4j,jboss5.x

I solved it by excluding JBoss version of slf4j. I still have multiple versions of SLF4J, but it seems to work. 2015-06-11 12:30:09,540 ERROR [STDERR] (main) SLF4J: Class path contains multiple SLF4J bindings. To exclude JBoss slf4 I created the file WEB-INF/jboss-deployment-structure.xml with the contents: <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment>...