Thanks a lot for your answer, Bill.

I will try to develop my own ProtocolHandler. But the problem is, that I can´t 
use Tomcat5.5, I guess. I tried it in embedded mode with Tomcat5.5 an Java1.4 
and got an Exception: java.lang.NoClassDefFoundError: 
javax/management/NotificationEmitter

But the code example you gave to me I can´t use, because it is for Tomcat5.5, I 
guess. I think I should use Tomcat5.0 because I have to use Java1.4. 

I tried an example I found in the net, but got an 
java.lang.NoClassDefFoundError: javax/management/NotificationEmitter. So I 
searched for that and in my opinion I have to use Java1.5 for that, right? Or 
is there a possiblity to use Tomcat5.5 in embedded mode with Java1.4?

So I would like to know, how to embed an own ProtocolHandler in Tomcat5.0 
because Connector is not a class, it is an Interface there. The Class there I 
found is CoyoteConnector.

I tried something like this and it works:

CoyoteConnector testConnector1 = (CoyoteConnector)
   server.createConnector((java.net.InetAddress) null, 7070, false);
testConnector1.setProtocolHandlerClassName("org.apache.coyote.http11.Http11Protocol");
server.addConnector(testConnector1);

But if I take the source code of the package in an own package an generate an 
jar-File of this it does not work anymore.

CoyoteConnector testConnector2 = (CoyoteConnector)
   server.createConnector((java.net.InetAddress) null, 9090, false);
testConnector2.setProtocolHandlerClassName("src.connectors.test.Http11Protocol");
server.addConnector(testConnector2);

I did not get an exception but 

--- THE EXCEPTION I GOT: ---

java.lang.NoClassDefFoundError: javax/management/NotificationEmitter
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
        at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at org.apache.catalina.startup.Embedded.createContext(Embedded.java:475)
        at src.server.Tomcat55.startTomcat(Tomcat55.java:126)
        at src.server.MyServer55.main(MyServer55.java:244)
Exception in thread "main" 


>
>"Daniela Piacenti" <[EMAIL PROTECTED]> wrote in message 
>news:[EMAIL PROTECTED]
>> Hello everybody,
>>
>> I read a lot about the coyote connector and that it is possible to write 
>> own connectors for Tomcat. But I did not find anything in the whole web, 
>> how to do this. Now I am reading the source code of the coyote connector 
>> and have some questions about it.
>>
>> My problem is:
>> I am writing an application, which acts as an adapter for another 
>> application to provide its functionality via Web Services to external 
>> client applications. Therefore I am using Tomcat5 in embedded mode as 
>> servlet engine and Apache Axis as framework for the web services.
>> Now I also have to connect legacy client systems to my new application if 
>> possible. They communicate with the old external client interface directly 
>> over sockets with streams via TCP/IP using proprietary message protocols.
>>
>> The alternative way would be to write an own SocketServer before Tomcat to 
>> make HTTP-Requests and to forward them to the Servlet Engine. Backwards 
>> the other way. But this would not be a smart and practicable way for this 
>> task, I guess. So I decided to have a look to the connector and maybe 
>> write my own connector for this.
>>
>> Generally I have the question, if it is possible and if yes, how. Do I 
>> have to write a whole connector, which implements this interface? Or is it 
>> possible to use the coyote connector with an own implemenation of an 
>> handlerclass, protocolclass and processclass? And how can I embed this 
>> connector in Tomcat?
>>
>> Hope someone may help me. Thanks a lot in advance,
>>
>
>The best way is to use the Coyote Connector, but implement your own 
>ProtocolHandler: 
>http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/coyote/Pro
>tocolHandler.html. 
>The ProtocolHandler is responsible for setting up the ServerSocket, handling 
>the accepted requests, parsing the data it recieves and setting the 
>appropriate fields in the Request/Response (that it is also responsible for 
>creating :), creating  a Thread to process the request, and passing it off 
>to the Adapter that the Connector will have handed you, and finally sending 
>the result back to the client in the format that it expects to recieve it. 
>You'll likely need to implement ActionHook as well to get the best results 
>(e.g. handling client-flush properly).
>
>The MemoryProtocolHandler that ships with Tomcat is probably the simplest, 
>and so likely a good place to start to base your ProtocolHandler on.
>
>Since you are using Embedded, in your code you would do something like:
>
>     Connector myConn = new 
>Connector("com.myfirm.mypackage.MyProtocolHandler");
>     myConn.setProperty("port", myPort);
>     // Additional calls to setProperty here, which will be passed JavaBean 
>style to
>    // your ProtocolHandler (alternatively, use setAttribute if you know the 
>Java class already)
>    embedded.addConnector(myConn);
>
>
>> Regards,
>> Daniela
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [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]
>

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

Reply via email to