• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Setup multiple domains in workers.properties and server.xml

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to setup 2 different domains (created in Weblogic server) by using Apache Tomcat and Apache Web server. So I created the following files (I'm on Ubuntu):

#/etc/apache2/workers.properties:


#/etc/apache2/mods-available/jk.conf - just modified the following line to point to my workers.properties file:


#/etc/apache2/conf/josso/httpd.conf


The modifications to fin my customized httpd.conf file
#/etc/apache2/apache2.conf


And finally the modifications in Apache Tomcat
#/my/tomcat_installation/folder/conf/server.xml


I can access to my first domain without problem at localhost/altairetab.
But when I try to access to another one at localhost/altaircand, it fails. Any idea what is wrong in my configuration?

Thank you.
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am confused. You are defining 2 application contexts (NOT domains) in Apache httpd. You tunnel both of them to Tomcat via mod_jk pipes. What does WebLogic have to do with any of this?
 
Serguei Cambour
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Me too. . That's why I'm asking - to figure out how to connect 2 Weblogic's domains via Apache HTTP to another app (deployed war) in Tomcat.
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A domain in Internet terms isn't something attached to an application server. A domain refers to one or more physical and/or virtual machines (OS instances). Within each domain there are hostnames, which resolve to 1 or more IP addresses. For example, in the code.com domain, the hostname www resolves to 204.144.184.130. Which is either a physical server box, a virtual machine instance or perhaps a load-balancing appliance. At some point in the process, however, the IP address will be routed to some specific OS instance.

An OS instance can have many server programs listening on many ports. For example, WebLogic could be listening in on 7070, Apache httpd on 80 and 443, and you might even have 2 Tomcats on 8080,8443 and 8180,8543 (I've simplified the list of ports for illustration).

That doesn't mean that there's an "Apache domain", a "WebLogic domain" or one or more "Tomcat domains". It means that on server "www" within the coderanch.com that there are processes owning these specific ports. The string "www.coderanch.com", incidentally, is known as the machine's Fully-Qualified Domain Name (FQDN), as opposed to its simple domain hostname (www).

So the idea of setting up "WebLogic domains" in Apache+Tomcat doesn't make sense. There's no such thing as a WebLogic domain.

WebLogic does define a term "WebLogic Domain", but that's just a bunch of servers within a single control group defined by and for WebLogic. In other words, it's an "administrative domain", not an Internet domain. And, as such, it does not have any interaction with non-WebLogic applications like Tomcat.
 
Serguei Cambour
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It becomes a little bit clearer, thanks for your explications. It is true about Weblogic domains, I created 2 via the Weblogic console (dom1 and dom2, for example). For dom1 I put the port 10593 and for the dom2 I put 10594. As a result, I got 2 separate 'folders' with the same domain names (dom1 and dom2) located on my hard disk that contained a lot of server-specific files with startWeblogic.sh for every domain inside. So wneh starting startWeblogic.sh from inside of one of the domain (e.g. dom1), I could access it at localhost:10593/dom1. The same was true for dom2.
Now for the Tomcat issue. A WAR was deployed to Tomcat server with specific functions. To use it I started to search how to use mod_jk connector of Apache HTTP server. Here is where it becomes really dark and froggy for me. I downloaded the corresponding Weblogic module (mod_wl.so) and copy-pasted it into /usr/lib/apache2/modules. Then comes workers.properties file to be configured. And at least context.xml and server.xml files in TOMCAT_HOME folder. I hoped to access to one of the domains I created in Weblogic before at localhost/dom1 or localhost/dom2.
I think I messed a lot of things here as have no real idea how all these things should be linked together.

Regards
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. I'm not totally clear myself, but here's some info that should help.

When a client sends a web request, that request targets a specific domain host and port. For example, www.coderanch.com:8080. "Normal" URLs don't specify the port, since it's assumed based on the protocol (80 for http, 443 for https, and so forth).

What I think you are actually looking to do is use one Apache HTTP server to front both a WebLogic Domain and 2 Tomcat webapps. The WebLogic webapps run under the WebLogic Domain, and the apache weblogic module is (I think) designed to facilitate that. Basically, the WebLogic Domain is a cluster, where the request comes into Apache, is then routed to the WLD (WebLogic Domain), and the WLD then passes it on to one of the WebLogic servers in the WLD (cluster). Tomcat doesn't figure into that process.

J2EE web applications are architected with the idea that a single J2EE server can host multiple unrelated web applications (WARs or EARs). To facilitate this, a URL destined for a J2EE server thus contains additional information that tells the J2EE server which webapp will actually receive and process the incoming URL request. This is known as the "context name", and in your case, the context names are "altaircand" and "altairetab". Thus, they are either dropped in under those WAR names into Tomcat OR they are deployed using a Tomcat Context descriptor that associates the actual WAR with those context names.

Actually, I think your real context names are "cand" and "retab", but I'd have to refresh my memory on JkMount (I use mod_proxy).

Regardless, Apache is your front end, so what you want to do is configure its URL rewriting and proxying rules so that when URL "X" comes in, it gets properly tunneled over to the appropriate Tomcat webapp "Y". Apache is very flexible on this, so you can pretty much choose any scheme you want as long as you have no ambiguities in the translation process that would make it difficult for Apache to figure out where to route the request.

Given all that, what looks like your major problem is that you are using SetHandler to route /altaircand and /alteretab URLS to WebLogic servers. You wouldn't do that if you want those contexts to route to Tomcat. A simple JkMount is all that would be required.

If you are doing a mix-and-match (for example, Tomcat app, but getting static content such as CSS and JavaScript from WebLogic) then you'd need to further refine the URL mappings in Tomcat Apache so that the URL will route properly depending on its intended target. For sanity's sake, it's probably a good idea to not use the same basic context name for both Tomcat and WebLogic apps.

Also, if you do want to draw static resources from somewhere other than Tomcat, it's actually probably better to put them under direct management by Apache itself, not WebLogic. That way you can define them site-wide in a consistent manner for all apps, regardless of the actual backend server. Plus the overhead is almost certainly going to be less.

And just in case someone in the shop hasn't received the word yet, the old rule that Tomcat isn't a good server for static content has been untrue for probably more than 10 years now.
 
Serguei Cambour
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What I think you are actually looking to do is use one Apache HTTP server to front both a WebLogic Domain and 2 Tomcat webapps.


True, but I have 2 Weblogic domains (WLD) [no one is clustered] and one Tomcat webapp using Josso war. Apache HTTP is used in front.

hus, they are either dropped in under those WAR names into Tomcat OR they are deployed using a Tomcat Context descriptor that associates the actual WAR with those context names.


I dropped 2 wars (altaircand and altairetab) into corresponding WLD via WL console.
As for the rest - it is more or less true as well. So I re-rise my question, - what should/could I remove and from which files to make it work ?

Thanks a lot.
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the WAR is dropped (deployed) into a WLS server, it's isn't a Tomcat webapp. If, on the other hand, you drop it into a Tomcat server, it isn't a WebLogic webapp. If you drop the same WAR into both, you should really think seriously about how your WARs are designed.

Apache doesn't really care which option you take, but the configuration for stuff routed to Tomcat and the configuration for stuff routed to WLS (whether via WLD or not) are 2 different and unrelated things with no interactions between them.
 
Serguei Cambour
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat contains only one war that implements Josso functionality.
As I said, after creating each WLD, I have deployed the corresponding war (altaircand.war and altairetab.war) correspondingly to each of them.
As far I understood, I understood nothing in all that stuff . I don't even understand why not to use the war deployed in Tomcat directly in the 2 WLD ?
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each WLS instance and the Tomcat instance are separate WAR instances. Even if you share the same code, they all run under different JVM instances, and therefore do not share data in RAM. Outside of shared sessions in clusters, therefore, the only way that they can communicate is by doing inter-JVM connections. That is, via RMI, JMS, HTTP requests from one webapp to another webapp, or similar channels.

So even if you copy the same WAR to multiple servers, it isn't the same webapp. And each webapp has its own configuration specific to the type of server that it is deployed in.

 
This tiny ad is suggesting that maybe she should go play in traffic.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic