unable to scan repository Bamboospec (28934167) for Bamboo Specs
Asked by vamshi9700:

Hi Team,

I pushed the Java spec file with perfect folder structure to Stash but the Javaspec are failing to publish the Plan to Bamboo server.the same specs are working in local and i can Publish them from local. Using mvn -Ppublish-specs .I checked the Java version in Bamboo t is running with Java 1.8 can some one help me on solving this issue.

```
Content of pom.xml used:<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">    <!--Edit template at BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/classes/bamboo-specs-pom.xml-->    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.atlassian.bamboo</groupId>        <artifactId>bamboo-specs-parent</artifactId>        <version>6.4.0</version>        <relativePath/>    </parent>    <artifactId>bamboo-specs-generator</artifactId>    <version>1.0.0</version>    <packaging>jar</packaging>    <dependencies> <dependency> <groupId>com.atlassian.bamboo</groupId> <artifactId>bamboo-specs-api</artifactId> </dependency> <dependency> <groupId>com.atlassian.bamboo</groupId> <artifactId>bamboo-specs</artifactId> </dependency> <!-- Test dependencies --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> </dependencies>    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <configuration>                    <compilerArgs>                        <compilerArg>-proc:none</compilerArg>                    </compilerArgs>                </configuration>            </plugin>        </plugins>    </build></project>[INFO] Scanning for projects...[INFO] [INFO] ------------------------------------------------------------------------[INFO] Building bamboo-specs-generator 1.0.0[INFO] ------------------------------------------------------------------------[INFO] [INFO] >>> bamboo-specs-runner:6.4.0:run (default-cli) > package @ bamboo-specs-generator >>>[INFO] [INFO] --- maven-resources-plugin:2.6:copy-resources (copy-license) @ bamboo-specs-generator ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Copying 0 resource[INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ bamboo-specs-generator ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/src/main/resources[INFO] [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ bamboo-specs-generator ---[INFO] Changes detected - recompiling the module![INFO] Compiling 1 source file to /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/target/classes[INFO] /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/src/main/java/com/my/company/PlanSpec.java: /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/src/main/java/com/my/company/PlanSpec.java uses unchecked or unsafe operations.[INFO] /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/src/main/java/com/my/company/PlanSpec.java: Recompile with -Xlint:unchecked for details.[INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-build-environment) @ bamboo-specs-generator ---[INFO] Skipping Rule Enforcement.[INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (ban-milestones-and-release-candidates) @ bamboo-specs-generator ---[INFO] Skipping Rule Enforcement.[INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ bamboo-specs-generator ---[INFO] Not copying test resources[INFO] [INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ bamboo-specs-generator ---[INFO] Not compiling test sources[INFO] [INFO] --- maven-surefire-plugin:2.20:test (default-test) @ bamboo-specs-generator ---[INFO] Tests are skipped.[INFO] [INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ bamboo-specs-generator ---[INFO] Building jar: /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/target/bamboo-specs-generator-1.0.0.jar[INFO] [INFO] <<< bamboo-specs-runner:6.4.0:run (default-cli) < package @ bamboo-specs-generator <<<[INFO] [INFO] [INFO] --- bamboo-specs-runner:6.4.0:run (default-cli) @ bamboo-specs-generator ---[INFO] Scanning /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934167/checkout/bamboo-specs/target/classes for classes annotated with Bamboo plan annotation.[INFO] Found @BambooSpec annotation on class com.my.company.PlanSpec[INFO] Running class com.my.company.PlanSpec2019-04-17 03:54:38,941 INFO [BambooServer] Publishing plan CIP-FDUIT[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.715 s[INFO] Finished at: 2019-04-17T03:54:38-04:00[INFO] Final Memory: 28M/1102M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run (default-cli) on project bamboo-specs-generator: Execution default-cli of goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run failed: java.lang.reflect.InvocationTargetException: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.atlassian.bamboo.specs.util.IsolatedYamlizator$$Lambda$11/614785733 -> [Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionExceptionUnable to scan repository Bamboospec (28934167) for Bamboo Specscom.atlassian.bamboo.repository.RepositoryException: Unable to scan repository Bamboospec (28934167) for Bamboo Specs	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithMaven$9(RepositoryStoredSpecsServiceImpl.java:737)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl$$Lambda$1711/51512301.call(Unknown Source)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)	at java.lang.Thread.run(Thread.java:745)Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 1	at com.atlassian.utils.process.PluggableProcessHandler.complete(PluggableProcessHandler.java:69)	at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:667)	at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161)	at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:114)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithMaven$9(RepositoryStoredSpecsServiceImpl.java:724)	... 9 moreDo you need help? Please visit the http://docs.atlassian.com/bamboo/docs-0604/Bamboo+Specs+troubleshooting page.
```


Answers:
author: Victor Debone
body: Hello [@vamshi9700](/t5/user/viewprofilepage/user-id/2881869), welcome to the Atlassian Community :)

Do you use a \`.credential\` file locally to allow connection to a remote repository? Also, just to confirm, this log you have presented is a failure of run from the repository run, correct?

Victor

comments: author: vamshi9700
body: Hi Victor,

yes, i am using the .credential file locally to allow connection to remote and log is from the bit bucket run.


author: vamshi9700
body: And this is the recent failure


author: vamshi9700
body: ```
Content of pom.xml used:<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">    <!--Edit template at BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/classes/bamboo-specs-pom.xml-->    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.atlassian.bamboo</groupId>        <artifactId>bamboo-specs-parent</artifactId>        <version>6.4.0</version>        <relativePath/>    </parent>    <artifactId>bamboo-specs-generator</artifactId>    <version>1.0.0</version>    <packaging>jar</packaging>    <dependencies>    <dependency>      <groupId>com.atlassian.bamboo</groupId>      <artifactId>bamboo-specs-api</artifactId>    </dependency>    <dependency>      <groupId>com.atlassian.bamboo</groupId>      <artifactId>bamboo-specs</artifactId>    </dependency>    <!-- Test dependencies -->    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <scope>test</scope>    </dependency>  </dependencies>    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <configuration>                    <compilerArgs>                        <compilerArg>-proc:none</compilerArg>                    </compilerArgs>                </configuration>            </plugin>        </plugins>    </build></project>[INFO] Scanning for projects...[INFO] [INFO] ------------------------------------------------------------------------[INFO] Building bamboo-specs-generator 1.0.0[INFO] ------------------------------------------------------------------------[INFO] [INFO] >>> bamboo-specs-runner:6.4.0:run (default-cli) > package @ bamboo-specs-generator >>>[INFO] [INFO] --- maven-resources-plugin:2.6:copy-resources (copy-license) @ bamboo-specs-generator ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] Copying 0 resource[INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ bamboo-specs-generator ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/src/main/resources[INFO] [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ bamboo-specs-generator ---[INFO] Changes detected - recompiling the module![INFO] Compiling 1 source file to /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/target/classes[INFO] /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/src/main/java/com/atlassian/bamboo/PlanSpec.java: /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/src/main/java/com/atlassian/bamboo/PlanSpec.java uses unchecked or unsafe operations.[INFO] /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/src/main/java/com/atlassian/bamboo/PlanSpec.java: Recompile with -Xlint:unchecked for details.[INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-build-environment) @ bamboo-specs-generator ---[INFO] Skipping Rule Enforcement.[INFO] [INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (ban-milestones-and-release-candidates) @ bamboo-specs-generator ---[INFO] Skipping Rule Enforcement.[INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ bamboo-specs-generator ---[INFO] Not copying test resources[INFO] [INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ bamboo-specs-generator ---[INFO] Not compiling test sources[INFO] [INFO] --- maven-surefire-plugin:2.20:test (default-test) @ bamboo-specs-generator ---[INFO] Tests are skipped.[INFO] [INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ bamboo-specs-generator ---[INFO] Building jar: /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/target/bamboo-specs-generator-1.0.0.jar[INFO] [INFO] <<< bamboo-specs-runner:6.4.0:run (default-cli) < package @ bamboo-specs-generator <<<[INFO] [INFO] [INFO] --- bamboo-specs-runner:6.4.0:run (default-cli) @ bamboo-specs-generator ---[INFO] Scanning /home/bamboo/application-data/xml-data/build-dir/serverSide/REPOSITORY_STORED_SPECS/repository-28934173/checkout/bamboo-specs/target/classes for classes annotated with Bamboo plan annotation.[INFO] Found @BambooSpec annotation on class com.my.company.PlanSpec[INFO] Running class com.my.company.PlanSpec2019-04-18 09:49:49,912 INFO [BambooServer] Publishing plan CIP-FDUIT[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.406 s[INFO] Finished at: 2019-04-18T09:49:49-04:00[INFO] Final Memory: 28M/1115M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run (default-cli) on project bamboo-specs-generator: Execution default-cli of goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run failed: java.lang.reflect.InvocationTargetException: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.atlassian.bamboo.specs.util.IsolatedYamlizator$$Lambda$11/614785733 -> [Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionExceptionUnable to scan repository testspec (28934173) for Bamboo Specscom.atlassian.bamboo.repository.RepositoryException: Unable to scan repository testspec (28934173) for Bamboo Specs at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithMaven$9(RepositoryStoredSpecsServiceImpl.java:737) at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl$$Lambda$1711/51512301.call(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41) at java.lang.Thread.run(Thread.java:745)Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 1 at com.atlassian.utils.process.PluggableProcessHandler.complete(PluggableProcessHandler.java:69) at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:667) at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161) at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:114) at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithMaven$9(RepositoryStoredSpecsServiceImpl.java:724) ... 9 moreDo you need help? Please visit the http://docs.atlassian.com/bamboo/docs-0604/Bamboo+Specs+troubleshooting page.
```


author: Victor Debone
body: Thanks for sharing more details.

Is it possible that you could share the specs definition that you are using? Please make sure to remove all the string and information fields from it :)

Victor


author: vamshi9700
body: Hi Victor,

I can publish specs using command line and their are publishing to bamboo,but when i publish using the bit bucket it is failing with the error . And i tried to publish the specs by manually creating the bamboo plan but it is throwing the below error .

|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| -Apr-2019 11:02:48   | 2019-04-18 11:02:48,130 INFO \[FileUserPasswordCredentials\] Couldn't find credentials file '.credentials' to access Bamboo                                                                                                                                                                                                  |
| 18-Apr-2019 11:02:48 | 2019-04-18 11:02:48,132 INFO \[FileUserPasswordCredentials\] Please make sure that the path points to an existing file or to a resource available on JVM classpath                                                                                                                                                           |
| 18-Apr-2019 11:02:48 | 2019-04-18 11:02:48,133 INFO \[FileUserPasswordCredentials\] (for more information, enable more detailed logging with system property -Dbamboo.specs.log.level=DEBUG)                                                                                                                                                        |
| 18-Apr-2019 11:02:48 | \[INFO\] ------------------------------------------------------------------------                                                                                                                                                                                                                                            |
| 18-Apr-2019 11:02:48 | \[INFO\] BUILD FAILURE                                                                                                                                                                                                                                                                                                       |
| 18-Apr-2019 11:02:48 | \[INFO\] ------------------------------------------------------------------------                                                                                                                                                                                                                                            |
| 18-Apr-2019 11:02:48 | \[INFO\] Total time: 2.154s                                                                                                                                                                                                                                                                                                  |
|                      |                                                                                                                                                                                                                                                                                                                              |
|                      |                                                                                                                                                                                                                                                                                                                              |
| 18-Apr-2019 11:02:48 | \[INFO\] ------------------------------------------------------------------------                                                                                                                                                                                                                                            |
| 18-Apr-2019 11:02:48 | \[ERROR\] Failed to execute goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run (default-cli) on project bamboo-specs: Execution default-cli of goal com.atlassian.bamboo:bamboo-specs-runner:6.4.0:run failed: java.lang.reflect.InvocationTargetException: Couldn't find credentials file: .credentials -\> \[Help 1\] |

If you still want the spec i can edit it and send it.:)


author: Victor Debone
body: My hint here is that something in your Specs is dependent on a credential that your file is providing, which cannot be used in the same way by the Bitbucket Specs.


author: vamshi9700
body: Yes, i mentioned the url of bamboo instance. So that the bamboo spec can publish to that instance. It requires credentials to login to that instance so i am providing it through. Credentials file, same is working locally


author: Victor Debone
body: Ok :) Have you checked if your linked repository connection is working and that Bamboo has access to the repository you are hosting your Specs?


author: vamshi9700
body: Yes linked repository connection is working and it is trying to push to it but failing with the above error. I used samr linked repo to manualy build it using the bamboo plan. It is working fine.


author: Victor Debone
body: Great that everything is correctly configured. These are the following steps:

- Bamboo, when running Specs from Bitbucket, don't have the same access that your authenticated user has, so it needs some authentication method provided.

- [You will need to add a SSH key to your repository](https://confluence.atlassian.com/bitbucketserver/using-ssh-keys-to-secure-git-operations-776639772.html?_ga=2.156279227.1007893943.1555678186-1517648854.1555678186)

- And then you will need to [configure your repository with these keys on your Specs](https://docs.atlassian.com/bamboo-specs-docs/6.8.0/specs-java.html#creating-bitbucket-server-repositories-in-repository-stored-specs-mode), preferably using encrypted value :)

Did that help you?

Victor


author: vamshi9700
body: Issue is resolved after updating the java version to Java 8 minor 121


Tags: spec