Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

RMI + TomCat = Problem

Thread view: 
Snyke - 28 Dec 2005 20:06 GMT
As I said before,
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/0a
a1cbaf1c5eca75/6f16b023abc2100e#6f16b023abc2100e

I'm currently developing a large application which has two main
components. They communicate each other with RMI. As a logging API I'm
using Log4J which is really nice for its ease of use, but I recently
came across a real Problem: when starting tomcat it crashes when trying
to register a Listener I wrote that should connect to the RMI-Registry:

----- PersistenceListener -----
/**
* PersistenceListener.java created on Dec 14, 2005
*
*  This program is free software; you can redistribute it and/or
modify
*  it under the terms of the GNU General Public License as published
by
*  the Free Software Foundation.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307  USA
*/
package net.sf.ww2.persister;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;

import javax.servlet.*;

import org.apache.log4j.Logger;

/**
* @author Christian 'Snyke' Decker
*/
public class PersistenceListener implements ServletContextListener  {
       PersistenceSession session = null;
       public PersistenceListener() {
               super();
               // TODO Auto-generated constructor stub
       }

       public void contextInitialized(ServletContextEvent arg0){
               try {
                       if (System.getSecurityManager() == null) {
                   System.setSecurityManager(new
RMISecurityManager());
               }

try{System.getSecurityManager().checkConnect("localhost",1099);}catch(SecurityException
se){

Logger.getLogger("Frontend").fatal("Cannot connect to RMI
Server!");
                       }
                       String name = "//127.0.0.1/Persister";
                       session =
(PersistenceSession)Naming.lookup(name);

arg0.getServletContext().setAttribute("Persister",session);
               } catch (MalformedURLException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               } catch (RemoteException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               } catch (NotBoundException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }
       }

       public void contextDestroyed(ServletContextEvent arg0) {
               // TODO Auto-generated method stub

       }

}

------ eof -----

This fails upon TomCat startup, with a Permission Error (resolve and
connect 127.0.0.1) which is solved usually by setting the right policy
but I have no idea at all where to place the policy and what
Permissions to aply. The class name is
net.sf.ww2.persister.PersistenceListener while the two Classes (remote
and local) are net.sf.ww2.persister.PersistenceSession and
net.sf.ww2.persister.PersistenceSessionImpl.
What would the policy file look like and where do I have to put it?
Snyke - 29 Dec 2005 16:54 GMT
No idea, anyone?
Snyke - 30 Dec 2005 17:50 GMT
Sorry if I insist but I need this...
Luc The Perverse - 30 Dec 2005 23:53 GMT
> Sorry if I insist but I need this...

Have you considered a pay service?

--
LTP

:)
IchBin - 31 Dec 2005 00:42 GMT
>> Sorry if I insist but I need this...
>
[quoted text clipped - 4 lines]
>
> :)

If I remember correctly, Tomcat has a user group you can post questions
there about your situation.

gmane.comp.jakarta.tomcat.user

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.