[jboss-user] [JNDI/Naming/Network] - Compression Socket
JLudwig
do-not-reply at jboss.com
Thu Nov 16 09:51:35 EST 2006
hi,
i have an EJB 3.0 application which extract text-data from MySQL Database. Only the EJB application works fine.
Now, i want get the data in compressed form by using CompressedSocket. Therefore, i've create the CompressionSocket classes from the "org.jboss.test.jrmp.ejb" package. In additional, i wrote the following jboss.xml deployment descriptor:
| <?xml version="1.0"?>
| <jboss>
|
| <container-configurations>
| <container-configuration>
| <container-name>Standard Stateless SessionBean</container-name>
| <invoker-proxy-binding-name>stateless-compression-invoker</invoker-proxy-binding-name>
| <container-invoker-conf>
| <Optimized>true</Optimized>
| <RMIObjectPort>0</RMIObjectPort>
| <RMIClientSocketFactory>de.einsundeins.socket.CompressionClientSocketFactory</RMIClientSocketFactory>
| <RMIServerSocketFactory>de.einsundeins.socket.CompressionServerSocketFactory</RMIServerSocketFactory>
| </container-invoker-conf>
| </container-configuration>
| </container-configurations>
|
| <enterprise-beans>
| <session>
| <ejb-name>TextBean</ejb-name>
| <configuration-name>Standard Stateless SessionBean</configuration-name>
| <invoker-bindings>
| <invoker>
| <invoker-proxy-binding-name>
| stateless-compression-invoker
| </invoker-proxy-binding-name>
| <jndi-name>CompressedApp/TextBean/remote</jndi-name>
| </invoker>
| </invoker-bindings>
| </session>
| </enterprise-beans>
|
| <invoker-proxy-bindings>
| <invoker-proxy-binding>
| <name>stateless-compression-invoker</name>
| <invoker-mbean>jboss:service=invoker,type=jrmp, socketType=CompressionSocketFactory</invoker-mbean>
| <proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
| <proxy-factory-config>
| <client-interceptors>
| <home>
| <interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
| <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
| <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </home>
| <bean>
| <interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>
| <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
| <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </bean>
| </client-interceptors>
| </proxy-factory-config>
| </invoker-proxy-binding>
| </invoker-proxy-bindings>
|
| </jboss>
|
Now, i get the same result when i deploy and start the application as previous. I don't get an error message if i rename the clientSocketFactory or serverSocketFactory class. First, i think that the jboss.xml file is never read but the application doesn't run when i modify the Enterprise-bean settings in this file.
The code of the TextBean.class:
| import java.sql.Connection;
| import java.sql.PreparedStatement;
| import java.sql.ResultSet;
| import java.sql.SQLException;
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import org.jboss.annotation.ejb.RemoteBinding;
| import de.einsundeins.ccsys.util.DBConnection;
| import de.einsundeins.ccsys.interfaces.*;
|
|
| @Stateless
| @Remote(TextRemote.class)
| //@RemoteBinding (jndiBinding="CompressedApp/TextBean/remote")
| public class TextBean implements TextHome, TextRemote {
|
| private static final String QRY_TEXT_SEL = "select text.data from textandbinary.text LIMIT 100";
|
|
| public String getText() {
|
|
| try {
| Connection ConMySQL = DBConnection.dbMysql(DBConnection.MySQLURL);
| PreparedStatement prepStmt = ConMySQL.prepareStatement(QRY_TEXT_SEL);
| ResultSet rs = prepStmt.executeQuery();
| String text = "";
|
| while(rs.next()){
| text = text + rs.getString("data");
| }
| return text;
| }
| catch(ClassNotFoundException ex){
| ex.printStackTrace();
| }catch (SQLException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| return null;
| }
| }
|
TextRemote.class Interface:
| public interface TextRemote{
|
| public String getText();
|
| }
|
CompressedClient.class
| import de.einsundeins.ccsys.interfaces.*;
| import javax.naming.InitialContext;
|
|
|
| public class CompressedClient {
|
| public static void main(String args[]){
|
| try{
| InitialContext ctx = new InitialContext();
|
| TextRemote remote = (TextRemote)ctx.lookup("CompressedApp/TextBean/remote");
| System.out.println(remote.getText());
| }
| catch(Exception e){
| e.printStackTrace();
| }
| }
| }
|
I deploy the application as an EAR-file with following structure:
CompressedApp.ear
- application.xml --> META-INF
- ejb-app.jar
- TextBean.class
- TextRemote.class
- CompressionClientSocketFactory.class
- CompressionServerSocketFactory.class
- CompressionServerSocket.class
- CompressionSocket.class
- CompressionInputStream.class
- CompressionOutputStream.class
- CompressionConstants.class
- jboss.xml --> META-INF
Is it possible that i have make for error in the jboss.xml file or i have forget about something?
I don't know it.
I would be grateful for every help.
Best regards
Markus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986542#3986542
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986542
More information about the jboss-user
mailing list