EDIT:
Found the solution. It was a problem with minifing the code while maven build process. Run the OrientDB in a Java Applet is possible.
I have problems starting the inmemory OrientDB in a Java Applet. I use a signed Applet with OrientDB version 1.0.1. Did someone implemented the OrientDB in a Applet and can verify that this is possible or could help me with this exception?
The exception I get:
2012-06-20 11:22:24:734 INFO OrientDB Server v1.0.1 is starting up... [OServer]Exception in thread "thread applet-de.test.all.Applet-1" sun.misc.ServiceConfigurationError: com.orientechnologies.orient.core.sql.OCommandExecutorSQLFactory: Provider com.orientechnologies.orient.core.sql.ODefaultCommandExecutorSQLFactory not found
at sun.misc.Service.fail(Service.java:129)
at sun.misc.Service.access$000(Service.java:111)
at sun.misc.Service$LazyIterator.next(Service.java:273)
at com.orientechnologies.orient.core.sql.OSQLEngine.getCommandFactories(OSQLEngine.java:186)
at com.orientechnologies.orient.core.sql.OSQLEngine.getCommandNames(OSQLEngine.java:216)
at com.orientechnologies.orient.core.sql.OSQLEngine.getCommand(OSQLEngine.java:239)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:41)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:31)
at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:62)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:60)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:218)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:164)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:145)
at com.orientechnologies.orient.core.metadata.schema.OSchemaShared.createClass(OSchemaShared.java:116)
at com.orientechnologies.orient.core.metadata.schema.OSchemaProxy.createClass(OSchemaProxy.java:65)
at com.orientechnologies.orient.core.metadata.security.OSecurityShared.createMetadata(OSecurityShared.java:259)
at com.orientechnologies.orient.core.metadata.security.OSecurityShared.create(OSecurityShared.java:202)
at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.create(OSecurityProxy.java:37)
at com.orientechnologies.orient.core.metadata.OMetadata.create(OMetadata.java:68)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.create(ODatabaseRecordAbstract.java:171)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.create(ODatabaseWrapperAbstract.java:53)
at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.create(ODatabaseRecordWrapperAbstract.java:54)
at com.orientechnologies.orient.server.OServer.loadStorages(OServer.java:451)
at com.orientechnologies.orient.server.OServer.loadConfiguration(OServer.java:394)
at com.orientechnologies.orient.server.OServer.startup(OServer.java:152)
at com.orientechnologies.orient.server.OServer.startup(OServer.java:143)
at com.orientechnologies.orient.server.OServer.startup(OServer.java:132)
at de.test.all.Applet$1.run(Applet.java:132)
at de.test.all.Applet$1.run(Applet.java:125)
at java.security.AccessController.doPrivileged(Native Method)
at de.test.all.Applet.init(Applet.java:124)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1639)
at java.lang.Thread.run(Thread.java:680)
My Applet code to start the DB:
public class Applet extends java.applet.Applet {
OrientDbConfigurationLoader configLoader = null;
OServer server = null;
ODatabaseDocumentTx db = null;
#Override
public void init() {
AccessController.doPrivileged(new
PrivilegedAction<OServer>() {
public OServer run() {
configLoader = new OrientDbConfigurationLoader("db/", "test");
try {
server = OServerMain.create();
server.startup(configLoader.loadDefaultConfig());
server.activate();
} catch (InstanceAlreadyExistsException e) {
server = OServerMain.server();
} catch (Exception e) {
System.out.println("Something went wrong while the server should start");
e.printStackTrace();
}
try {
db = new ODatabaseDocumentTx("memory:temp");
db = db.open(OrientDbConfigurationLoader.USERNAME, OrientDbConfigurationLoader.PASSWORD);
} catch (Exception e) {
System.out.println("Can't init the in-memory db.");
e.printStackTrace();
}
return null;
}
});
}
}
the problem seems the usage of Java Service Registry. Look at:
OClassLoaderHelper.lookupProviderWithOrientClassLoader()
it calls:
ServiceRegistry.lookupProviders(clazz);
I've just added in SVN trunk (r5909) this check:
try {
factories.add(ite.next());
} catch (Exception e) {
OLogManager.instance().warn(null, "Cannot load OCommandExecutorSQLFactory instance from service registry", e);
}
In this way a WARN is dumped but you can continue to configure your own factories if needed.
Related
I am writing a sample program using HCatalogue Streaming api
I have a running hadoop, Hiveserver and a Hivemetastore server.
I write a java program to connect to hive metastore.The source code is given below
public class HCatalogueStreamingclient {
public static void main(String[] args) {
System.setProperty("hadoop.home.dir", "E:\\midhun\\hadoop\\hive\\winutils");
String dbName = "hive_streaming";
String tblName = "alerts";
ArrayList<String> partitionVals = new ArrayList<String>(2);
partitionVals.add("Asia");
partitionVals.add("India");
HiveEndPoint hiveEP = new HiveEndPoint("thrift://192.168.10.149:8000", dbName, tblName, partitionVals);
HiveConf conf = new HiveConf();
conf.set("hive.exec.scratchdir", "/tmp/hivetmp");
try {
StreamingConnection connection = hiveEP.newConnection(true,conf);
} catch (ConnectionError e) {
e.printStackTrace();
} catch (InvalidPartition e) {
e.printStackTrace();
} catch (InvalidTable e) {
e.printStackTrace();
} catch (PartitionCreationFailed e) {
e.printStackTrace();
} catch (ImpersonationFailed e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
While running the program I am getting following exception
Exception in thread "main" java.lang.RuntimeException: The root scratch dir: /tmp/hivetmp on HDFS should be writable. Current permissions are: rw-rw-rw-
at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:690)
at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:622)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:550)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:513)
at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.createPartitionIfNotExists(HiveEndPoint.java:445)
at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.<init>(HiveEndPoint.java:314)
at org.apache.hive.hcatalog.streaming.HiveEndPoint$ConnectionImpl.<init>(HiveEndPoint.java:278)
at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnectionImpl(HiveEndPoint.java:215)
at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnection(HiveEndPoint.java:192)
at org.apache.hive.hcatalog.streaming.HiveEndPoint.newConnection(HiveEndPoint.java:113)
at com.mj.HCatalogueStreamingclient.main(HCatalogueStreamingclient.java:27)
Any one have an Idea on how to grand write permission to the hdfs folder /tmp/hivetmp
The problem is identified.
We need to grand all permission for hadoop directory /tmp/hivetmp.The command for granding permission is $HADOOP_HOME/bin/hadoop fs -chmod 777 -R /tmp/hivetmp
I was running the program in Windows 7 64 bit OS.We need to download winutils appropriate to the operating system and version.
After doing above given points I was able to establish connection using Hive HCatalogue Streaming api
I simply start up a zookeeper server (3.4.6) with using the org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ServerConfig) method, then I try to shut it down. During shutdown I get this:
11:43:11,176 WARN {main} [org.apache.zookeeper.jmx.MBeanRegistry] Failed to unregister MBean InMemoryDataTree
11:43:11,176 WARN {main} [org.apache.zookeeper.jmx.MBeanRegistry] Error during unregister
javax.management.InstanceNotFoundException: org.apache.ZooKeeperService:name0=StandaloneServer_port-1,name1=InMemoryDataTree
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546)
at org.apache.zookeeper.jmx.MBeanRegistry.unregister(MBeanRegistry.java:115)
at org.apache.zookeeper.jmx.MBeanRegistry.unregister(MBeanRegistry.java:132)
at org.apache.zookeeper.server.ZooKeeperServer.unregisterJMX(ZooKeeperServer.java:465)
at org.apache.zookeeper.server.ZooKeeperServer.shutdown(ZooKeeperServer.java:458)
at org.apache.zookeeper.server.NIOServerCnxnFactory.shutdown(NIOServerCnxnFactory.java:271)
at org.apache.zookeeper.server.ZooKeeperServerMain.shutdown(ZooKeeperServerMain.java:132)
...
I have unfortunately no idea what the error Failed to unregister MBean InMemoryDataTree means. I did not find anything with search engines apart from logs from some project builds. I could read the code, but it would take obviously a lot of time to understand that.
Do I have to change something in my startup process to get rid of this, or is this completely normal?
The logs indicate that it is a warning, and from looking into the source and comments, can largely be ignored. In my experience I do not recall seeing those particular messages, but kept running into run time exceptions/errors that kept subsequent unit tests from running and caused my gradle build to exit the test task without generating the report.
I have no idea how you were trying to shut down ZookeeperServerMain, but my work around was to extend ZookeeperServerMain so I could access its protected shutdown method.
public class MyZookeeperServerMain extends ZookeeperServerMain{
...
public void openZoo() {
/**/
Properties startupProperties = createProperties(DEFAULT_LOG_DIR, 2181);
QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
try {
quorumConfiguration.parseProperties(startupProperties);
} catch (Exception e) {
throw new RuntimeException(e);
}
zooKeeperServer = new MyZookeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);
zooEntrance = new Thread() {
public void run() {
try {
zooKeeperServer.runFromConfig(configuration);
}
catch (IOException e) {
LOG.error("ZooKeeper Failed", e);
}
catch(Exception ie)
{
LOG.debug("shutting down zookeeper", ie);
}
catch(Error e)
{
System.out.println("error stopping zooKeeper: " + e);
}
}
};
zooEntrance.start();
}
public void closeZoo() {
zooKeeperServer.shutdown();
}
}
So here it is my program:
public static void main(String[] args) {
UsbServices services = null;
try {
services = UsbHostManager.getUsbServices();
hub = services.getRootUsbHub();
} catch (SecurityException | UsbException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
And I have created the file 'javax.usb.properties' with inside:
javax.usb.services = org.usb4java.javax.Services
Like it's said in the documentation
At the moment of 'getRootUsbHub()' I have this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/builder/HashCodeBuilder
Does someone know why the method getRootUsbHub() doesn't work ?
You miss the commons-lang3.jar in your classpath. Download and add it.
I'm trying to access my database while using SqlJet Transactions, but I get this error all the time
org.tmatesoft.sqljet.core.SqlJetException: MISUSE: error code is MISUSE
Here is my code:
SqlJetDb db = null;
try {
File dbFile = new File(Configuration.DATABASE_NAME);
db = SqlJetDb.open(dbFile, true);
db.getOptions().setAutovacuum(true);
db.beginTransaction(SqlJetTransactionMode.READ_ONLY);
ISqlJetTable table = db.getTable("customers");
ISqlJetCursor cursor = table.order(table.getPrimaryKeyIndexName());
if (!cursor.eof()) {
do {
getInitData(cursor);
} while (cursor.next());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
db.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
Does anybody know what's wrong with the issue? Due to this list, the actuall library usage was improper, but I've checked it out and there wasn't anything wrong to me. http://grepcode.com/file/repo1.maven.org/maven2/org.tmatesoft.sqljet/sqljet/1.0.2/org/tmatesoft/sqljet/core/SqlJetErrorCode.java#SqlJetErrorCode
Thanks!
It happens because you are trying to open a DB that is already opened by another process .
it happened to me because the db was opened by Firefox SQLite Manager, but basically it could happen by any other thread or process accessing your DB .
This question already has answers here:
java.rmi.NoSuchObjectException: no such object in table
(7 answers)
Closed 3 years ago.
My goal is to create a Distributed computing program that launches a server and client at the same time. I need it to be able to install on a couple of machines and have all the machines communicating with each other, i.e. Master node and 5 slave nodes all from one application.
My problem is that I cannot properly use unicastRef, I'm thinking that it is a problem with launching everything on the same port, is there a better way I am overlooking?
this is part of my code (the part that matters)
try {
RMIServer obj = new RMIServer();
obj.start(5225);
} catch (Exception e) {
e.printStackTrace();
}
try {
System.out.println("We are slave's ");
Registry rr = LocateRegistry.getRegistry("127.0.0.1", Store.PORT, new RClient());
Call ss = (Call) rr.lookup("FILLER");
System.out.println(ss.getHello());
} catch (Exception e) {
e.printStackTrace();
}
}
this is my main class (above)
this is the server class (below)
public RMIServer() {
}
public void start(int port) throws Exception {
try {
Registry registry = LocateRegistry.createRegistry(port, new RClient(), new RServer());
Call stuff = new Call();
registry.bind("FILLER", stuff);
System.out.println("Server ready");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
I don't know what I am missing or what I am overlooking but the output looks like this.
Listen on 5225
Listen on 8776
Server ready
We are slave's
Listen on 8776
java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at Main.main(Main.java:62)
line 62 is this ::: Call ss = (Call) rr.lookup("FILLER");
Maybe it's because your reference to the stub in your server class is local to the try block and the reference is immediately garbage collected after. Try making stuff a class variable instead.