• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

James embedding

 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I find some James embedding example on this url, Embeddable James, but I don't really get how to relate, the refined MAIN class of author (the args argument) and the servlet code 9inside what args variable has been used).? This is the code of lunchJAMES servlet:


and this is working version of Main with functions that were added or modified :

Is this way of embedding achievable ( I also find some quite obscure means of James embedding in association with Spring) ?>
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This seems to use separate classloaders for James; is that necessary in your case? I'd just drop all the libraries into WEB-INF/lib, and use a context listener to start a background thread that calls the standard main method.
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No of course, it's not necessary but was the only example of embedding James. So, you suggest to copy each libraries from james source (there is few lib. folders containing many libraries. Do I need some particular like phoenix-loader.jar), and in the web.xml ( I'm gonna try to add it into .war apps. to place something like this :


and in the class MyContextListener, to do somthing like this :


Is that what you think?
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it was just ridiculous thought. I try it really I do not get it...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is pretty much exactly what I was thinking of.
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah? But nothing's happens.. I cannot send messages between users (probably because James hasn't started).I wrote this testing listener:


and this mapping ;

When I type address http://www.localhost.com:8080/James_Test/, the Welcome.jsp page would open, and nothing ( I believe that myListener class should be invoked on servletcontext startup, and create instance of Main class. Probably I need to invoke some method of James (like I start it from command line typing run.bat). If so, what is that method?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But nothing's happens


I wouldn't expect anything visible to happen, since James has no GUI.

I cannot send messages between users


What happened when you tried?
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, nothing. I even monitor number of processes when I start server, and no more is added (unlike when I start James by command prompt). However, when I open outlook I get follow error :


It mean, that James hasn't started, i think, because, when I start it by run.bat, I can perform sending/receiving of messages between users.
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more thing. In my application lib-folder, I store only phoenix-xxx.jar, jar files and mx4j-tools.jar. If I include all from JAMES_HOME/lib, and JAMES_HOME/tools, and JAMES_HOME/bin/lib, I continuously receive an exception and failed deployment of application...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I even monitor number of processes when I start server, and no more is added (unlike when I start James by command prompt).


The number of processes wouldn't change, because it runs inside the JVM (which is just one process).

The connection to the server has failed. Account: '127.0.0.1', Server: '127.0.0.1', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E


Not sure what that's trying to tell us, but it sure doesn't look good. But "Account: '127.0.0.1'" looks particularly strange, as if the code were using "127.0.0.1" for the username.

In my application lib-folder, I store only phoenix-xxx.jar, jar files and mx4j-tools.jar. If I include all from JAMES_HOME/lib, and JAMES_HOME/tools, and JAMES_HOME/bin/lib, I continuously receive an exception and failed deployment of application...


I'd expect all jar files to be needed; if there are exceptions I'd start by tracking those down. It's possible that there are version conflicts with other jar files your code -or the servlet engine- uses.

You could also make this a separate web app, independent of the one that runs your other application code.
 
Goran Markovic
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, 127.0.0.1, was name of account nothing special. I have change it. I've delete applications from Tomcat's deployment directory, so this is the only. There is something wrong about some arguments, and excalibur.jar I have nowhere on my classpath. I just have configured PHOENIX_HOME environment variable. This is the stack trace ;
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic