I'm trying to deploy Infinispan cluster where each node running embedded HotRod server :
new HotRodServer().start(new HotRodServerConfigurationBuilder().host("10.1.1.6").port(11322).build(),
new DefaultCacheManager("infinispan.xml"));
client :
remoteCache = new RemoteCacheManager().getCache("myCache");
client cfg:
infinispan.client.hotrod.server_list=10.1.1.6:11322
The problem is that remoteCache is empty although I'm sure the JPA loader defined in infinispan.xml does it's work and I see positive entities count in jconsole for myCache entry.
Am I missing something ?
Another question : how do I expose REST endpoint on HotRod server started this way ?
dependencies :
'org.infinispan:infinispan-server-hotrod:5.3.0.Final',
'org.infinispan:infinispan-core:5.3.0.Final',
'org.infinispan:infinispan-cachestore-jpa:5.3.0.Final',
'org.infinispan:infinispan-client-hotrod:5.3.0.Final',
Thanks
Related
I am using R2DBC-H2 driver, and my UR.L is spring.r2dbc.url=r2dbc:h2:mem:///customer
Using this configuration, SpringBoot starts fine, however, I can not access the h2-console.
Does anybody know why, and how I can fix it?
If I understand the source code of H2ConsoleAutoConfiguration correctly, the h2 console auto configuration from spring boot does not work in a reactive environment.
...
#ConditionalOnWebApplication(type = Type.SERVLET)
...
public class H2ConsoleAutoConfiguration {
You can confirm this by yourself by changing the type of your web application to SERVLET (for example, by adding spring-boot-starter-web as a dependency) which will activate the route to the h2 console (if enabled in the application properties). The h2-console route endpoint will start working again.
As the whole code seems very servlet-specific, I don't know how to properly fix this problem.
H2 Console depends on traditional Jdbc drivers, not compatible with Spring WebFlux stack.
If you are developing a WebFlux application, you can use H2 as a standalone database, ane use H2 Console freely.
Following the official Getting Started guide to start H2 Database and H2 Console.
Set your spring.r2dbc.url to the database url you are running in the first step.
NOTE: Do not use a Memory DB here.
I am having an application which is using the IgniteDb as a cache provider .It uses the discovery url as:
127.0.0.1:47500..47509.
Now i want to connect to this cache using java code in eclipse. I have written the code as:
IgniteConfiguration cfg = new IgniteConfiguration().setBinaryConfiguration(
new BinaryConfiguration().setNameMapper(new BinaryBasicNameMapper(true)));
TcpDiscoveryMulticastIpFinder discoveryMulticastIpFinder = new TcpDiscoveryMulticastIpFinder();
Set<String> set = new HashSet<>();
set.add("127.0.0.1:47500..47509");
cfg.setPeerClassLoadingEnabled (true);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoveryMulticastIpFinder.setAddresses(set);
discoverySpi.setNetworkTimeout (5000);
discoverySpi.setClientReconnectDisabled(true);
cfg.setDiscoverySpi(discoverySpi);
discoverySpi.setIpFinder(discoveryMulticastIpFinder);
cfg.setDiscoverySpi(discoverySpi);
Ignite ignite = Ignition.getOrStart(cfg);
IgniteCache<Integer, Person> cache = ignite.getOrCreateCache("person");
// Code to call cache put or get here
// putCache(cache);
//getCache(cache);
System.out.println("All Available Cache on server : "+ignite.cacheNames());
But on running the erro i am getting the error as:
Caused by: class org.apache.ignite.spi.IgniteSpiException: Local node and remote node have different version numbers
(node will not join, Ignite does not support rolling updates, so versions must be exactly the same)
[locBuildVer=2.7.5, rmtBuildVer=2.8.0,
locNodeAddrs=[aschauha-t470.apac.tibco.com/0:0:0:0:0:0:0:1, aschauha-t470.apac.tibco.com/10.98.51.252, /127.0.0.1, /192.168.0.101],
rmtNodeAddrs=[aschauha-t470.apac.tibco.com/0:0:0:0:0:0:0:1, aschauha-t470.apac.tibco.com/10.98.51.252, /127.0.0.1, /192.168.0.101],
locNodeId=e66eeea7-5427-4fe7-8368-884641af534b, rmtNodeId=35ad5deb-d212-4a85-812e-ec7d44caa4a8]
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:1997)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:1116)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:427)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:2099)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
... 10 more
Please help me in resolving the issue.
Also, the code which i mentioned above, is it the right way of connecting to the ignite db acting as cache for application?
Error message tells everything needed:
Caused by: class org.apache.ignite.spi.IgniteSpiException: Local node and remote node have different version numbers
(node will not join, Ignite does not support rolling updates, so versions must be exactly the same)
[locBuildVer=2.7.5, rmtBuildVer=2.8.0,
Ignite supports clusters from the same nodes only, so, you should either upgrade your local node to 2.8.0 or downgrade remote node to 2.7.5.
Context: Existing JavaSE application written in Swing which fires up an embedded server (so far it was Jetty) but we need to switch to Java EE, so we thought about bringing in an enterprise container (candidates are: Payara, Tomee, Wildfly).
The server should be able to run a web app based on dynamic input: web context, with its own web.xml, specific web resources which are not known at build time, so uber jar is not really an option for us.
We have successfully started a web app on Payara using code like the following (this is not working code, but it shows the steps we took for using Payara)
GlassFish glassfish;
WebContainer container;
GlassFishRuntime glassfishRuntime = = GlassFishRuntime.bootstrap();
glassfish = glassfishRuntime.newGlassFish();
glassfish.start();
// Access WebContainer
container = glassfish.getService(WebContainer.class);
WebContainerConfig config = new WebContainerConfig();
container.setConfiguration(config);
Context context = container.createContext(contextPathLocation);
m_webAppContexts.put(p_contextName, context);
WebListener listener = container.createWebListener("listener-1", HttpListener.class);
listener.setPort(myDynamicPortNumber);
container.addWebListener(listener);
container.addContext(context, myDynamicContextPath);
context.addServlet(myDynamicMapping, myServletName);
This is all working and a basic web application starts in Payara when invoked from our Java SE application.
We also have a fragment of web.xml declaring additional servlets that we want to bring in this dynamic deployment if given conditions are satisfied.
What is the best way to override the existing web.xml with fragments from another web.xml? We need pointers to documentation, directions from more experienced Payara users.
This is not possible with Payara or Wildfly, as they work very differently from how Jetty works.
However, it is possible with Tomee.
I am trying to setup Hazelcast cluster in my LAN. There are two open fire server openfire1 and openfire2 behind a HAProxy sharing a common db server.
I have installed and configured open fire and hazelcast on both. Now when I see from Openfire Admin Console in the clustering section: My openfire1 is not listing the other node in cluster. openfire2 also does not allow me to enable cluster,whenever I see the error I see following log:
2014.12.06 12:12:46 com.jivesoftware.util.cache.ClusteredCacheFactory - Failed to execute cluster task within 30 seconds
java.util.concurrent.TimeoutException
at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.resolveResponse(Invocati onImpl.java:466)
at com.hazelcast.spi.impl.InvocationImpl$InvocationFuture.get(InvocationImpl.java: 314)
at com.hazelcast.util.executor.DelegatingFuture.get(DelegatingFuture.java:66)
at com.jivesoftware.util.cache.ClusteredCacheFactory.doSynchronousClusterTask(Clus teredCacheFactory.java:334)
at org.jivesoftware.util.cache.CacheFactory.doSynchronousClusterTask(CacheFactory. java:586)
at org.jivesoftware.openfire.admin.system_002dclustering_jsp._jspService(system_00 2dclustering_jsp.java:123)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1359)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11 8)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)
at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:74)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)
at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingF ilter.java:50)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1330)
at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:78)
Plz tell me if i am doing something wrong ?
now i have overcome this problem only by using the correct version of hazlecast.jar corresponding to openfire 3.9.3 ;The Hazelcast plugin version corresponding to the Openfire release (3.9.3) is 1.2.0 .
Direct link to download : https://community.igniterealtime.org/external-link.jspa?url=http%3A%2F%2Fwww.igniterealtime.org%2Fprojects%2Fopenfire%2Fplugins-dev%2Fhazelcast.jar
I am porting a suite of related applications from WebLogic to JBoss EAP v6.2.
I have set up a data source connection using the JBoss command line interface and hooked it to an oracle database. This database has a name of "mydatasource" and a JNDI name of
"java:jboss/datasources/mydatasource" as per JBoss standards. I can test and validate this database connection.
However, when I try to port the code and run it, the connection doesn't work. The code that worked in WebLogic was simply:
InitialContext ic = new InitialContext() ;
DataSource ds = (DataSource)ic.lookup(dataSource) ;
with a value in dataSource of "mydatasource".
This worked in Web Logic but in JBoss it throws a NameNotFoundException
javax.naming.NameNotFoundException: mydatasource-- service jboss.naming.context.java.mydatasource
Clearly there is a difference in how the InitialContext is set up between the two servers.
But this port involves a large number of small applications, all of which connect to the datasource via code like that above. I don't want to rewrite all that code.
Is there a way through configuration (InitialContextFactory, maybe) to define the initial context such that code like that above will work without rewriting, or perhaps is there another way of naming the datasource that JBoss will accept that would allow code like that above to work without rewriting?
Or must we bite the bullet and accept that this code needs a rewrite?
Update: Yes, I know that simply passing "java:jboss/datasources/mydatasource" to the InitialContext lookup solves the problem, but I am looking for a solution via configuration, rather than via coding if there is such a solution.
The way to do this correctly through configuration is to use
java:comp/env/jdbc/myDataSource
then use resource-ref in web.xml to map it to the declare datasource and use weblogic.xml or jboss-web.xml to actually map it to the real one
in weblogic admin console, when you define datasource it can be jdbc/realDataSource
JNDI path Tomcat vs. Jboss
For weblogic http://docs.oracle.com/cd/E13222_01/wls/docs103/jdbc_admin/packagedjdbc.html