Atlassian SDK: atlas-run - Server fails to start
Asked by CJCombrink:

I am trying to create a Repository Merge Check Plugin for BitBucket Server.

I am following the following guide: <https://developer.atlassian.com/server/bitbucket/tutorials-and-examples/controlling-when-pull-requests-can-be-merged/>

After I make the changes as specified, when I run \`atlas-run\` I get the following error/warning  

```
2023-01-27 07:49:13,977 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
[INFO] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
[INFO] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:664)
[INFO] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
[INFO] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
[INFO] at javax.servlet.GenericServlet.init(GenericServlet.java:158)
[INFO] at java.base/java.lang.Thread.run(Thread.java:829)
[INFO] ... 18 frames trimmed
[INFO] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
[INFO] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
[INFO] ... 5 common frames omitted
```

When I try to connect with my browser I get the following response

```
A fatal error has occurred
The following problem occurred, which prevents Atlassian Bitbucket from starting:

SpringMVC dispatcher [springMvc] could not be started
```

This is then logged on the console

```
[INFO] 2023-01-27 08:02:08,023 WARN [http-nio-7990-exec-2] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing [hazelcastFilter]; no Spring WebApplicationContext is available
[INFO] 2023-01-27 08:02:08,023 WARN [http-nio-7990-exec-2] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing [requestAttributeFilter]; no Spring WebApplicationContext is available
[INFO] 2023-01-27 08:02:08,031 WARN [http-nio-7990-exec-3] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing [hazelcastFilter]; no Spring WebApplicationContext is available
```

I have tried this in a clean docker container, but also now inside a WSL Ubuntu install.

I see other related posts like [SpringMVC dispatcher could not be started](https://confluence.atlassian.com/bitbucketserverkb/springmvc-dispatcher-could-not-be-started-779171477.html) but that is related to a proper Bitbucket installation, not for developing using the SDK.

Is there perhaps a guide that describes how to configure my development environment and Bitbucket before I must run \`atlas-run\` (which are not covered nor mentioned in the guide)?  

Any assistance would be appreciated.


Answers:
author: R Arda Duman
body: Hello,

I can see that you are using Java version: 11.0.17.

Can you try with Oracle Java SE Development Kit 8 (JDK) or AdoptOpenJDK 8?

Regards.

comments: author: CJCombrink
body: Trying with 8 solved the issue:  

```
$ atlas-version

ATLAS Version: 8.2.8
ATLAS Home: /usr/share/atlassian-plugin-sdk-8.2.8
ATLAS Scripts: /usr/share/atlassian-plugin-sdk-8.2.8/bin
ATLAS Maven Home: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4
AMPS Version: 8.1.2
--------
Executing: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4/bin/mvn --version -gs /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4/conf/settings.xml
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4
Java version: 1.8.0_362, vendor: Temurin, runtime: /opt/java/openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-383.el8.x86_64", arch: "amd64", family: "unix"
```


author: CJCombrink
body: This is my output for \`atlas-version\`

```

ATLAS Version: 8.2.8
ATLAS Home: /usr/share/atlassian-plugin-sdk-8.2.8
ATLAS Scripts: /usr/share/atlassian-plugin-sdk-8.2.8/bin
ATLAS Maven Home: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4
AMPS Version: 8.1.2
--------
Executing: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4/bin/mvn --version -gs /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4/conf/settings.xml
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: /usr/share/atlassian-plugin-sdk-8.2.8/apache-maven-3.5.4
Java version: 11.0.17, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.15.79.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
```


Tags: bitbucket-server

sdk

server