Thanks for the reply

I probably did something wrong because now it's working. 
There is mistake in 

OObjectDatabaseTx db = OObjectDatabasePool.global().acquire(
"local:c:/tmp/odb", "admin","admin");
and shold be only 'dbPool' instead 'OObjectDatabaseTx db'.

Anyway, there is warning when deploying:
WARNING:   Sun Unsafe direct  memory implementation is going to be used, 
this implementation isnot stable so please use JNA version instead.

And an error when undeploying:
SEVERE:   The web application [/OrientDB_WebTest] created a ThreadLocal with 
key 
of type[com.orientechnologies.orient.core.db.OScenarioThreadLocal] (value [
com.orientechnologies.orient.core.db.OScenarioThreadLocal@186807a8]) and a 
value of type [com.orientechnologies.orient.core.db.OScenarioThreadLocal.
RUN_MODE] (value [DEFAULT]) but failed to remove it when the web 
application was stopped. Threads are going to be renewed over time to try 
and avoid a probable memory leak.
I know close() method only release it to the owner pool, but what's the 
proper way to close all pool?

Also I have an error when I'm trying to open "remote:localhost/tmp/odb" 
similar way like in OreintDB documentation.
SEVERE:   Startup of context /OrientDB_WebTest failed due to previous errors
SEVERE:   Exception during cleanup after start failed
org.apache.catalina.LifecycleException: Manager has not yet been started
      at org.apache.catalina.session.StandardManager.stop(StandardManager.
java:934) ...

What's the correct way for access to the database?
Should I use ServletContextListener just for register all entity classes 
and then open the database in EJB or servlet each time I need access to 
database? 
OObjectDatabaseTx db = OObjectDatabasePool.global().acquire(
"plocal:c:/tmp/odb", "admin","admin");
...
db.close();

Cheers,
Tomek

On Thursday, April 10, 2014 9:03:12 AM UTC+2, Riccardo Tasso wrote:
>
> First of all I suggest to use the plocal engine.
>
> What kind of error do you receive?
>
> Cheers,
>    Riccardo
>
>
> 2014-04-10 0:14 GMT+02:00 Tomek <[email protected] <javascript:>>:
>
>> Could you please tell me what is the correct way to make orientDB 
>> connection pool?
>>
>> I'm trying something like this, but it's doesn't work.
>> import com.orientechnologies.orient.core.exception.OStorageException;
>> import com.orientechnologies.orient.object.db.OObjectDatabasePool;
>> import com.orientechnologies.orient.object.db.OObjectDatabaseTx;
>> import javax.servlet.ServletContextEvent;
>> import javax.servlet.ServletContextListener;
>>
>> public class AppServletContextListener implements ServletContextListener {
>>
>>     private OObjectDatabaseTx dbPool = null;
>>
>>     @Override
>>     public void contextInitialized(ServletContextEvent sce) {
>>        // OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue( false );
>>         try {
>>             
>>             OObjectDatabaseTx db = 
>> OObjectDatabasePool.global().acquire("local:c:/tmp/odb", "admin", "admin");
>>         } catch (OStorageException exc) {
>>             dbPool = new OObjectDatabaseTx("local:c:/tmp/odb");
>>             dbPool.create();
>>         }
>>         dbPool.getEntityManager().registerEntityClasses("pojo");
>>     }
>>
>>     @Override
>>     public void contextDestroyed(ServletContextEvent sce) {
>>         if (dbPool != null && !dbPool.isClosed()) {
>>             dbPool.close();
>>         }
>>     }
>> }
>>
>> with     
>> <listener>
>>         <listener-class>AppServletContextListener</listener-class>
>> </listener>
>> in web.xml
>>
>> I'm using GlassFish. I also tried to connect using Connectior connecting 
>> pool and glassfish-resources.xml, but with no success too:(
>>
>> What's the correct way to get conncetion pool, and than to get thread for 
>> use in application response?
>>
>> Maybe you could send me a working example if you already have one? ( my 
>> mail: [email protected] <javascript:> )
>>
>> best regards
>> Tomek
>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to