Tomcat & RMI

Hi,
I'm new in rmi.
I'm tring to run this: http://java.sun.com/docs/books/tutorial/rmi/running.html
I have one computer:
server side: Tomcat = port 80
c:\Tomcat\webapps\rmi\WEB-INF\classes\compute.jar
c:\Tomcat\webapps\rmi\WEB-INF\classes\ComputeEngine.class
c:\Tomcat\webapps\rmi\WEB-INF\classes\server.policy
c:\Tomcat\webapps\rmi\WEB-INF\classes\client\Pi.class
client side:
D:\MyJava\RMI\compute.jar
D:\MyJava\RMI\client.policy
D:\MyJava\RMI\engine\ComputeEngine.class
D:\MyJava\RMI\compute\compute.class
D:\MyJava\RMI\compute\task.class
D:\MyJava\RMI\client\Pi.class
D:\MyJava\RMI\client\ComputePi.class
server.policy:
grant codeBase "file:/c:/MyJava/RMI/"  {
     permission java.security.AllPermission;
};client.policy:
grant codeBase "file:/c:/MyJava/RMI/" {
    permission java.security.AllPermission;
};CLASSPATH in my computer:
D:\Programs\Java\jdk-1_5_0_08\bin;
C:\Tomcat\webapps\rmi\WEB-INF\classes\compute.jar;
I'm runing this:
start rmiregistry
java -cp D:\MyJava\RMI;c:\Tomcat\webapps\rmi\WEB-INF\classes\compute.jar
-Djava.rmi.server.codebase=file:/c:/Tomcat/webapps/rmi/WEB-INF/classes/compute.jar
-Djava.rmi.server.hostname=localhost
-Djava.security.policy=c:\Tomcat\webapps\rmi\WEB-INF\classes\server.policy engine.ComputeEngine
I get this error:
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
And in this link write:
"Before you execute rmiregistry, you must make sure that the shell or window in which you will run rmiregistry either has no CLASSPATH environment variable set or has a CLASSPATH environment variable that does not include the path to any classes that you want downloaded to clients of your remote objects. "
I have one computer for server & client..
Thank's alotttt
Yael

Hi,
The server is running good to me now, but I get error in the client runing:
java -cp D:\MyJava\RMI;c:\Tomcat\webapps\rmi\WEB-INF\classes\compute.jar
     -Djava.rmi.server.codebase=file:/c:/Tomcat/webapps/rmi/WEB-INF/classes/
     -Djava.security.policy=client.policy
     client.ComputePi localhost 45java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
this line:
Compute comp = (Compute) registry.lookup(name);
package client;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.math.BigDecimal;
import compute.Compute;
public class ComputePi {
    public static void main(String args[]) {
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new SecurityManager());
        try {
            String name = "Compute";
            Registry registry = LocateRegistry.getRegistry(args[0]);
            Compute comp = (Compute) registry.lookup(name);
            Pi task = new Pi(Integer.parseInt(args[1]));
            BigDecimal pi = comp.executeTask(task);
            System.out.println(pi);
        } catch (Exception e) {
            System.err.println("ComputePi exception:");
            e.printStackTrace();
}Could you show me what to write please? I'm new in this topic.
Yael

Similar Messages

  • RMI issue with Tomcat

    Hi All,
    I have an RMI system, that in command line works perfectly, as expected. However, I have transferred my Client to Servlet and am running it though Tomcat. Now when ever I try and invoke a remote method I receive an error message.
    The error is generated as a result of catch statement for the following:
    server = (Server)Naming.lookup(fullname);I know the Client code is being evaluated as it generates the HTML error message from the catch. Using a System.out.println and the Tomcat log files I caught the error and wrote it to a log file. It was as follows:
    Caught an exception doing name lookup on rmi://localhost/Bank-Server: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.lang.ClassNotFoundException: ServerImpl_Stub (no security manager: RMI class loader disabled)
    Caught an exception doing name lookup on rmi://localhost/Bank-Server: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
         java.net.ConnectException: Connection refused: connect
    Caught an exception doing name lookup on rmi://localhost/Bank-Server: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
         java.net.ConnectException: Connection refused: connect
    Caught an exception doing name lookup on rmi://localhost/Bank-Server: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
         java.net.ConnectException: Connection refused: connect
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.lang.ClassNotFoundException: ServerImpl_Stub (no security manager: RMI class loader disabled)
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.lang.ClassNotFoundException: ServerImpl_Stub (no security manager: RMI class loader disabled)
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
         java.lang.ClassNotFoundException: ServerImpl_Stub (no security manager: RMI class loader disabled)I can see from the error that it might have something to do with a security manager? I have read a little about it and when running the security manager a special command needs to be entered at runtime to invoke the policy? How on earth is this done in a Web application situation?

    Connection refused: connectIt could be some configuration problem.

  • Problems with RMI tutorials using Tomcat 4.1.24

    Hi
    I have some problem when I try the rmi Hello example tutorial (http://java.sun.com/j2se/1.4.2/docs/guide/rmi/getstart.doc.html)
    When I start rmi server as follows:
    java -Djava.rmi.server.useCodebaseOnly=true -Djava.security.policy=file:E:\Rmi\Hello\mysrc\bin\policy.policy -Djav
    a.rmi.server.codebase=http://127.0.0.1/classes/ examples.hello.HelloImpl
    I got the following errors:
    HelloImpl err: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
    at java.net.Socket.connect(Socket.java:420)
    at java.net.Socket.connect(Socket.java:376)
    at java.net.Socket.<init>(Socket.java:291)
    at java.net.Socket.<init>(Socket.java:119)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at examples.hello.HelloImpl.main(HelloImpl.java:67)
    I have granted all permission in the policy file. I have put all the classes in a subfolder call classes just after the Root directoy Can someone enlighten me. Thanks.

    i don't know if it helps but i had the following problem:
    an rmi-component software plus a servlet contacting the system.
    and rmi from the servlet in tomcat did not seem to work ...
    java.rmi.MarshalException: error marshalling arguments; nested exception is:
         java.net.SocketException: Software caused connection abort: socket write error
         at sun.rmi.server.UnicastRef.invoke(Unknown Source)
         at net.metamagix.essence.Agents.DataAgentI_Stub.storeObjects(Unknown Source)
         at net.metamagix.essence.CAgents.ParameterSaviour.save(ParameterSaviour.java:1556)
    finaly i changed back to tomcat 4.0.x but it still was not any better, when i found out that most of the problems resulted from pathnames...
    tomcat 4.1.24 had a problem with pathnames getting too long (2k on win 2000) and tomcat 4.0 produced errors because of the blank in it's path name "Tomcat 4.0" so i made a new installation with C:\Tomcat4 as home directory and - what a surprise - things turned out fine and rmi worked.

  • Invoking RMI using Tomcat

    Hello
    i have a question but i do not know how to solve it.
    i tried to implement a small Client and Server RMI standalone application and is working fine.
    However know I would like to change the implementation and use Tomcat as the Server for the application.
    i have implemented this and it does not work and i have no idea why..
    i have a feeling i don't know how RMI works and I am turning if someone has an example of how to do it in Tomcat.
    my sample implementation is below:
    HelloWorldServer
    public class HelloWorldServer extends UnicastRemoteObject implements HelloWorld {
         private static final long serialVersionUID = 1128707054026502754L;
         public HelloWorldServer() throws RemoteException {
              super();
         public String helloWorld() {
              return "Hello World from RMI server!";
         public static void main(String args[]) {
              System.out.println("HelloWorldServer main");
              try {
                   if (System.getSecurityManager() == null) {
                        System.out.println(" System.getSecurityManager "
                                  + System.getSecurityManager());
                        System.setSecurityManager(new RMISecurityManager());
                   HelloWorldServer obj = new HelloWorldServer();
                   Registry registry = LocateRegistry.getRegistry("localhost");
                   registry.rebind("HelloWorld", obj);
              } catch (Exception e) {
                   e.printStackTrace();
    }init for Servlet
    public class ServerMain extends HttpServlet {
         public void init() {
              try {
                   HelloWorld mainServerClass = HelloWorldServer.class.newInstance();
              } catch (InstantiationException e) {
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   e.printStackTrace();
    }correct me..because i get error: RegistryImpl.lookup(RegistryImp.java:106)
    can some please shed a light...
    thnx

    Hello
    Actually I have not been able to do it.
    And i have not understood what you meant when you said that
    ejp wrote:
    Your main() does a Naming.bind(). Your ServerMain doesn't.could you please elaborate more..
    new to RMI..tried it for few hours. :-) thnx

  • Error in re-creating RMI registry when reloading Tomcat server.

    Hi,
    I use LocateRegistry.createRegistry() in a servlet which is load-on-startup. I've unexport the registered remote object in the HttpServlet.destroy().
    But when I reload the tomcat server, such an exception ocurrs:
    java.rmi.server.ExportException: internal error: ObjID already in use
            at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:168)
            at sun.rmi.transport.Transport.exportObject(Transport.java:69)
            at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:190)
            at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
            at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
            at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
            at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
            at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78)
            at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:164)
            at RmiUtils.rebindLocal(RmiUtils.java:86)Here is the binding code in RmiUtils.rebindLocal:
            try {
                Naming.rebind(url, rmiImpl);
            } catch (RemoteException ce) {
                if (!ru.isLocalhost()) {
                    ce.printStackTrace();
                    // cannot cache
                    return;
                } else {
                    // try to create the registry in local machine if not created
                    try {
                        LocateRegistry.createRegistry(ru.getPort());
                        Naming.rebind(url, rmiImpl);
                    } catch (RemoteException e) {
                        System.err.println("Failure in create Registry on port "
                                + ru.getPort() + ", maybe it's been created already!");
                        e.printStackTrace();// handle exception
            }Can anybody help?
    Thanks.

    Hi
    I havent code for quite a while.
    I would think that this wont work.
    The registry is created on startup (possibly init method in ur servlet) but it is never destroyed.
    You are better off starting the registry externally to ur servlet engine, and then use do a bind/rebind on startup, unbind on destroy.
    Hope this helps.

  • Exception when using RMI in tomcat 5.5, after reloading webapp

    When I freshly start tomcat and deploy my web app, I can use RMI by creating a local registry and binding my objects.
    However, as soon as I reload the web application, RMI no longer works and gives me this exception:
    RMI error: error unmarshalling return; nested exception is:
            java.io.EOFException
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.io.EOFException
            at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
            at java.rmi.Naming.lookup(Naming.java:84)
            at nl.heliotrope.tropebiz.tools.NutchRestarter.main(NutchRestarter.java:33)
    Caused by: java.io.EOFException
            at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2498)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1273)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
            at sun.rmi.server.MarshalInputStream.readLocation(MarshalInputStream.java:285)
            at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:167)
            at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
            at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
            ... 3 moreThe code to register my RMI object:
            logger.debug("Setting up RMI");
            //bind remote manager object to rmi resource
            RemoteManager remoteManager = new RemoteManager();
            try {
                Naming.rebind(rmiResource, remoteManager);
            } catch (MalformedURLException e) {
                throw new RuntimeException("Cannot happen: " + e.getMessage());
            } catch (RemoteException e) {
                /* perhaps the registry was not started yet? Attempt.
                 * Cannot create registry automatically at web application startup,
                 * because another app may have done so already.
                logger.debug("Error registering remote manager to RMI, " +
                        "service not running? Starting the registry.");
                try {
                    LocateRegistry.createRegistry(1099);
                    Naming.rebind(rmiResource, remoteManager);
                    logger.debug("RMI Registry started and remote manager registered");
                } catch (RemoteException e2) {
                    logger.error("Failed to start RMI registry or register RemoteManager!");
                    throw new RemoteException("rebind: " + e2.getMessage());
                } catch (MalformedURLException e2) {
                    throw new RuntimeException("Cannot happen: " + e.getMessage());
            logger.debug("RMI set up successfully");And client code:
                IRemoteManager remoteManager = (IRemoteManager)Naming.lookup(RemoteManager
                        .getRMIResource("127.0.0.1", 1099));Trying set a RMISecurityManager breaks tomcat horribly by the way, but since RMI works with a fresh tomcat startup, I suppose there's no problems there.

    Hi all!
    I get the same Exception using Tomcat 5.5. When registering an object outside tomcat lookup works fine. Only when registering an object inside a webapp!
    Would be great if anyone got a tip to solve it!
    Greetings...

  • RMI Callback Applet Tomcat!

    Hello,
    First timer here...bear with me.
    I am running a RMI server and an applet with one interface for the RMI Server. This part works fine. The .class files and the html is deployed thru TOMCAT 4.1
    The problem is however when the server code is changed to handle callbacks with the applet. Have already changed the security policy file. Now the applet too has its own interface.
    Compiled the .java files and also rmic applet and rmic server. Started the registry after that. And the server too with the codebase too mentioned with -Djava.rmi.server.codebase. (As in the HelloWorld example on the sun website) So far so good.
    However as soon as I load the appletviewer as http://localhost:8080/page.html (As I am running Tomcat) the error I get is:
    IO Exception while reading: Connection refused: connect
    Is it something to do with firewalls? But then everything is right now local and am lost...Any help will be really appreciated. Thanks a bunch.

    More explanation to the mentioned problem:
    I am sorry for not being very clear on this. Hope this helps.
    This link has the "QuoteServer" example which is on the same lines as my project.
    http://engronline.ee.memphis.edu/advjava/Examples/RMI/rmi_example.htm
    In the above example I compile all four files and then generate rmic for applet and server. Then I place all the class files and the related html for the applet in TOMCAT.
    Policy file:
    grant {
    // Allow everything for now
    permission java.security.AllPermission;
    permission java.net.SocketPermission "*:1024-65535", "connect,accept";
    permission java.net.SocketPermission "*:80", "connect";
    Then I start my TOMCAT and then the server with codebase=http:\\localhost:8080\(my folder)\ and the security file as mentioned above. So far so good.
    The problem occurs when I start my applet as
    appletviewer -J-Djava.security.policy="above file here" http:\\localhost:8080\page.html
    Also when I loaded the applet in IE I got the AccessControlException:access denied. Can you also direct me as to how to direct the above security policy file in IE?
    Thanks in advance for your patience. I hope I am clearer this time. Please let me know if more details are required.
    Appreciate your help.

  • RMI registry inside tomcat

    Hello,
    I'm wondering if any of you have previous experiences in the following situation.
    I have a linux server with tomcat 5.0.28 that is supposed to act as an RMI end point for clients connecting with the aforementioned RMI to do some persisting stuff. Now I figured that the easiest way is to create a servlet that creates the RMI registry and binds my server objects (so that's in the servlet's init(), with 1 load-on-startup, the servlet doesn't do anything else, at least yet).
    Now problems arise: my linux server is logging "context is read-only" when trying to bind the objects to RMI. Testing on my windows laptop doesn't show the same error for some reason (although it doesn't work properly either). This is apparently normal, as the contexts are supposed to be read-only.
    Thing is, I wouldn't want to run a separate rmiregistry on the server, if possible to do it with a simple servlet. But is this the easiest way?
    Thank you in advance,
    yours truly, in sickness and in health,
    Jussi

    'Context is read-only' is not a Registry error
    message. You are trying to bind to something else.
    Show us some code.Well, I'm not doing a lot of binding, so I'm assuming it's this part:
                   DDBServer stub = (DDBServer)UnicastRemoteObject.exportObject(this, 0);
                   Registry registry = LocateRegistry.getRegistry();
                   registry.rebind("DDBServer", stub);The error message is:
    2007-04-18 14:06:40 NamingContextListener[Catalina/localhost/DDBServer]: Creation of the naming context failed: javax.naming.NamingException: Context is read only

  • RMI with Tomcat

    If I run my java-application the Naming.lookup works correctly and also a following call to a method of this object.
    But when I put this sequence to the Tomcat4.1.12 packed up in a Servlet, the Naming.lookup works correctly again, but the following call to a method of this object throws an exception.
    Does I need any property-settings on my standalone WebServer?
    Thanks for your help.
    Kind regards
    Exception:
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.net.MalformedURLException: no protocol: Group/Tomcat
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    at java.lang.Thread.run(Thread.java:536)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
    at sun.rmi.server.ActivatableRef.invoke(ActivatableRef.java:116)
    at mmch.bod.session.pcmmmi.MmmiImpl_Stub.addListener(Unknown Source)
    at mmap.TrCtrl.myTest.init(myTest.java:72)
    at ConnectionTest.doPost(ConnectionTest.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:247)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
    ...

    I guess there is a whitespace in your Tomcat path, which caused the URL-related exception.

  • JSP+RMI = socket leak (with tomcat 5)

    Tried this in the RMI forum, no answer, so let's try here...
    When I use RMI from a JSP servlet, I have a "socket leak" problem. When I create an RMI unicast remote object, the RMI library (of course) opens up a server/listening socket. In a normal application, I can unbind the remote object, but then the next object I create will re-use the same server socket, so the server socket never closes, but only one is ever created, so it's not a big deal.
    Now for the problem: When I use the Tomcat manager to unload my webapp, the socket is still there. Sure, fine. But then when I reload the webapp, instead of re-using the same server socket, a new one is created! Furthermore, if I try to use explicit port numbers to force the server socket to be reused, I get "port already in use" errors. It seems that somehow tomcat won't let RMI recycle its entry points in between webapp restarts. Does anybody know how I can either:
    a) Get RMI to re-use the same ports
    b) Get RMI to completely shut down its ports when the webapp is unloaded (this would be even better)
    Thanks. It's irritating to see 10 open but unused server sockets on my system if I have to restart the webapp.

    Ah, I left out something: I construct the RMI object a servlet context listener in the contextInitialized() call, and I call UnicastRemoteObject.unexportObject() in the contextDestroyed() call. I added log messages, I am definitely correctly unbinding the object. The problem isn't that it is failing to be unbound - the problem is that the RMI system is refusing to reuse the same port after it is unbound. After unbinding, the port is still open, but it is never reused, each time I re-instantiate the remote object, it is making a new server socket and leaving the old one sitting open.
    As for why I'm doing this, it is a bit like a homegrown EJB, but just so small that this was the simplest way. I have a largish non-web based application, then I have a few JSP pages that do database queries to provide information to browsers. The JSP pages are not at all central to the application though, and just show some database info. The JSP system caches some SQL data, and I use RMI to tell JSP when to flush cached data due to database changes. It's all very simple, and it works fantastic, except for the issue that every time I reload the webapp I leave these server sockets hanging open. Even that is just an irritation, I don't reload much except when I'm testing, but it's a big enough irritation that I would really like to fix it.

  • Passing byte[] Tomcat to RMI server

    Hi!
    I have a webapplication powered by Tomcat and RMI used for database access. I get into problem, when someone enters high-ASCII characters to be save in our MS SQL db. I tried doing following:
    byte[] bytes = myString.getBytes( "UTF-8" );
    I pass bytes through rmi server to appropriate class. Within that class
    I recreate string new String( bytes, "UTF-8" ); At this point all high-ASCII replaced with ?. Do you have any suggestions or help on this?
    Thanks

    If you want to encode/decode like that, take a look at the URLEncoder/URLDecoder classes in the java.net package which probably works faster than what you're doing now.
    I have to agree with the other poster, though, that you need to find some way of detecting what character set is used by the different clients. What you're doing now, in effect, is just storing the raw text you get from the client, then presenting it back as it came from the client. This will get you into trouble if you store some text from a Mac user, then present it back to a PC user who may use another character set.
    Any solution to this problem starts by detecting the character set used by the client. Here are five possible ways of doing this in an HTTP environment:
    1. See if the clients send any headers with the POST request -- eg. an "Accept-Charset" header -- that hints at what character set is used. You may use HttpServletRequest.getHeader() for this.
    2. Extract the client platform from the HTTP "User-Agent" header, mapping this to a likely character set.
    3. Check for existence of "tell-tale" characters in the text, again using this to decide the likely character set. An advanced version of this technique will use the frequency distribution of all the 8-bit characters.
    4. Make the client send the character set in use as a hidden parameter. You should be able to use JavaScript to set the hidden parameter.
    5. If your system includes user profiles, make the character set a part of the user profile, settable by the user.

  • Rmi against tomcat

    I just wonder...what would be the plus using tomcat instead a simple rmi based system for a thick client and server database?
    if anyone has an idea!

    Just a couple of pros/cons"
    Tomcat pro: HTTP-based - will work over the internet.
    RMI-pro: A lot easier than defining your own prototcol atop HTTP.

  • Error connecting to an EJB 3.0 Remote on OC4J 10.1.3.2 from Tomcat

    Hi, I want to connect to a Remote Session Bean running on the OC4J 10.1.3 and it doesn´t work.
    I have connected to it from a java standalone application using:
    public static void main(String [] args) {
    try {
    final Context context = getInitialContext();
    SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
    System.out.println(sessionEJB.mergeEntity(""));
    System.out.println( "hola" );
    } catch (Exception ex) {
    ex.printStackTrace();
    private static Context getInitialContext() throws NamingException {
    Hashtable env = new Hashtable();
    // Standalone OC4J connection details
    env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
    env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
    env.put( Context.SECURITY_CREDENTIALS, "passw" );
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791/ejb3jar");
    return new InitialContext( env );
    with this application-client.xml file:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <display-name>Model-app-client</display-name>
    <ejb-ref>
    <ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>ar.com.eds.ejb3.model.SessionEJB</remote>
    <ejb-link>SessionEJB</ejb-link>
    </ejb-ref>
    thats works fine, but when I try to use the same solution from a jsf proyect running on a Tomcat 5.5.20, it fails with this error:
    Caused by: java.lang.RuntimeException: Error while creating home.
         at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:32)
         at ar.com.mcd.fawkes.ui.locator.ServiceLocator$1.get(ServiceLocator.java:12)
         at net.sf.opentranquera.web.jsf.locator.ServiceLocatorBean.get(ServiceLocatorBean.java:42)
         at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
         at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:187)
         at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:171)
         at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:160)
         ... 80 more
    Caused by: javax.naming.NameNotFoundException: Name ejb is not bound in this Context
         at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
         at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:28)
         ... 87 more
    Could you please help me with any tip?
    Mauricio
    Message was edited by:
    Mauricio

    Hi, Rick
    Thanks for your help.
    I deleted de application-client.xml file, added the following lines to the web.xml file:
         <ejb-ref>
              <ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <remote>ar.com.eds.ejb3.model.SessionEJB</remote>
         </ejb-ref>
    and now I´m using oracle.j2ee.rmi.RMIInitialContextFactory
    there is no error, and it doesn´t throw any exception but the following line returns null.
    SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
    Its seems the lookup method finds the remote ejb because it doesn´t fail, but it returns null.
    Any idea what is wrong?
    Mauricio.

  • Getting Tomcat 4.1 to call EJBs in WLS 8.1

    I know this is not necessarily a new topic, but we're upgrading our Tomcat
    4.1 -> WLS 5.1 to a Tomcat 4.1 -> WLS 8.1 configuration.
    Firstly, has ANYONE got Tomcat 4.1.x to work with a post 5.1 container at
    all? Ever?
    We are using the T3 protocol to talk to our beans, and the goal, of course,
    is that our Tomcat based client code will ideally not have to change.
    Our beans are all EJB 1.1, and I have them loaded into a running WLS 8.1
    container. They appear to work.
    The way I tested to see if I could talk to WLS was by using a simple client
    that I had that gets an InitialContext, and then grabs a bean.
    I now have a simple JSP that essentially does the same thing. I've bundled
    this jsp into a properly formatted WAR file.
    Within this WAR file in the WEB-INF/classes directory are the Session bean
    Home and the Session Bean Remote interface classes.
    Within the WEB-INF/lib directory is the
    c:\bea\weblogic81\server\lib\weblogic.jar, slightly modified.
    After the first attempt to load this, Tomcat would complain because the
    weblogic.jar contains the javax.servlet package, so I exploded the
    weblogic.jar file, renamed javax/servlet to javax/servlet.x, and then
    rejarred the file. This file was placed into the WEB-INF/lib directory.
    This is otherwise a default Tomcat 4.1.18 binary package.
    Here's the WAR file contents:
    ./META-INF/MANIFEST.MF
    ./WEB-INF/classes/com/pfizer/ecms/as/CustomizationSession.class
    ./WEB-INF/classes/com/pfizer/ecms/as/CustomizationSessionHome.class
    ./WEB-INF/lib/wlsx.jar <-- Edited weblogic.jar
    ./WEB-INF/web.xml
    ./test.jsp
    This is the contents of the test.jsp:
    <%@ page language="java" %>
    <%@ page import="javax.naming.*" %>
    <%@ page import="com.pfizer.ecms.as.*" %>
    <%
    try{
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    System.setProperty(Context.PROVIDER_URL, "t3://localhost:7001");
    InitialContext ctx = new InitialContext();
    CustomizationSessionHome csth = (CustomizationSessionHome)
    ctx.lookup("CustomizationSession");
    CustomizationSession cst = csth.create();
    catch (Throwable t) {
    System.out.println(">>>t = " + t);
    t.printStackTrace(System.out);
    %>
    <HTML>
    <BODY>
    This is the jsp.
    </BODY>
    </HTML>
    Similar code to this has been working for us for 3 years so far.
    When I try and load the JSP, it dumps a stack trace. Here's the relevant
    bits up to the Tomcat container:
    t = java.lang.NoClassDefFoundError: weblogic/rmi/extensions/server/Stubjava.lang.NoClassDefFoundError: weblogic/rmi/extensions/server/Stub
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at
    weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLo
    ader.java:431)
    at
    weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.
    java:169)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at
    weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.jav
    a:71)
    at weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:672)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:712)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:699)
    at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:76)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newRootNamingNodeStub(WLInitia
    lContextFactoryDelegate.java:486)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialCont
    extFactoryDelegate.java:449)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFac
    toryDelegate.java:345)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:308)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:234)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:135)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:175)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:51)
    What is interesting about this is that the system could "see"
    weblogic.utils.classloaders.GenericClassLoader, but THAT class could not
    find weblogic.rmi.extension.server.Stub, even though they are, ideally, at
    the same level within the Tomcat imposed hierarchy of classloaders.
    Unfortunately, we don't quite know where in that hierarchy each class is
    placed.
    Now, the culprit may well be java.security.SecureClassLoader (or, actually,
    the java.lang.ClassLoader.defineClass0), which is very high up in the
    hierarchy trying to load a the result of the StubGenerator, only to find
    that an associated class, weblogic.rmi.extensions.server.Stub, was "not
    found" because it only existed deep in the Tomcat hierarchy.
    One way that I tried to get around this was to start taking selective bits
    of of weblogic.jar and put them on the system CLASSPATH used by Tomcat when
    it starts up.
    This gets us farther along, in that more classes seem to load without
    getting the ClassDefNotFound error, but it finally leads us into this
    exception:
    The error is, with a small bit of stack dump:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Environment not
    found on thread ]
    at
    weblogic.jndi.internal.NamingNodeReplicaHandler.<init>(NamingNodeReplicaHand
    ler.java:150)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
    sorImpl.java:39)
    at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
    torAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:90)
    snip
    The relevant starting point is toward the middle of the stack trace:
    at
    weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:106
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:125)
    at
    com.pfizer.ecms.as.DataImporterSession_aiw0oz_HomeImpl_810_WLStub.create(Unk
    nown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.pfizer.ecms.com.AppServer.createInstance(AppServer.java:163)
    at com.pfizer.ecms.com.AppServer.getDataImporterSession(AppServer.java:231)
    at
    com.pfizer.ecms.ws.ECMSActionServlet.testBeans(ECMSActionServlet.java:1662)
    at
    com.pfizer.ecms.ws.ECMSActionServlet.initOther(ECMSActionServlet.java:62)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
    Now, according to the Weblogic documentation, the AssertionError exception
    "is impossible". Well, that's my job they say, doing the impossible.
    Minimally, it's a meaningless message to me and pretty much stops me cold.
    I have seen other discussions about Tomcat and how it's not J2EE, etc, and
    perhaps my expectations that this will work are too high. My concern with
    that is simply that in our case, Tomcat is a Fat Client no different from
    "any other Java application". We just use Tomcat to talk to beans rather
    than a custom client. The difficulty, it seems, is in the complexities of
    the Tomcat class loaders interoperating with the expectations of Weblogics
    classes et al.
    I've got a small application that does exactly what Tomcat wants to do, so
    "weblogic works", except of course, in Tomcat.
    So, in the end, I'm curious if others have some data on getting these two
    system cooperating. If anyone has any other ideas on how to use Tomcat as a
    client of Weblogic 8 that utilizes techniques besides replacing Tomcat
    (which is not an option at the moment) I'd like to hear those as well. I
    have been fighting this for days, and tried several things, but nothing
    "obvious" seems to help.
    Weblogic 8 has a "thin client" jar, but it's only useful for RMI rather than
    T3, plus it's still not clear how we'd go about rewriting the interfaces to
    support that versus the standard EJB interfaces already created for the
    beans.
    Any assistance greatly appreciated.
    Regards,
    Will Hartung
    ([email protected])

    Of course I feel obliged to first recommend that you run your webapps
    and EJBs in WLS. There's significant performance advantages and it
    greatly simpifies your life since you don't have to deal with another
    remote failure case.
    That being said, I believe it should be possible especially with 8.1 to
    make Tomcat a WLS client.
    Answers inline.
    Will Hartung wrote:
    I know this is not necessarily a new topic, but we're upgrading our Tomcat
    4.1 -> WLS 5.1 to a Tomcat 4.1 -> WLS 8.1 configuration.
    Firstly, has ANYONE got Tomcat 4.1.x to work with a post 5.1 container at
    all? Ever?
    We are using the T3 protocol to talk to our beans, and the goal, of course,
    is that our Tomcat based client code will ideally not have to change.
    Our beans are all EJB 1.1, and I have them loaded into a running WLS 8.1
    container. They appear to work.
    The way I tested to see if I could talk to WLS was by using a simple client
    that I had that gets an InitialContext, and then grabs a bean.
    I now have a simple JSP that essentially does the same thing. I've bundled
    this jsp into a properly formatted WAR file.
    Within this WAR file in the WEB-INF/classes directory are the Session bean
    Home and the Session Bean Remote interface classes.
    Within the WEB-INF/lib directory is the
    c:\bea\weblogic81\server\lib\weblogic.jar, slightly modified.My suggestion is to ditch the weblogic.jar and the joys of trying to
    modify it. I'd instead check out 8.1's thin client support:
    http://e-docs.bea.com/wls/docs81/rmi_iiop/rmiiiop2.html#1071450
    >
    After the first attempt to load this, Tomcat would complain because the
    weblogic.jar contains the javax.servlet package, so I exploded the
    weblogic.jar file, renamed javax/servlet to javax/servlet.x, and then
    rejarred the file. This file was placed into the WEB-INF/lib directory.
    This is otherwise a default Tomcat 4.1.18 binary package.
    Here's the WAR file contents:
    ./META-INF/MANIFEST.MF
    ./WEB-INF/classes/com/pfizer/ecms/as/CustomizationSession.class
    ./WEB-INF/classes/com/pfizer/ecms/as/CustomizationSessionHome.class
    ./WEB-INF/lib/wlsx.jar <-- Edited weblogic.jar
    ./WEB-INF/web.xml
    ./test.jsp
    This is the contents of the test.jsp:
    <%@ page language="java" %>
    <%@ page import="javax.naming.*" %>
    <%@ page import="com.pfizer.ecms.as.*" %>
    <%
    try{
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    System.setProperty(Context.PROVIDER_URL, "t3://localhost:7001");
    InitialContext ctx = new InitialContext();
    CustomizationSessionHome csth = (CustomizationSessionHome)
    ctx.lookup("CustomizationSession");
    CustomizationSession cst = csth.create();
    catch (Throwable t) {
    System.out.println(">>>t = " + t);
    t.printStackTrace(System.out);
    %>
    <HTML>
    <BODY>
    This is the jsp.
    </BODY>
    </HTML>
    Similar code to this has been working for us for 3 years so far.
    When I try and load the JSP, it dumps a stack trace. Here's the relevant
    bits up to the Tomcat container:
    t = java.lang.NoClassDefFoundError: weblogic/rmi/extensions/server/Stubjava.lang.NoClassDefFoundError: weblogic/rmi/extensions/server/Stub
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at
    weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLo
    ader.java:431)
    at
    weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.
    java:169)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at
    weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.jav
    a:71)
    at weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:672)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:712)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:699)
    at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:76)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newRootNamingNodeStub(WLInitia
    lContextFactoryDelegate.java:486)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialCont
    extFactoryDelegate.java:449)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFac
    toryDelegate.java:345)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:308)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:234)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:135)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:175)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:51)
    What is interesting about this is that the system could "see"
    weblogic.utils.classloaders.GenericClassLoader, but THAT class could not
    find weblogic.rmi.extension.server.Stub, even though they are, ideally, at
    the same level within the Tomcat imposed hierarchy of classloaders.
    Unfortunately, we don't quite know where in that hierarchy each class is
    placed.
    Now, the culprit may well be java.security.SecureClassLoader (or, actually,
    the java.lang.ClassLoader.defineClass0), which is very high up in the
    hierarchy trying to load a the result of the StubGenerator, only to find
    that an associated class, weblogic.rmi.extensions.server.Stub, was "not
    found" because it only existed deep in the Tomcat hierarchy.
    One way that I tried to get around this was to start taking selective bits
    of of weblogic.jar and put them on the system CLASSPATH used by Tomcat when
    it starts up.
    This gets us farther along, in that more classes seem to load without
    getting the ClassDefNotFound error, but it finally leads us into this
    exception:
    The error is, with a small bit of stack dump:
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Environment not
    found on thread ]
    at
    weblogic.jndi.internal.NamingNodeReplicaHandler.<init>(NamingNodeReplicaHand
    ler.java:150)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
    sorImpl.java:39)
    at
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
    torAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at
    weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectIn
    putStream.java:90)
    snip
    The relevant starting point is toward the middle of the stack trace:
    at
    weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:106
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:125)
    at
    com.pfizer.ecms.as.DataImporterSession_aiw0oz_HomeImpl_810_WLStub.create(Unk
    nown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
    .java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.pfizer.ecms.com.AppServer.createInstance(AppServer.java:163)
    at com.pfizer.ecms.com.AppServer.getDataImporterSession(AppServer.java:231)
    at
    com.pfizer.ecms.ws.ECMSActionServlet.testBeans(ECMSActionServlet.java:1662)
    at
    com.pfizer.ecms.ws.ECMSActionServlet.initOther(ECMSActionServlet.java:62)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
    Now, according to the Weblogic documentation, the AssertionError exception
    "is impossible". Well, that's my job they say, doing the impossible.
    Minimally, it's a meaningless message to me and pretty much stops me cold.
    Right, it's not really meant to be meaningful because customers "should"
    never see these assertions.
    I have seen other discussions about Tomcat and how it's not J2EE, etc, and
    perhaps my expectations that this will work are too high. My concern with
    that is simply that in our case, Tomcat is a Fat Client no different from
    "any other Java application". We just use Tomcat to talk to beans rather
    than a custom client. The difficulty, it seems, is in the complexities of
    the Tomcat class loaders interoperating with the expectations of Weblogics
    classes et al.
    I've got a small application that does exactly what Tomcat wants to do, so
    "weblogic works", except of course, in Tomcat.
    So, in the end, I'm curious if others have some data on getting these two
    system cooperating. If anyone has any other ideas on how to use Tomcat as a
    client of Weblogic 8 that utilizes techniques besides replacing Tomcat
    (which is not an option at the moment) I'd like to hear those as well. I
    have been fighting this for days, and tried several things, but nothing
    "obvious" seems to help.
    Weblogic 8 has a "thin client" jar, but it's only useful for RMI rather than
    T3, plus it's still not clear how we'd go about rewriting the interfaces to
    support that versus the standard EJB interfaces already created for the
    beans.I'm not sure I follow you here. You always write to RMI interfaces.
    The question is what protocol (eg T3, JRMP, IIOP) will actually run RMI.
    By default WLS uses its own protocol (t3), but most customer apps
    should run without change over IIOP.
    I'd really recommend going the thin client route. Otherwise I fear
    you'll end up with a heavily modified weblogic.jar and headaches when
    you try to install a service pack etc.
    -- Rob
    >
    Any assistance greatly appreciated.
    Regards,
    Will Hartung
    ([email protected])

  • Access EJB 3.0 (deployed on Glassfish v3) from Tomcat 6.0.20 (Netbeans 6.8)

    Hi all,
    I'm a newbie (of java EE and Sun forum).
    I have a problem.
    I followed this tutorial: http://technology.amis.nl/blog/1368/connecting-to-an-ejb-30-remote-sessionbean-from-tomcat
    using Netbeans 6.8, Tomcat 6.0.20, Glassfish v3.
    The deploy of EJB on Glassfish is OK.
    The deploy of WebApp on Tomcat is OK.
    But when I access to the servlet using the browser I receive this exception.
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at web.MyServlet.processRequest(MyServlet.java:51)
    at web.MyServlet.doGet(MyServlet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:619)
    I know that I must copy *.jar files in Tomcat dir and App libraries (https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#Step_3._Include_appserv-rt.jar_and), but it doesn't work.
    What are my mistakes?
    Thank you for your help.
    Servlet code:
    package web;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.util.Properties;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import testbean.MySessionBeanRemote;
    * @author Stefano
    public class MyServlet extends HttpServlet {
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
    props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
    props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
    props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
    props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet MyServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println(MySessionBeanRemote.class.getName());
    try {
    InitialContext ic = new InitialContext(props);
    MySessionBeanRemote mySessionRemote = (MySessionBeanRemote) ic.lookup("pippo");
    out.println(mySessionRemote.getOK());
    } catch (NamingException ex) {
    ex.printStackTrace();
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();

    Yes, I did.
    I'm not sure about the right actions to do.
    For example: the Glassfish FAQ told me to add gf-client*.jar to the Tomcat folder, not appserv-rt.jar , with v3.
    I tried with both files. I restarted Tomcat, but nothing work :-(

Maybe you are looking for

  • CDR FIles in Call Manager version 7.1.5-30000

    Good Morning: I have a cluster of servers Cisco Call Manager version 7.1.5.30000; 01 Publisher and 02 subscriber. The publisher server passes CDR files to a call accounting application PC-SYSTEL on another server. At one point the CDR files are no lo

  • How to write the select

    i am writting a selection and i want to select from the table HRP1001 only the rows that created this year i wrote select * into itab from hrp1001 where concatenate begda(4) eq sy-datum(4). why its not working ?

  • BRUSH TOOL NOT SMOOTH

    I have an issue with my Cintiq not drawing smoothly in Flash. I need to sketch incredibly fast and loose. Flash used to work just fine but now it suddenly began drawing really crummy. I posted some examples of flash as well as Photoshop, Sketchbook P

  • Cannot update or download CS5 Camera Raw

    I cannot seem to update or download Camera Raw for CS5. I have downloaded updates and have gone under the update bar in the application. I cannot open any Camera Raw files. Also, in the case that this is important, my computer runs Windows 8. Thanks,

  • Query on database links

    I wanted to know what is the difference between these two types of database links: create public database link <> connect to <> identified by <> using 'XYZ'; and create public database link <> connect to <> identified by <> using '(DESCRIPTION = (ADD