-
1. Re: HAJNDI over HTTP
mindflyer Feb 1, 2007 2:23 AM (in response to mindflyer)Of course, I can use loadbalancer (Apache HTTP Server). But I want to use HAJNDI based on client-side interceptor, without loadbalancer. It is possible?
-
2. Re: HAJNDI over HTTP
brian.stansberry Feb 1, 2007 2:59 PM (in response to mindflyer)Try this. In your jndi.properties, use
java.naming.factory.initial = org.jboss.naming.HttpNamingContextFactory java.naming.provider.url = http://yourhost:8080/invoker/HAJNDIFactory
I must confess I've never used that, but it follows the same pattern as HTTP tunneling to the regular JNDI service. -
3. Re: HAJNDI over HTTP
mindflyer Feb 3, 2007 8:13 AM (in response to mindflyer)I have host1 and host2.
java.naming.provider.url = http://host1:8080/invoker/HAJNDIFactory
I start client application, it connects to server and works. Then I stop host1, and client application can't lookup new beans.
I look at NamingContext in the debug mode and see that it have HttpInvokerProxy(externalURL:http://host1:8080/invoker/JMXInvokerHAServlet)
NamingContext doesn't know about host2 and can't connect to host1 because it is stopped. -
4. Re: HAJNDI over HTTP
brian.stansberry Feb 3, 2007 8:46 AM (in response to mindflyer)Try:
java.naming.provider.url=http://host1:8080/invoker/HAJNDIFactory,http://host2:8080/invoker/HAJNDIFactory
What allows HA-JNDI to find host2 is you don't list it like that is the multicast autodiscovery feature. But if you use that, you'll get an RMI-based proxy. So you'd need to list all your servers. -
5. Re: HAJNDI over HTTP
mindflyer Feb 3, 2007 10:48 AM (in response to mindflyer)In this case I see:
javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.io.FileNotFoundException: http://10.0.0.17:8080/invoker/HAJNDIFactory,http://10.0.0.100:8080/invoker/HAJNDIFactory]
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.(Unknown Source)
at net.uk.topdog.td2.common.jndi.JndiContextCache.createContext(JndiContextCache.java:61)
at net.uk.topdog.td2.common.jndi.JndiContextCache.getContext(JndiContextCache.java:39)
at net.uk.topdog.td2.common.jndi.JndiComponentAdapter.getContext(JndiComponentAdapter.java:106)
at net.uk.topdog.td2.common.jndi.JndiComponentAdapter.getInstance(JndiComponentAdapter.java:124)
at net.uk.topdog.td2.common.jndi.JndiComponentAdapter.getComponentInstance(JndiComponentAdapter.java:72)
at net.uk.topdog.td2.common.jndi.CachingJndiComponentAdapter.getComponentInstance(CachingJndiComponentAdapter.java:37)
at org.picocontainer.defaults.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:395)
at org.picocontainer.defaults.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:375)
at org.picocontainer.defaults.BasicComponentParameter.resolveInstance(BasicComponentParameter.java:77)
at org.picocontainer.defaults.ComponentParameter.resolveInstance(ComponentParameter.java:114)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getConstructorArguments(ConstructorInjectionComponentAdapter.java:257)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:217)
at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
at org.picocontainer.defaults.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:395)
at org.picocontainer.defaults.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:375)
at net.uk.topdog.td2.common.client.app.ClientSideServiceLocator.getAdvertDao(ClientSideServiceLocator.java:178)
at net.uk.topdog.td2.common.client.server.facade.DaoFacade.createAdvertDao(DaoFacade.java:219)
at net.uk.topdog.td2.common.client.server.facade.DaoFacade.getAdvert(DaoFacade.java:208)
at net.uk.topdog.td2.common.client.server.facade.ServerFacade.getAdvert(ServerFacade.java:230)
at net.uk.topdog.td2.common.client.server.facade.AdvertManager.getAdvert(AdvertManager.java:80)
at net.uk.topdog.td2.common.client.advert.AbstractAdvertReceiver.loadAdvertList(AbstractAdvertReceiver.java:322)
at net.uk.topdog.td2.common.client.advert.AbstractAdvertReceiver$AdvertListResolver.doResolve(AbstractAdvertReceiver.java:63)
at net.uk.topdog.td2.common.client.advert.AbstractAdvertReceiver$AdvertListResolver.doResolve(AbstractAdvertReceiver.java:1)
at net.uk.topdog.td2.common.util.Resolver$ResolveJob.run(Resolver.java:25)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.io.FileNotFoundException: http://10.0.0.17:8080/invoker/HAJNDIFactory,http://10.0.0.100:8080/invoker/HAJNDIFactory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:133)
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:80)
... 30 more
Caused by: java.io.FileNotFoundException: http://10.0.0.17:8080/invoker/HAJNDIFactory,http://10.0.0.100:8080/invoker/HAJNDIFactory
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.URLConnection.getHeaderFieldInt(Unknown Source)
at java.net.URLConnection.getContentLength(Unknown Source)
at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:128)
... 31 more -
6. Re: HAJNDI over HTTP
brian.stansberry Feb 5, 2007 10:30 AM (in response to mindflyer)Seems the HttpNamingContextFactory doesn't have to logic built into it to parse multiple URLs.
Also, I've been looking at this code and the naming proxy you'll get won't have automatic loadbalancing, failure detection and failover in it.
Probably the way to go is to use a loadbalancer. If you did that I think you'd want to set your java.naming.provider.url to point to the loadbalancer:
java.naming.provider.url=http://loadbalancer/invoker/HAJNDIFactory
Also, in /deploy/httpha-invker.sar/META-INF/jboss-service.xml, edit the jboss:service=invoker,type=http,target=HAJNDI mbean. Remove the InvokerURLPrefix, InvokerURLSuffix and UseHostName attributes and add
http://loadbalancer/invoker/JMXInvokerHAServlet
This will cause the naming proxies to point to the loadbalancer.
I haven't tried this, so don't know if there are further gotchas. -