Hi Team,
we are using AEM as cloud service and MS SQL Database to establish db connection ,I have added dependency to work on MS SQL db .
i have included the dependency in parent pom.xml with version:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.2.0.jre11</version>
</dependency>
dependency in core pom.xml with out version;
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency
have added -includeresource in core pom.xml for the above jar in bnd-maven-plugin as below:
-includeresource: mssql-jdbc-12.2.0.jre11.jar;lib:=true
also tried including : export package;
com.microsoft.sqlserver.jdbc.*;version="11.2.0.jre11",\
getting below error:
referred from below urls:
still issue not resolved:
can some one help me how to resolve this. does anyone has the working pom.xml please share.
Thanks,
Durga Kavali.
Views
Replies
Total Likes
It would be best if you embedded the jar as well.
Hello Durga -
Have you checked these ?
https://www.albinsblog.com/2015/03/how-to-connect-to-oracle-database-using.html
https://medium.com/@theopendle/aem-connect-aem-to-an-external-database-oracle-example-4d3b9d43708
Another suggestion -
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre11</version>
</dependency>
Make sure to replace the version with the appropriate one compatible with your MSSQL Server version.
To ensure that the MSSQL JDBC JAR is included in the build, open the core/pom.xml file and locate the <plugins> section.
Add the maven-dependency-plugin to copy the MSSQL JDBC JAR to the target/classes directory. Modify the configuration section of the maven-dependency-plugin as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
thanks for the reply.
i tried adding embedded dependency in all.pom.xml as follows
<embedded>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<target>/apps/test-vendor-packages/application/install</target>
</embedded>
also tried adding plugin and dependency in core/pom.xml.
still getting below error.
[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.microsoft.sqlserver:mssql-jdbc:12.3.1: Bundle mssql-jdbc:12.3.1 is importing package(s) org.osgi.service.jdbc in start level 20 but no bundle is exporting these for that start level. (com.test:test.all:0.0.1-SNAPSHOT)
Thanks,
Durga Kavali.
Your bundle "com.microsoft.sqlserver:mssql-jdb" is dependent on "org.osgi.service.jdbc", You need to include that as well, basically you need to include all the dependent bundles as well.
Hope that helps!
Regards,
Nitesh
Hi @nitesh_kumar ,
Thanks for reply.
do i need to add as embed dependency , or should i include as dependency in core/pom.xml?
also not sure how to find all the dependent bundles for 'com.microsoft.sqlserver:mssql-jdb' bundle . Please assit
Thanks,
Durga Kavali.
You need to embed them, better try to find the bundle which has all of the required dependencies.
There are several ways you could figure out the dependencies.
1) Extract the jar and check the Manifest.mf.
2.)Try to install the bundle into OSGi console and check the error log.
3.)You also get this detail when you try to take deployment through Maven.
when i install bundle into OSGI console , i don't see any errors, this will fix the issues locally , but the problem is how to deploy this bundle into sandbox via code? where we dont have access to deploy bundles in sandbox.
Hi,
I have resolved this issue by making below changes.
1)Added dependency and embedded in all/pom.xml
Under the filevault-package-maven-plugin, add the the bundles as <embedded> like shown below
<embedded>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<target>/apps/projectname-vendor-packages/application/install</target>
</embedded>
Dependency :
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.4.0.jre11</version>
</dependency>
2)core/pom.xml added below dependencies
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.4.0.jre11</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.jdbc</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
Added export, import packages as below:
under sling-maven-plugin add below
<bnd><![CDATA[
Import-Package: javax.annotation;version=0.0.0,*
Export-Package:
org.osgi.service.jdbc;version="1.1.0",\
]]></bnd>
After deploying the changes ,verify felix console, all the required bundles should be installed now properly.
Thanks,
Durga Kavali.
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies