How to Connect to SQL Server in SDK

Hi All,

Here is my requirement -
I am developing a pluggin to communicate with an external SQL database to fetch some details. Before adding the SQL server driver pluggin the pluggin was running successful.But after adding the dependency tag for SQL driver the pluggin is getting failed.

Getting error :
[INFO] [talledLocalContainer] ___ FAILED PLUGIN REPORT _____________________
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 1 plugin failed to load during JIRA startup.
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ‘com.example.plugins.tutorial.tutorial-jira-add-content-to-view-issue-screen’ - ‘tutorial-jira-add-content-to-view-issue-screen’ failed to load.
[INFO] [talledLocalContainer] Cannot start plugin: com.example.plugins.tutorial.tutorial-jira-add-content-to-view-issue-screen
[INFO] [talledLocalContainer] Unresolved constraint in bundle com.example.plugins.tutorial.jira-add-content-to-view-issue-screen [176]: Unable to resolve 176.0: missing requirement [176.0] osgi.wiring.package; (osgi.wiring.package=com.microsoft.aad.adal4j)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] It was loaded from D:\Jira Plugin\issue_plugin\tutorial-jira-add-content-to-view-issue-screen\target\jira\home\plugins\installed-plugins\tutorial-jira-add-content-to-view-issue-screen-1.0-SNAPSHOT.jar
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ********************************************************************************************************************************************************************************************************

I had tried different version of drivers like 7.0.0.jre8 , 6.0.0.jre8 as per some of the earlier related queries by other.

Please help in resolving this issue

My Pom.xml file looks as below,

<?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.example.plugins.tutorial tutorial-jira-add-content-to-view-issue-screen 1.0-SNAPSHOT Example Company http://www.example.com/ tutorial-jira-add-content-to-view-issue-screen This is the com.example.plugins.tutorial:tutorial-jira-add-content-to-view-issue-screen plugin for Atlassian JIRA. atlassian-plugin com.atlassian.jira jira-api ${jira.version} provided junit junit 4.10 test com.atlassian.plugin atlassian-spring-scanner-annotation ${atlassian.spring.scanner.version} compile com.atlassian.plugin atlassian-spring-scanner-runtime ${atlassian.spring.scanner.version} runtime javax.inject javax.inject 1 provided com.atlassian.plugins atlassian-plugins-osgi-testrunner ${plugin.testrunner.version} test javax.ws.rs jsr311-api 1.1.1 provided com.google.code.gson gson 2.2.2-atlassian-1 org.mockito mockito-all 1.8.5 test
    <dependency>
	 <groupId>com.atlassian.sal</groupId>
	 <artifactId>sal-api</artifactId>
	  <version>2.0.17</version>
	 <scope>provided</scope>
	</dependency>
	
	<dependency>
	 <groupId>com.atlassian.templaterenderer</groupId>
	 <artifactId>atlassian-template-renderer-api</artifactId>
	 <version>2.1.0</version>
	 <scope>provided</scope>
	</dependency>
	
	<dependency>
 	<groupId>com.microsoft.sqlserver</groupId>
  	<artifactId>mssql-jdbc</artifactId>
  <version>7.0.0.jre8</version>
</dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>jira-maven-plugin</artifactId>
            <version>${amps.version}</version>
            <extensions>true</extensions>
            <configuration>
                <productVersion>${jira.version}</productVersion>
                <productDataVersion>${jira.version}</productDataVersion>
                <!-- Uncomment to install TestKit backdoor in JIRA. -->
                <!--
                <pluginArtifacts>
                    <pluginArtifact>
                        <groupId>com.atlassian.jira.tests</groupId>
                        <artifactId>jira-testkit-plugin</artifactId>
                        <version>${testkit.version}</version>
                    </pluginArtifact>
                </pluginArtifacts>
                -->
                <enableQuickReload>true</enableQuickReload>
                <!-- See here for an explanation of default instructions: -->
                <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                <instructions>
                    <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                    <!-- Add package to export here -->
                    <Export-Package>com.example.plugins.tutorial.api,</Export-Package>
                    <!-- Add package import here -->
                    <Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
                    <!-- Ensure plugin is spring powered -->
                    <Spring-Context>*</Spring-Context>
                </instructions>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>atlassian-spring-scanner</goal>
                    </goals>
                    <phase>process-classes</phase>
                </execution>
            </executions>
            <configuration>
                <scannedDependencies>
                    <dependency>
                        <groupId>com.atlassian.plugin</groupId>
                        <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                    </dependency>
                </scannedDependencies>
                <verbose>false</verbose>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <jira.version>7.13.0</jira.version>
    <amps.version>8.0.2</amps.version>
    <plugin.testrunner.version>2.0.1</plugin.testrunner.version>
    <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
    <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
    <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
    <!-- TestKit version 6.x for JIRA 6.x -->
    <testkit.version>6.3.11</testkit.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Hi All,

I was able to identify and resolve the issue.

Thanks.

I don’t want to be that guy but… Some day in the future someone might search the internet for this very problem, stumble upon your thread, and then hate you for not having shared the solution. But if you share the solution you might make someone from the future really happy! :smiley:

1 Like