The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Facing Null pointer while accessing the resource folders in Bitbucket pipeline

kapil.suri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2021

Hi All,

I am new to bitbucket pipeline and wanting to run my Selenium functional automated test using the bitbucket infrastructure.

I have a Java based project with Maven as the build management tool. I have tried executing the maven command to run the code on the linux instance but apparently getting Null pointer exception for a resource file as below

 

java.io.FileNotFoundException: /opt/atlassian/pipelines/agent/build/src/test/resources/testdata/Contact/CreateContact.json (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)

I have tried logging in the directory files and but it shows that my files are not cloned in the instance created.

This is the yml file I have created.

image: jamesdbloom/docker-java8-maven

clone:
depth: full

pipelines:
default:
- parallel:
- step:
name: Build and Test
caches:
- maven
script:
- docker run -d -p 4444:4444 --shm-size=2g selenium/standalone-chrome:3.141.59-20210607
- mvn -B verify -Dcucumber.filter.tags="$TAGS" -Dbrowser.type=$BROWSER -DEnvironment=$ENVT -DrunOnRemote=$ON_REMOTE -Dwebdriver.remote.url=$WD_URL
services:
- docker
artifacts:
- target/**.
Attached is the project sturcutre for your reference.
image.png

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Honey Bhatnagar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2021

The folder name is Case sensitive, "testdata" folder name should be  testData. 

Refer this - https://community.atlassian.com/t5/Bitbucket-Pipelines-questions/Maven-build-runs-local-but-fails-in-pipeline-with-resource-not/qaq-p/804172

kapil.suri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2021

Thanks for the response @Honey Bhatnagar

This seems to have fixed the issue I am facing. 

TAGS
AUG Leaders

Atlassian Community Events