Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

319
Visualizações
Dockerized spring-boot web service throws FileNotFound Exception

I have tried to copy files from my windows machine to Docker container using the Docker File Command and reading those files from spring web service . Webservice throws an error file not found!

Here I am trying to copy my local directory src/nlp to /data container directoty

below are the avaialble docker volume

enter image description here

Docker File

FROM openjdk:8-jdk-alpine

EXPOSE 8080

ARG JAR_FILE=/target/nlp-0.0.1-SNAPSHOT.jar

ADD ${JAR_FILE} nlp-0.0.1-SNAPSHOT.jar

ADD src/nlp  /data

ENTRYPOINT ["java","-jar", "nlp-0.0.1-SNAPSHOT.jar"]`

application.properties

server.port=8080
logging.level.radial.nlp=DEBUG
logging.file = mylogfile.log
nlp.learning.dir = /data/

Java

InputStream inputStream = new FileInputStream(environment.getProperty("nlp.learning.dir")+ "/train/models/en/token/en-token.bin"); 

Error

java.io.FileNotFoundException: /data/train/models/en/token/en-token.bin (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Please notice extra slash in your path before train dir /data//train/models/en/token/en-token.bin

Consider changing reading line to:

InputStream inputStream = new FileInputStream(environment.getProperty("nlp.learning.dir")+ "train/models/en/token/en-token.bin");

over 4 years ago · Santiago Trujillo Relatório

0

I have altered my maven plugin dependency , now it is working fine

<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.7</version>
<!-- Wire up to the default build phases -->
<executions>
  <execution>
    <id>default</id>
    <goals>
      <goal>build</goal>
      <goal>push</goal>
    </goals>
  </execution>
</executions>
<configuration>
  <repository>${project.artifactId}</repository>
  <buildArgs>
    <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
  </buildArgs>
</configuration>    

over 4 years ago · Santiago Trujillo Relatório

0

Most likely you don't have a file src/nlp/train/models/en/token/en-token.bin the same directory as you are building your container from.

parent/
├── Dockerfile
└── src/
    └── nlp/
        └── train/
            └── models/
                └── en/
                    └── token/
                        └── en-token.bin <--- does this exist?
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda