Has anyone successfully configured JDO datanucleus default to google app engine to work on a local database?
Why am I always getting an error in jdoconfig.xml when I have specified the property "datanucleus.storeManagerType" with value "rdbms." at the end part.
I tried googling but seems no luck.
Caused by: org.datanucleus.exceptions.NucleusUserException: There is no available StoreManager of type "rdbms". Please make sure you have specified "datanucleus.storeManagerType" correctly and that all relevant plugins are in the CLASSPATH
<persistence-manager-factory name="postgresql">
<property name="datanucleus.mapping.Schema" value="jdo"/>
<property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
<property name="datanucleus.ConnectionDriverName" value="org.postgresql.Driver"/>
<property name="datanucleus.ConnectionURL" value="jdbc:postgresql://localhost:5432/jdo"/>
<property name="datanucleus.ConnectionUserName" value="jdo"/>
<property name="datanucleus.ConnectionPassword" value="jdo"/>
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
<property name="datanucleus.autoStartMechanism" value="None"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
<property name="datanucleus.validateTables" value="true"/>
<property name="datanucleus.validateConstraints" value="true"/>
<property name="datanucleus.validateColumns" value="true"/>
<property name="datanucleus.DetachAllOnCommit" value="true"/>
<property name="datanucleus.maxFetchDepth" value="1"/>
<property name="datanucleus.storeManagerType" value="rdbms"/>
code for PMF.java
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("postgresql");
I remember fixing this by including datanucleus-rdbms-X.Y.Z.jar in my WEB-INF/lib
When using another datastore aside from the default app-engine sdk's "transaction-optional" datastore, you need to use another web application container such as apache-tomcat or jetty in order for the rdbms driver classes (ie, postgresql.jar-org.postgresql.Driver, mysql.jar com.mysql.jdbc.Driver) to work since google app engine inhibits your application to use the java.net.socket.* which is used by the database drivers
Related
I've two different Camel webapp which is connected to an ActiveMQ's queues throught a JMS connection.
These two webapp are independents, they have differents queues, differents AMQ instance, but the JMS configuration is the same:
<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="pooledConnectionFactory" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="jmsTxManager" />
<property name="concurrentConsumers" value="10" />
<property name="testConnectionOnStartup" value="false" />
<property name="cacheLevelName" value="CACHE_CONSUMER" />
</bean>
On one of my webapp's AMQ's manager I can see that my DLQ have 10 consumers as defined in the property concurrentConsumers whereas my other webapp has 0 consumers on its DLQ (but other queues have the 10 expected consumers).
I thought that the concurrentConsumers parameter apply to every queues including automatically created DLQ. How can I add consumers to automatically created DeadLetterQueues?
I'm trying to have datanucleus manage my google cloud sql tables within a Google App Engine java application.
Sadly, I receive the following error message:
org.datanucleus.exceptions.ClassNotResolvedException: Class
"org.datanucleus.store.rdbms.RDBMSStoreManager" was not found
in the CLASSPATH. Please check your specification and your CLASSPATH.
But let's go with order. Here's my jdoconfig.xml
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory" />
<property name="javax.jdo.option.ConnectionURL" value="appengine" />
<property name="javax.jdo.option.NontransactionalRead"
value="true" />
<property name="javax.jdo.option.NontransactionalWrite"
value="true" />
<property name="javax.jdo.option.RetainValues" value="true" />
<property name="datanucleus.appengine.autoCreateDatastoreTxns"
value="false" />
<prop key="javax.jdo.option.Multithreaded">true</prop>
<property name="datanucleus.cache.level2" value="true" />
<property name="datanucleus.cache.level2.type" value="none"/>
<property name="datanucleus.cache.level1.type" value="soft"/>
<property name="datanucleus.appengine.storageVersion"
value="READ_OWNED_CHILD_KEYS_FROM_PARENTS"/>
</persistence-manager-factory>
<persistence-manager-factory name="cloud-sql">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory" />
<property name="javax.jdo.option.ConnectionDriverName"
value="com.mysql.jdbc.GoogleDriver"/>
<property name="javax.jdo.option.ConnectionUserName" value="root"/>
<property name="datanucleus.autoCreateSchema" value="true"/>
</persistence-manager-factory>
</jdoconfig>
The two persistence-manager-factory declarations are one for the app engine non-relational datastore, one for google cloud sql.
The exception is thrown during construction of my SQLManager. The constructor states
#Inject
public SQLManager(final NamedQueryProvider queryProvider) {
super(queryProvider);
final Map<String, String> properties = new HashMap();
properties.put("javax.jdo.option.ConnectionURL", getConnectionUrl());
pmFactory = JDOHelper.getPersistenceManagerFactory(properties,
"cloud-sql");
}
You can say: you must miss a required jar from the classpath. However, in my pom.xml there is
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-accessplatform-jdo-rdbms</artifactId>
<version>3.3.4</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.2.8</version>
</dependency>
The second artifact is actually unneeded, since is thrown in by the first. I've put it as an initial workaround, but it isn't working.
Anyone has something like an idea? There seems to be no documentation on datanucleus+jdo+cloud sql, but since I'm using it for accessing GAE datastore, I would like to reuse the same for cloud sql.
EDIT
Here's the relevant part of stack trace. Unfortunately, I'm unable to see in log in which jars app engine is looking for.
Class "org.datanucleus.store.rdbms.RDBMSStoreManager" was not found in the CLASSPATH.
Please check your specification and your CLASSPATH.
org.datanucleus.exceptions.ClassNotResolvedException: Class
"org.datanucleus.store.rdbms.RDBMSStoreManager" was not found in the CLASSPATH. Please
check your specification and your CLASSPATH.
at org.datanucleus.JDOClassLoaderResolver.classForName(JDOClassLoaderResolver.java:245)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:679)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:290)
at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:410)
at org.datanucleus.NucleusContext.initialise(NucleusContext.java:280)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:591)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:326)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1128)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:1093)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:960)
at com.mycompany.myproduct.mypackage.SQLManager.<init>(SQLManager.java:24)
The problem was a datanucleus jar versions mismatch.
I was using datanucleus-core, datanucleus-api-jdo etc at version 3.0.*, while datanucleus-rdbms 3.2. I've removed datanucleus-accessplatform-jdo-rdbms dependency, since I realized I didn't need all jars it brings in, and downgraded datanucleus-rdbms to 3.0.10 version. (Seems like datanucleus-appengine plugin is not yet supporting 3.2 series, that's why I preferred downgrade over upgrade).
Now I can connect to cloud sql fine.
I am trying to configure JDO on Appengine but every time I try to persist something I get an
java.lang.ClassNotFoundException: org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory
Searching for this error I only got that I could have an error in my jdoconfig.xml
But I explicitly declare that I want to use this class my jdoconfig.xml, which I posted below.
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
<property name="javax.jdo.option.ConnectionURL" value="appengine"/>
<property name="javax.jdo.option.NontransactionalRead" value="true"/>
<property name="javax.jdo.option.NontransactionalWrite" value="true"/>
<property name="javax.jdo.option.RetainValues" value="true"/>
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
</persistence-manager-factory>
</jdoconfig>
decide if you are using GAE JDO plugin v1.0 (JDO2.x) or GAE JDO plugin v2.0 (JDO3.0) which kinda decides which jars you have in the classpath, and hence what entries you put in your jdoconfig.xml
I'm having this error in my AppEngine project:
javax.persistence.PersistenceException: No persistence providers available for "transactions-optional" after trying the following discovered implementations: org.datanucleus.api.jpa.PersistenceProviderImpl
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:180)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70)
jdoconfig.xml
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.api.jdo.PersistenceManagerFactoryClass"/>
<property name="javax.jdo.option.ConnectionURL" value="appengine"/>
<property name="javax.jdo.option.NontransactionalRead" value="true"/>
<property name="javax.jdo.option.NontransactionalWrite" value="true"/>
<property name="javax.jdo.option.RetainValues" value="true"/>
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
<property name="datanucleus.appengine.singletonPMFForName" value="true"/>
</persistence-manager-factory>
</jdoconfig>
Its really weird since in my jdoconfig.xml there is this "transactions-optional"
Obviously JPA (which you use to get an EMF) doesn't use "jdoconfig.xml" (which is used by JDO). JPA uses "persistence.xml". Suggest you decide which API you're using before going further
I had Solr 1.2 up and running at port 8983 and using liferay 5.1.1 the question is how to configure solr to search at liferay JournalArticle table I've already installed solr-web plugin for liferay but it throws this exception
[SolrIndexSearcherImpl:79] Error while sending request to Solr
java.lang.ClassCastException: com.liferay.portal.kernel.util.HttpUtil cannot be cast to com.liferay.portal.kernel.util.HttpUtil
at com.liferay.portal.kernel.util.HttpUtil._getUtil(HttpUtil.java:317)
at com.liferay.portal.kernel.util.HttpUtil.getHttp(HttpUtil.java:96)
at com.liferay.portal.kernel.util.HttpUtil.addParameter(HttpUtil.java:68)
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImpl.java:71)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSearch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(SolrReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrReaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
16:08:16,174 ERROR [SolrReaderMessageListener:49] Unable to process message com.liferay.portal.kernel.messaging.Message#2c591d98
com.liferay.portal.kernel.search.SearchException: java.lang.ClassCastException: com.liferay.portal.kernel.util.HttpUtil cannot be cast to com.liferay.portal.kernel.util.HttpUtil
at com.liferay.portal.search.solr.SolrIndexSearcherImpl.search(SolrIndexSearcherImpl.java:81)
at com.liferay.portal.search.solr.SolrSearchEngineUtil.search(SolrSearchEngineUtil.java:78)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doCommandSearch(SolrReaderMessageListener.java:92)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.doReceive(SolrReaderMessageListener.java:75)
at com.liferay.portal.search.solr.messaging.SolrReaderMessageListener.receive(SolrReaderMessageListener.java:46)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:69)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
and BTW here is my solr-web solr-spring.xml
<beans>
<bean id="indexSearcher" class="com.liferay.portal.search.solr.SolrIndexSearcherImpl">
<property name="serverURL" value="http://localhost:8983/solr/select" />
</bean>
<bean id="indexWriter" class="com.liferay.portal.search.solr.SolrIndexWriterImpl">
<property name="serverURL" value="http://localhost:8983/solr/update" />
</bean>
<bean id="searchEngine" class="com.liferay.portal.search.solr.SolrSearchEngineImpl">
<property name="name" value="Solr" />
<property name="searcher" ref="indexSearcher" />
<property name="writer" ref="indexWriter" />
<property name="indexReadOnly" value="false" />
</bean>
<bean id="searchEngineUtil" class="com.liferay.portal.search.solr.SolrSearchEngineUtil" lazy-init="false">
<constructor-arg ref="searchEngine" />
<constructor-arg ref="searchReaderMessageListener" />
<constructor-arg ref="searchWriterMessageListener" />
</bean>
and what would the schema.xml would looklike in this case
Seems you must have more than one portal-kernel.jar file in your app server.
This jar cannot be duplicated within the context of at least the ear containing the portal app and plugins in an app server, or the global classpath if running in a servlet container like tomcat.
he HttpUtils Class was actually altered to suite the requirements so the solution to this one was to replace original kernel class with the one we modified