In AEM 6 upgrade document, I could able to see the information related to migeating to mongodb. Kindly confirm me that AEM 6 need mongo db only or will it work with Oracle DB also? As AEM 5.x is working with Oracle DB.
Solved! Go to Solution.
Out of the box - no - AEM does not work with Oracle. However - you can write a custom service (within an OSGi) that persists and queries data to and from an Oracle database.
To do so - you have 2 choices:
1 - you can use Java JDBC APIs to write an OSGi bundle to work with Oracle and write your own connection application logic. See these community articles (they use MySQL - but you can replace that with Oracle):
http://helpx.adobe.com/experience-manager/using/persisting-cq-data-relational-database.html
http://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html
2 - you can inject a DataSourcePool into an OSGi. Configure the DataSourcePool to work with Oracle. See this community article:
http://helpx.adobe.com/experience-manager/using/datasourcepool.html
Good luck!
Hi,
When you compare to MongoDB, you are probably referring to Oracle as a persistence layer for the repository. WIth AEM 6.0 and Oak only MongoDB and TarMK are supported as Microkernels. You still have the chance to use CRX 2.x (and then a database persistence manager and plug Oracle into it), but I would strongly recommend not to got this way when you start now.
From what I see from the Apache Oak mailinglists, there is a RDBMK being developed; so I see a chance that Oracle as persistence might be supported in the future. In any case, if you already an AEM customer, I would ask Daycare support for this. And if you are not a customer yet, get in contact with Adobe Solution Consulting or Adobe Sales, as they can make clearer statements than we here in a forum :-)
kind regards,
Jörg
Views
Replies
Total Likes
AEM 6 has options to store the data in backend for MongoMK. You need to have mongo db instance running to have this option.
However you can use oracle persistence manager to store the data
More information can be found on
http://docs.adobe.com/docs/en/cq/current/core/administering/persistence_managers.html
Views
Replies
Total Likes
Out of the box - no - AEM does not work with Oracle. However - you can write a custom service (within an OSGi) that persists and queries data to and from an Oracle database.
To do so - you have 2 choices:
1 - you can use Java JDBC APIs to write an OSGi bundle to work with Oracle and write your own connection application logic. See these community articles (they use MySQL - but you can replace that with Oracle):
http://helpx.adobe.com/experience-manager/using/persisting-cq-data-relational-database.html
http://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html
2 - you can inject a DataSourcePool into an OSGi. Configure the DataSourcePool to work with Oracle. See this community article:
http://helpx.adobe.com/experience-manager/using/datasourcepool.html
Good luck!
Hi Team,
I tried configuring the connections from AEM(6.1) to Oracle db following the two approaches.
However in the first approach even though I
The error message read no suitable driver class found(on the class.forname line).
While in the second approach where I configured a datasourcepool in configMgr,the same is not reachable from the code where i call it during connection.
Regards,
Abhishek T(The name Test Sample is taking time to get updated)
Views
Replies
Total Likes
Follow this article - try it on MySQL to learn it:
https://helpx.adobe.com/experience-manager/using/datasourcepool.html
Do not place driver file in the install path. Use Eclipse to wrap it into an OSGi bundle and deploy that - as discussed in this article
Once you get it workign on MySQL - then try same logic on the other database.
Views
Replies
Total Likes
Hey Scott,
We are trying to connect Oracle DB as well. We have tried all the articles listed above and we still couldn't get this connection up and running. We tried creating the Driver bundle with ojdbc14, ojdbc6 and even ojdbc6_g (with logging enabled because we once had an error relating to diagnosability). We even tried building the driver using Eclipse Indigo so as to enforce automatic update of Export and Import packages (new versions do not populate the list automatically) but the connection still does not work. We keep getting Null value in Datasource in our code.
We get the following error most of the times when we click on save in the JDBC connection pool,
08.05.2017 15:43:56.544 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.9d45d49e-ae64-43ab-9802-2d105f44c8b4)] day.commons.datasource.jdbcpool Configuring and activating data source with name=SampleOracleDS
08.05.2017 15:43:56.545 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.9d45d49e-ae64-43ab-9802-2d105f44c8b4)] day.commons.datasource.jdbcpool [com.day.commons.datasource.jdbcpool.JdbcPoolService(1370)] The activate method has thrown an exception (java.lang.IllegalArgumentException: Cannot initialize driver 'oracle.jdbc.OracleDriver')
java.lang.IllegalArgumentException: Cannot initialize driver 'oracle.jdbc.OracleDriver'
at com.day.commons.datasource.jdbcpool.JdbcPoolService.initalizeDriver(JdbcPoolService.java:301)
at com.day.commons.datasource.jdbcpool.JdbcPoolService.setupDataSource(JdbcPoolService.java:227)
at com.day.commons.datasource.jdbcpool.JdbcPoolService.activate(JdbcPoolService.java:174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:774)
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:247)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:344)
at org.apache.felix.framework.Felix.getService(Felix.java:3699)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:470)
at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:72)
at org.apache.felix.scr.impl.helper.BindMethod.getServiceObject(BindMethod.java:646)
at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2137)
at org.apache.felix.scr.impl.manager.DependencyManager.invokeUnbindMethod(DependencyManager.java:1765)
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeUnbindMethod(SingleComponentManager.java:393)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(DependencyManager.java:364)
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.removedService(DependencyManager.java:295)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1241)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1136)
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.untrack(ServiceTracker.java:996)
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1175)
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:120)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
at org.apache.felix.framework.Felix.access$000(Felix.java:106)
at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:420)
at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:144)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(AbstractComponentManager.java:883)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(AbstractComponentManager.java:857)
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:140)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterService(AbstractComponentManager.java:925)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(AbstractComponentManager.java:774)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:757)
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:615)
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:566)
at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:419)
at org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(ConfigurationSupport.java:315)
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2046)
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2014)
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/management/InstanceAlreadyExistsException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.day.commons.datasource.jdbcpool.JdbcPoolService.initalizeDriver(JdbcPoolService.java:299)
... 56 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.management.InstanceAlreadyExistsException not found by com.jdbc.oracle [506]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 61 common frames omitted
Views
Replies
Total Likes
Hi,
make sure, that the package "javax.management" is available in your OSGI framework. The probably easiest way is to augment your sling.properties and append "javax.management" to the line starting with "org.osgi.framework.bootdelegation". Then restart.
Jörg
Views
Replies
Total Likes
Hey Jörg,
The javax.management package is indeed available in the OSGi framework. We stopped getting the error posted above once we created the Oracle driver using Eclipse Indigo. However, we still keep getting null value for Datasource even after configuring the properties in JDBC Connection pool. The funny thing is, we do not even get any error in error.logs now. This is how the logs like once I click on save with the JDBC properties,
10.05.2017 00:39:56.383 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Service [com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642,4935, [com.day.commons.datasource.poolservice.DataSourcePoolProvider]] ServiceEvent UNREGISTERING
10.05.2017 00:39:56.383 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool deactivating data source with name=SampleOracleDS
10.05.2017 00:39:56.384 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Service [4936, [javax.sql.DataSource]] ServiceEvent UNREGISTERING
10.05.2017 00:39:56.386 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Service [com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642,4951, [com.day.commons.datasource.poolservice.DataSourcePoolProvider]] ServiceEvent REGISTERED
10.05.2017 00:39:56.386 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Configuring and activating data source with name=SampleOracleDS
10.05.2017 00:39:56.386 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Datasource configured, name=SampleOracleDS, connectionURI=jdbc:oracle:thin:localhost:1521:db11g, default readonly=false, default autocommit=true, validation query=SELECT 1 FROM DUAL
10.05.2017 00:39:56.388 *INFO* [CM Event Dispatcher (Fire ConfigurationEvent: pid=com.day.commons.datasource.jdbcpool.JdbcPoolService.1b9fcc82-8bff-438c-9914-ea1b0629e642)] day.commons.datasource.jdbcpool Service [4952, [javax.sql.DataSource]] ServiceEvent REGISTERED
10.05.2017 00:39:56.473 *INFO* [JcrInstaller.1] org.apache.sling.installer.provider.jcr.impl.JcrInstaller Registering resource with OSGi installer: [InstallableResource, priority=200, id=/apps/system/config/com.day.commons.datasource.jdbcpool.JdbcPoolService-1b9fcc82-8bff-438c-9914-ea1b0629e642.config]
Views
Replies
Total Likes
How do you reference your freshly created datasource?
Jörg
Views
Replies
Total Likes
Well, This is what I'm trying to do,
I get null for the dataSoruceService Object here.
@Reference
private DataSourcePool dataSourceService;
public Connection getDataBaseConnection(String dataSourceName) {
Connection conn = null;
try {
String str = dataSourceService.getDataSource(dataSourceName).toString();
System.out.println("Data source is "+str);
DataSource dataSource = (DataSource) dataSourceService.getDataSource(dataSourceName);
System.out.println(dataSource);
conn = dataSource.getConnection();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
return conn;
}
public void executeQuery() {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = getDataBaseConnection("SampleOracleDS");
stmt = con.createStatement();
rs = stmt.executeQuery("select * from forms");
while (rs.next()) {
System.out.println("OID=" + rs.getString(1));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (con != null)
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Views
Replies
Total Likes
HI,
I would start with the documentation at [1], there another approach is choosen, see the "Usage" section.
Jörg
[1] https://sling.apache.org/documentation/bundles/datasource-providers.html
Views
Replies
Total Likes
Jörg, I tried the other way as well to access the Datasource and even that method ends up having the Datasource as null. When the service event is getting registered without any errors when I click on save in the JDBC connection pool, it means that the JDBC connection is successful right? I'm still trying to figure what possibly is going wrong here.
Views
Replies
Total Likes