Re: Transfer all HttpSessions from one cluster node to another

2009-02-11 Thread nlif

Filip,

I've got a basic implementation of this. Since I didn't want to change
Tomcat code, this is not the most elegant design. 

Here's what I've done:

I created a ManualFailoverManager class, which extends StandardManager. This
is a copy of the BackupManager, with these changes:

1) In the requestCompleted() method, I don't replicate the session.
2) In the start() method I replaced the LazyReplicatedMap with my own class:
ManualReplicatedMap.
3) I added a public, JMX exposed, method: failover() which simply calls
replicateAllSessions() in ManualReplicatedMap (see below).

I created a ManualReplicatedMap class, which extends LazyReplicatedMap, with
the following changes:

1) In publishEntryInfo() I simply return an empty Member array.
2) I added a method: replicateAllSessions() that does this:

Member[] allOthers = getMapMembersExcl(wrap(channel.getLocalMember(false)));

for (Object key : keySet()) {
  MapEntry entry = (MapEntry) super.getInternal(key);
  entry.setBackupNodes(allOthers);
  /*
   * publish the data out to all nodes, as BACKUP.
   */
  MapMessage msg = new MapMessage(getMapContextName(),
  MapMessage.MSG_BACKUP, false, (Serializable) key,
  (Serializable) entry.getValue(), null,
channel.getLocalMember(false),
  allOthers);

  try {
getChannel().send(getMapMembers(), msg, getChannelSendOptions());
  }
  catch (ChannelException e) {
log.error(Unable to replicate backup key: + key + . Reason:
+ e.getMessage(), e);
  }
}

I'd be happy to get your feedback.

Moreover, there are a couple of points I am concerned about, which I'd be
happy to hear you thoughts on: 

I ended-up replicating to all other nodes in the cluster because I couldn't
think of a way to ensure that requests that were previously directed to Node
X will now be redirected to Node Y. Assuming I've got a load-balancer that
uses sticky-sessions, I still need a way to tell it to replace node X with
node Y. Since I am not sure that's possible, I had to replicate to all
nodes, so, whichever node gets the request, it can serve it. 

The question is - what is the status of all the session copies that end up
unused?

Another issue, is that of a possible race-condition during the replication
itself: I intend to replicate all sessions from Node X, remove it from the
load-balancer, and then shut it down. In that order. But what if while
replicating, a request comes in and changes the session being replicated?
Does tribes protect against that?

Alternatively, switching the order, and first removing Node X from the
load-balancer, and only then replicating, exposes me to the chance that a
request will come in to Node Y, which is the backup-to-be of the session,
while the session is not yet fully replicated. Again, does tribes handle
that?

Naaman
-- 
View this message in context: 
http://www.nabble.com/Transfer-all-HttpSessions-from-one-cluster-node-to-another-tp21649886p21953141.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: No URL rewriting when cookies are disabled

2009-02-08 Thread nlif

Yep, that was it exactly... I've been spoiled by frameworks :)
I did some experimentation myself, and dug a little in framework code, and
indeed, this has been taken care for me in the past, and I assumed it's done
by Tomcat (or any servlet container, for that matter), but it isn't.

Thanks,
Naaman



Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 André,
 
 André Warnier wrote:
 Actually, I was just perusing a page in the Tomcat 6 docs :
 http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
 
 and it actually says, for the cookies attribute :
 Set to true if you want cookies to be used for session identifier
 communication if supported by the client (this is the default). Set to
 false if you want to disable the use of cookies for session identifier
 communication, and rely only on URL rewriting *by the application*.
 
 André has the answer right here (though without details).
 
 In order to get your application to rewrite URLs, you need to pass every
 single outgoing URL through the HttpServletResponse.encodeURL method (or
 HttpServletResponse.encodeRedirectURL if you are using a redirect).
 
 I've found that this is detail is often overlooked in web applications.
 Most JSP tag libraries and things like that do this transparently, so
 you may not have even been aware that it was a requirement.
 
 Good luck reviewing all that code ;)
 
 - -chris
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iEYEARECAAYFAkmLdjcACgkQ9CaO5/Lv0PD8cQCeKvrnDjZvNJTrXCcXuzOKUeSt
 +2YAoKYSCgXVEzLMhSFFk309g0OhO8kP
 =SKW6
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/No-URL-rewriting-when-cookies-are-disabled-tp21854081p21896827.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Transfer all HttpSessions from one cluster node to another

2009-01-28 Thread nlif

Thanks, Chris,

Yes, this is an option, but we prefer being able to offload session at will.
However, if that proves to be too difficult to do, we may settle for the
behavior you describe.

Naaman




Christopher Schultz-2 wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Nilf,
 
 nlif wrote:
 We intend to run in a cluster, with stickiness enabled, and without
 replication. This of course does not give us failover capabilities, in
 case
 of a server crash, but it is sufficient for our needs. 
 
 However, we would like to be able to transfer all sessions currently on
 one
 node, to another node, when we are about to shutdown a server for
 maintenance.
 
 Would it be acceptable to slowly siphon-off all traffic to the server
 you are taking out of service? If so, you can instruct mod_jk to take
 the to-be-removed server out of the pool for new visitors, and simply
 wait for the existing users to eventually die off. Then you can take
 that server out of service and re-join it to the cluster, later.
 
 The advantage of this technique is that it is available /right now/
 without any further infrastructure. The disadvantage, of course, is that
 you can't really do it on-demand: you have to wait for users to die off
 before you can take the server out of service (unless you just kill the
 last few stragglers).
 
 - -chris
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iEYEARECAAYFAkl/yQMACgkQ9CaO5/Lv0PBSMQCeIjFOV9+H9csskzn9b2JgBVLZ
 npIAoL2HjVaAHHDoiZLHYkfgo3HUURRA
 =Zq0K
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Transfer-all-HttpSessions-from-one-cluster-node-to-another-tp21649886p21701502.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Transfer all HttpSessions from one cluster node to another

2009-01-28 Thread nlif

Filip,

Thanks. If you could elaborate some more, then maybe I can go ahead and
implement this, and I'd be happy to send you the result, so you can use it
and save yourself some of the work.

Naaman



Filip Hanik - Dev Lists wrote:
 
 nlif wrote:
 Hi all,

 We intend to run in a cluster, with stickiness enabled, and without
 replication. This of course does not give us failover capabilities, in
 case
 of a server crash, but it is sufficient for our needs. 

 However, we would like to be able to transfer all sessions currently on
 one
 node, to another node, when we are about to shutdown a server for
 maintenance. This is different from the default behavior of
 session-replication, in that it only happens when we trigger it (e.g. via
 JMX), and with us specifying the source node and destination node.

 Is this supported?
 Has anyone done such a thing?
   
 hi Naaman, while this feature is not currently in place, it's something 
 that has been brewing in the back of my head for a long time.
 It is an extremely useful feature, and its just a matter of time for me 
 to get it implemented.
 
 The simplest way would be to start with the BackupManager, but simple 
 remove the nr of backup nodes and therefore not replicate.
 And then simply implement a move sessions during a graceful shutdown.
 
 Filip
 I would appreciate any tips.

 Thanks,
 Naaman
   
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Transfer-all-HttpSessions-from-one-cluster-node-to-another-tp21649886p21701505.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Transfer all HttpSessions from one cluster node to another

2009-01-25 Thread nlif

Hi all,

We intend to run in a cluster, with stickiness enabled, and without
replication. This of course does not give us failover capabilities, in case
of a server crash, but it is sufficient for our needs. 

However, we would like to be able to transfer all sessions currently on one
node, to another node, when we are about to shutdown a server for
maintenance. This is different from the default behavior of
session-replication, in that it only happens when we trigger it (e.g. via
JMX), and with us specifying the source node and destination node.

Is this supported?
Has anyone done such a thing?

I would appreciate any tips.

Thanks,
Naaman
-- 
View this message in context: 
http://www.nabble.com/Transfer-all-HttpSessions-from-one-cluster-node-to-another-tp21649886p21649886.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



How to serve two docBases under the same context path

2008-10-23 Thread nlif

Hi all,

I am using Tomcat 6, and I have the following problem:

I am trying to separate the static content from the dynamic content of my
application. In production, I intend to use Apache to serve the static
content, and Tomcat to process requests to the application (mainly JSP's).
This can be accomplished by writing a deployment script that will copy
everything to its repsective place.

My problem, however, is with the development environment:

The static-content (css,js,images,html) is in one SVN project, and the
dynamic (JSP,WEB-INF,classes) is in another. Thus, on my local workspace,
they are on separate paths (e.g. c:\workspace\static and
c:\workspace\webapp). Now, I need some way to have Tomcat serve them as a
single context.

I thought I'd create two context elements in my server.xml file, but they
will need to have the same PATH, like this:

Context docBase=workspace\static path=/myapp/ 
Context docBase=workspace\webapp path=/myapp/

Unfortunately, it is illegal to have two CONTEXT elements with the same PATH
value.

-- 
View this message in context: 
http://www.nabble.com/How-to-serve-two-docBases-under-the-same-context-path-tp20132698p20132698.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to serve two docBases under the same context path

2008-10-23 Thread nlif


Theoretically, maybe, but in real-life heavy-duty production environments, I
believe using Apache as a front to Tomcat has advantages, in areas as
security, load-balancing, caching and scalability.
Furthermore, the production architecture is not the issue here, as I've
explained in my original post. The problem stems from the decision to
separate the web-app and static-content to two projects in SVN, and this is
due to the fact that different people maintain them. 

Thanks anyway.


Caldarale, Charles R wrote:
 
 From: nlif [mailto:[EMAIL PROTECTED]
 Subject: How to serve two docBases under the same context path

 In production, I intend to use Apache to serve the static
 content, and Tomcat to process requests to the application
 
 Why are you wasting your time, energy, and resources to do that?  Tomcat
 is just as capable as httpd when it comes to handling static content.
 
  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete the e-mail
 and its attachments from all computers.
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-serve-two-docBases-under-the-same-context-path-tp20132698p20135565.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to serve two docBases under the same context path

2008-10-23 Thread nlif


Should my dev and prod environments be identical? Really? So you deploy your
source files? :-)
 This is one of many cases in which the development environment does not
match the production environment. And as I explained in my other post, not
using Apache will not change my problem. 




Hassan Schroeder-2 wrote:
 
 On Thu, Oct 23, 2008 at 7:56 AM, nlif [EMAIL PROTECTED] wrote:
 
 I am trying to separate the static content from the dynamic content of my
 application. In production, I intend to use Apache to serve the static
 content, and Tomcat to process requests to the application (mainly
 JSP's).
 
 My problem, however, is with the development environment:
 
 I'd say you should either forget about using Apache httpd altogether
 or make your dev environment match production.
 
 FWIW,
 -- 
 Hassan Schroeder  [EMAIL PROTECTED]
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-serve-two-docBases-under-the-same-context-path-tp20132698p20135720.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem serializing JDK dynamic proxies

2008-04-06 Thread nlif

Hi Chris,

Thanks for the link. I found the following workaround: instead of placing my
Proxy object in the HttpSession, I put it in a serializable wrapper class
first, and then put the wrapper in the HttpSession. The wrapper overrides
the default de-serialization to set a different class-loader as the
thread-local class-loader. Now, session replication completes without
throwing the exception. 

Here is the code of the Wrapper:

public class ProxyWrapper implements Serializable
{
private Object Proxy;

public ProxyWrapper(Object proxy)
{
Proxy = proxy;
}

public Object getProxy()
{
return Proxy;
}

private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();

try
{
ClassLoader myCl = this.getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(myCl);
in.defaultReadObject();
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
}
}
}

IMHO, this, as well as the dynamic-proxy documentation, implies there is a
problem in Tomcat's session-replication implementation.


Naaman
-- 
View this message in context: 
http://www.nabble.com/Problem-serializing-JDK-dynamic-proxies-tp16467407p16521737.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem serializing JDK dynamic proxies

2008-04-03 Thread nlif

Hi all,

I am using Tomcat 6, and running in a cluster, with session-replication.
When I put in the session a JDK dynamic proxy, the serialization fails, like
so:

Apr 3, 2008 2:09:24 PM org.apache.catalina.ha.session.DeltaManager
messageReceived
SEVERE: Manager [localhost#/users]: Unable to receive message through TCP
channel
java.lang.ClassNotFoundException: app.web.user.TestBean
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
java.io.ObjectInputStream.resolveProxyClass(ObjectInputStream.java:676)
at
java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1531)
at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at
org.apache.catalina.ha.session.DeltaRequest$AttributeInfo.readExternal(DeltaRequest.java:361)
at
org.apache.catalina.ha.session.DeltaRequest.readExternal(DeltaRequest.java:255)
at
org.apache.catalina.ha.session.DeltaManager.deserializeDeltaRequest(DeltaManager.java:619)
at
org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1363)
at
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1320)
at
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1083)
at
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:87)
at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:916)
at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:897)
at
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:264)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
at
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
at
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
at
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:185)
at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:88)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

Here is the relevant code:

The servlet:

TestBeantestBean  = new TestBeanImpl();
Class[] proxiedInterfaces = testBean.getClass().getInterfaces();
ClassLoader classLoader   =
Thread.currentThread().getContextClassLoader();
TestProxy   proxy = new TestProxy(testBean);
TestBeanproxiedBean   = (TestBean)
Proxy.newProxyInstance(classLoader, proxiedInterfaces, proxy);

request.getSession().setAttribute(testBean, proxiedBean);

The TestBean interface:

public interface TestBean {
 public void op1();
}

The TestBeanImpl class:

public class TestBeanImpl implements TestBean, Serializable
{
public void op1()
{
System.out.println(doing op1);
}
}

The TestProxy class:

   public class TestProxy implements InvocationHandler, Serializable
{
private static final long serialVersionUID = 1L;
private Object target;

public TestProxy(Object target)
{
this.target= target;
}

public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable
{
System.out.println(proxy invoked);
return method.invoke(target, args);
}
}

My application is deployed as a WAR file.

Has anyone been able to put proxies in the HttpSession and replicate
successfully?
Is this a Tomcat bug?
Is 

Re: Problem serializing JDK dynamic proxies

2008-04-03 Thread nlif


Christopher Schultz-2 wrote:
 
 
 This doesn't look like the proxy is failing; it looks like the TestBean
 class is not available to the receiving Tomcat instance. This happens on
 the /other/ Tomcat, right (i.e. not the one where the object was put
 into the session)?
 
 Are you sure you put your test class on all of the servers?
 
 

Yes. I am sure. It's there, and this happens either when replicating from
Node A to Node B or the other way around. 

-- 
View this message in context: 
http://www.nabble.com/Problem-serializing-JDK-dynamic-proxies-tp16467407p16484982.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Interacting with an embedded Tomcat

2007-08-29 Thread nlif

Hi,

If I run Tomcat as embedded, is it possible for the application that
contains Tomcat to interact with web-apps that run inside that Tomcat? For
example, the external application, in addition to starting the embedded
Tomcat, also manages other services, and the web-apps that runs inside the
embedded Tomcat need to use those services. How can this be done?

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12381880
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interacting with an embedded Tomcat

2007-08-29 Thread nlif

Hmm, I guess I did not explain myself very well...

I have an application, that acts as bootstrap: it creates and initializes
various services, which provide a Java API to resources such as database,
file-system, and native libraries. In addition, I want that bootstrap
application to start an embedded tomcat, in which my web application will
run. Thus, *everything* is in the same process. The question was, how can I
pass Java references from the bootstrap application to the web-apps in side
the embedded Tomcat. 

I hope this makes it clear.

I assume the Tomcat embedded APIs provide some way to pass a reference into
the web-app contexts that are deployed in that Tomcat. I've never worked
with Tomcat as embedded, and frankly, I can't seem to find documentation or
code-samples for it. If anyone can point me to anything, I'd appreciate it.

Thanks again.





OFFICIAL WEBSITE wrote:
 
 If I understand correctly, external applications were started on one JVM
 and the tomcat is on another JVM, started separately or by the external
 application itself.
 
 Two JVMS running on on machine have nothing in common other than system
 resources. Open a serversocket at a named port on the external
 application and let the tomcat applications from webapps connect to it
 and exchange sweet talk on a mutually agreed protocol.
 
 
 On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
 Hi,
 
 If I run Tomcat as embedded, is it possible for the application that
 contains Tomcat to interact with web-apps that run inside that Tomcat?
 For
 example, the external application, in addition to starting the embedded
 Tomcat, also manages other services, and the web-apps that runs inside
 the
 embedded Tomcat need to use those services. How can this be done?
 
 Thanks in advance.
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Interacting with an embedded Tomcat

2007-08-29 Thread nlif

Thanks very much. Maybe that's the way. I'll give it a try.

Naaman




Sonal Goyal wrote:
 
 Hi,
 
 I am assuming you are calling createContext() on the
 org.apache.catalina.startup.Embedded object. Do you think calling
 org.apache.catalina.Context.getServletContext() and then setAttribute on
 the
 returned ServletContext will help?
 
 Just a thought. Do let me know if it makes sense.
 
 Sonal
 
 
 
 On 8/29/07, nlif [EMAIL PROTECTED] wrote:


 Hmm, I guess I did not explain myself very well...

 I have an application, that acts as bootstrap: it creates and initializes
 various services, which provide a Java API to resources such as database,
 file-system, and native libraries. In addition, I want that bootstrap
 application to start an embedded tomcat, in which my web application will
 run. Thus, *everything* is in the same process. The question was, how can
 I
 pass Java references from the bootstrap application to the web-apps in
 side
 the embedded Tomcat.

 I hope this makes it clear.

 I assume the Tomcat embedded APIs provide some way to pass a reference
 into
 the web-app contexts that are deployed in that Tomcat. I've never worked
 with Tomcat as embedded, and frankly, I can't seem to find documentation
 or
 code-samples for it. If anyone can point me to anything, I'd appreciate
 it.

 Thanks again.





 OFFICIAL WEBSITE wrote:
 
  If I understand correctly, external applications were started on one
 JVM
  and the tomcat is on another JVM, started separately or by the external
  application itself.
 
  Two JVMS running on on machine have nothing in common other than system
  resources. Open a serversocket at a named port on the external
  application and let the tomcat applications from webapps connect to it
  and exchange sweet talk on a mutually agreed protocol.
 
 
  On Wed, 2007-08-29 at 00:05 -0700, nlif wrote:
  Hi,
 
  If I run Tomcat as embedded, is it possible for the application that
  contains Tomcat to interact with web-apps that run inside that Tomcat?
  For
  example, the external application, in addition to starting the
 embedded
  Tomcat, also manages other services, and the web-apps that runs inside
  the
  embedded Tomcat need to use those services. How can this be done?
 
  Thanks in advance.
 
 
  -
  To start a new topic, e-mail: users@tomcat.apache.org
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12382936
 Sent from the Tomcat - User mailing list archive at Nabble.com.


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 Thanks and Regards,
 Sonal
 
 

-- 
View this message in context: 
http://www.nabble.com/Interacting-with-an-embedded-Tomcat-tf4346090.html#a12387467
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]