I have a util method that deploys a service on Ignite:
private static void startNewService(String queryId, String sqlQuery, long timeInterval) {
QueryServiceImpl cepService = new QueryServiceImpl(queryId, sqlQuery, timeInterval);
ServiceConfiguration cfg = new ServiceConfiguration();
cfg.setService(cepService);
cfg.setName(queryId);
cfg.setTotalCount(1);
cfg.setMaxPerNodeCount(1);
System.out.println("---- Deploying the service. "+queryId);
services.deploy(cfg);
System.out.println("---- Deployed the service. "+queryId);
}
When I run this from my client machine, I get the following error in the server machines:
[12:13:26,640][SEVERE][srvc-deploy-#35%myGrid%][GridServiceProcessor] Failed to initialize service (service will not be deployed): Query1
class org.apache.ignite.IgniteCheckedException: com.demo.ignite.service.QueryServiceImpl
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9739)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.copyAndInject(GridServiceProcessor.java:1206)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.redeploy(GridServiceProcessor.java:1127)
at org.apache.ignite.internal.processors.service.GridServiceProcessor.processAssignment(GridServiceProcessor.java:1750)
......
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: com.demo.ignite.service.QueryServiceImpl
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:695)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1755)
....
Caused by: java.lang.ClassNotFoundException: com.demo.ignite.service.QueryServiceImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
....
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8465)
at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:347)
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:686)
My QueryServiceImpl implements Service, QueryService where QueryService is an interface with a method runContinuousQuery().
Please note that I have not manually copied this jar/class to the server classpath. I am expecting ignite to load the required classes to the Ignite server nodes and run the service there. How can I do this?
Currently peer deployment is not supported for services, so your service should be on the classpath for every node. You can find a note about it in the documentation: https://apacheignite.readme.io/docs/service-grid
Related
Apache ignite .net client node fails to start with below error, any idea what could be the reason?
Exception : class org.apache.ignite.IgniteCheckedException: Failed to complete exchange process. Apache.Ignite.Core.Cache.CacheException
StackTrace:
at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutObject(Int32 type, Action`1 writeAction)
at Apache.Ignite.Core.Impl.Ignite.GetOrCreateCache[TK,TV](CacheConfiguration configuration, NearCacheConfiguration nearConfiguration, PlatformCacheConfiguration platformCacheConfiguration, Op op)
at Apache.Ignite.Core.Impl.Ignite.GetOrCreateCache[TK,TV](CacheConfiguration configuration, NearCacheConfiguration nearConfiguration, PlatformCacheConfiguration platformCacheConfiguration)
at Apache.Ignite.Core.Impl.Ignite.GetOrCreateCache[TK,TV](CacheConfiguration configuration, NearCacheConfiguration nearConfiguration)
NOTE: I am trying to implement Read/Write through in Ignite .net 5.
I'm using Apache ignite without any integration with database. I'm getting following exception on my windows machine. After investigating, found that ports for which I'm getting error are used by ODBC driver.
https://apacheignite.readme.io/v1.7/docs/connecting-string
I don't know if its required by Ignite but if now can we disable ODBC/JDBC driver loading, so that it doesn't need those ports.
org.apache.ignite.IgniteCheckedException: Failed to start processor: GridProcessorAdapter []
at org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1741)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:987)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2014)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1723)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1151)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:671)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:596)
at org.apache.ignite.Ignition.start(Ignition.java:327)
at framework.cache.CacheManager.initialize(CacheManager.java:129)
Caused by: org.apache.ignite.IgniteCheckedException: Failed to start client connector processor.
at org.apache.ignite.internal.processors.odbc.ClientListenerProcessor.start(ClientListenerProcessor.java:175)
at org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1738)
... 10 common frames omitted
Caused by: org.apache.ignite.IgniteCheckedException: Failed to bind to any [host:port] from the range [host=null, portFrom=10800, portTo=10900, lastErr=class org.apache.ignite.IgniteCheckedException: Failed to initialize NIO selector.]
at org.apache.ignite.internal.processors.odbc.ClientListenerProcessor.start(ClientListenerProcessor.java:171)
... 11 common frames omitted
To prevent Ignite from binding to JDBC/ODBC ports, you should set IgniteConfiguration#clientConnectorConfiguration to null.
If you just set odbcEnabled and jdbcEnabled to false, then Ignite will still bind to this port, but JDBC and ODBC connections won't be processed.
This follows on from "How to access JMX interface in docker from outside?" which talks about setting up unencrypted JMX connections.
I could use either RMI or JMXMP which Glassfish uses.
There is a set of JVM options that are required and I'm looking for the changes I need to set up JMX with SSL:
com.sun.management.jmxremote=true
com.sun.management.jmxremote.local.only=false
com.sun.management.jmxremote.ssl=true
com.sun.management.jmxremote.authenticate=true
com.sun.management.jmxremote.port=12345
com.sun.management.jmxremote.rmi.port=12346
java.rmi.server.hostname=10.11.12.176
com.sun.management.jmxremote.access.file=/.secure/jmxremote.access
com.sun.management.jmxremote.password.file=/.secure/jmxremote.pass
com.sun.management.jmxremote.login.config=ldap-ad-config
java.net.preferIPv4Stack=true
com.sun.management.jmxremote.ssl.config.file=/.secure/jmxremotessl.properties
javax.net.ssl.keyStore=/config/app.jks
javax.net.ssl.keyStorePassword=teabag
javax.net.ssl.trustStore=/config/cacerts
javax.net.ssl.trustStorePassword=milk
The problem is the same:
java.rmi.ConnectException: Connection refused to host: 172.0.0.85; nested exception is
java.net.ConnectException: Operation timed out
That IP address is the internal IP address of the docker container. I assume that this is happening despite the java.rmi.server.hostname solution because it's on SSL.
I tried to reverse proxy the SSL to non-SSL with nginx but that failed with the error
java.rmi.ConnectIOException: non-JRMP server at remote endpoint
so I guess I should be forwarding extra headers in nginx.
I'm now attempting to set up JMXMP but the documentation on how to do it is pretty thin on the ground. There's a Spring implementation and a Glassfish implementation but not with findable docs (as yet) - so I'm adding the glassfish tag.
The answer is that I can set up my app to use JMXMP and configure it to implement TLS connections using these JVM options:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=true
-Dcom.sun.management.jmxremote.access.file=C:/dev/.secure/jmxremote.access
-Dcom.sun.management.jmxremote.password.file=C:/dev/.secure/jmxremote.pass
-Dcom.sun.management.jmxremote.login.config=spnego-server
-Djava.net.preferIPv4Stack=true
-Dcom.sun.management.jmxremote.ssl.config.file=/.secure/jmxremotessl.properties
however I have to code up a configuration class to launch the JMXConnectorServer like so:
#Configuration
public class JmxServer {
public JmxServer(
#Value("${jmx.remote.hostname}") final String hostname,
#Value("${jmx.remote.port}") final String port) {
try {
Map<String, Object> env = new HashMap<>();
env.put("jmx.remote.profiles", "TLS SASL/PLAIN");
env.put(JMXConnector.CREDENTIALS,
new String[] {"myusername", "password"});
JMXConnectorServerFactory.newJMXConnectorServer(
new JMXServiceURL(
String.format("service:jmx:jmxmp://%s:%s",
hostname, port)),
env,
ManagementFactory.getPlatformMBeanServer()
).start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
But this is only half of it. I am now wrangling with JConsole to get it to do JMXMP with TLS.
For that I'm following this fossil question from 2007 on the Oracle forums:
Can JConsole connect to a remote JMX agent using JMXMP and TLS?
but still struggling...
I am working on ehcache replication using RMI for the first time. I am not able to get pass through the below error.
The root cause from the below stack trace shows:
Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.distribution.RMICachePeer_Stub (no security manager: RMI class loader disabled)
I am using jdk1.6.0_16 with weblogic 12c and I have already tried below ways but didnt get any success.
Added the ehcache jar to the classpath. set CLASSPATH=%CLASSPATH%;C:\Oracle\Middleware\wlserver_12.1\server\lib\ehcache-2.8.3.jar;
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djava.security.manager -Djava.security.policy==C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.policy -Djava.rmi.server.codebase=file:///C:/Oracle/Middleware/wlserver_12.1/server/lib/ehcache-2.8.3.jar
set the System.setSecurityManager(new RMISecurityManager()) on the application startup.
Any help is appreciated.
Caused by: org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Problem starting listener for RMICachePeer //localhost:40001/com.wipro.dms.digi.domain.Location. Initial cause was
RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: net.sf.ehcache.distribution.RMICachePeer_Stub (no security manager: RMI class loader disabled)
I am trying to write a sample program for JMS using Jboss. I went through the following link for how to use Jboss for JMS
http://docs.jboss.org/jbossmessaging/docs/usermanual-2.0.0.beta1/html/using-jms.html
I am getting an exception while looking up for ConnectionFactory i.e. "iniCtx.lookup("ConnectionFactory")"
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1058)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1127)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:478)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(Unknown Source)
at MessageProducer.main(MessageProducer.java:46)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(Unknown Source)
at java.net.DatagramSocket.receive(Unknown Source)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1038)
The reason is, Jboss Naming Service is not running(netstat -an doesn't show any result for port 1099) .
I didn't configure any specific setting for Naming Service. I let it to take default port 1099.
Am I missing any configuration? Kindly help me in running the Jboss naming service.
Specification :
Jboss : AS 7.1.1 Final
JRE : 1.6
OS : Windows 7
Seems that you mixed Jboss version with manual version. AS7 does not use jnp and the jndi port is 4447.
So having following setup in standalone-full.xml
<security-enabled>false</security-enabled>
...
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
</jms-destinations>
I am able to connect with client, code as follows:
Connection connection = null;
InitialContext initialContext = null;
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://localhost:4447");
props.put(Context.SECURITY_PRINCIPAL, "appuser");
props.put(Context.SECURITY_CREDENTIALS, "password");
try {
// Step 1. Create an initial context to perform the JNDI lookup.
initialContext = new InitialContext(props);
// Step 2. Perfom a lookup on the queue
Queue queue = (Queue)initialContext.lookup("jms/queue/test");
// Step 3. Perform a lookup on the Connection Factory
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("jms/RemoteConnectionFactory");
// Step 4.Create a JMS Connection
connection = cf.createConnection();