Okay, okay!
I think I'm reaching aim now.
But some little problems are still available...
1.) I created a sar file containing a MBean. This MBean reads out a XML file. Then it instantiates the TreeCache. Afterwards it binds this object with a JNDI name. At last: It adds the XML file content to the TreeCache.
A survey of the code:
TreeCache cache = new TreeCache();
PropertyConfigurator config = new PropertyConfigurator();
config.configure(cache, "..\\server\\all\\deploy\\local-service.xml"); // read in generic local xml
cache.startService();
//Bind object to JNDI namespace
InitialContext ctx = new InitialContext();
ctx.bind( "java:/TreeCache", cache );
Now the JBoss cluster establishes some accepted views to this TreeCache Instance.
Now I created a StatelessSession Bean, which shall read out the content.
Here is a short code snippet:
TreeCache theCache = null;
try
{
InitialContext ctx = new InitialContext();
//The following line is line Number 134 in com.siemens.is.its.airfield.aglseries.test.POJOTestBean.getValues()
Object o = ctx.lookup( "java:/TreeCache" );
theCache = (TreeCache)javax.rmi.PortableRemoteObject.narrow(o, TreeCache.class );
System.out.println(">>>>>Entering: POJOTestBean::getValues()<<<<<");
String key = "aglcore";
Node n = theCache.get( key );
System.out.println("\tReturned object: " + n.toString());
System.out.println(">>>>>Leaving: POJOTestBean::getValues()<<<<<");
}
catch(Exception e)
{
e.printStackTrace();
}
But the JBoss server only responses with an Exception like this:
14:57:28,881 INFO [StatelessSessionContainer] Started jboss.j2ee:jndiName=com.siemens.is.its.airfield.aglseries.test.POJOTest,service=EJB
14:57:28,891 INFO [EjbModule] Started jboss.j2ee:module=test-ejb.jar,service=EjbModule
14:57:28,901 INFO [EJBDeployer] Deployed: file:/D:/Projects/Java/jboss3/server/all/deploy/test-ejb.jar
14:57:28,931 INFO [MainDeployer] Deployed package: file:/D:/Projects/Java/jboss3/server/all/deploy/test-ejb.jar
14:57:37,414 ERROR [STDERR] EJBStatelessSessionBean::setSessionContext is not implemented yet.
14:57:37,414 ERROR [STDERR] EJBStatelessSessionBean::ejbCreate is not implemented yet.
14:57:37,424 ERROR [STDERR] javax.naming.NameNotFoundException: TreeCache not bound
14:57:37,444 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
14:57:37,454 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
14:57:37,464 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
14:57:37,474 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
14:57:37,484 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
14:57:37,494 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
14:57:37,504 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
14:57:37,514 ERROR [STDERR] at com.siemens.is.its.airfield.aglseries.test.POJOTestBean.getValues(POJOTestBean.java:134)
14:57:37,524 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:57:37,534 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:57:37,544 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:57:37,554 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:57:37,564 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
14:57:37,584 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
14:57:37,594 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
14:57:37,604 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
14:57:37,614 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:297)
14:57:37,624 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
14:57:37,634 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
14:57:37,644 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
14:57:37,654 ERROR [STDERR] at org.jboss.ejb.plugins.CleanShutdownInterceptor.invoke(CleanShutdownInterceptor.java:264)
14:57:37,664 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
14:57:37,674 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
14:57:37,694 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:700)
14:57:37,704 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:57:37,714 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:57:37,724 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:57:37,734 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:57:37,744 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
14:57:37,754 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
14:57:37,764 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvokerHA.invoke(JRMPInvokerHA.java:163)
14:57:37,774 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:57:37,784 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:57:37,794 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:57:37,814 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
14:57:37,824 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
14:57:37,834 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:148)
14:57:37,854 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
14:57:37,854 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
14:57:37,864 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
14:57:37,874 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
14:57:37,894 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
What went wrong. Is this way I've chosen the right way?
Greetings Vic