Running project in development mode with no access to folder

Hi,

'io.jmix' version '2.1.3'
JDK 17
Tomcat 10

I am trying to deploy the project on production but getting below error.

[com/vaadin/flow/spring/VaadinApplicationConfiguration.class]: Running project in development mode with no access to folder

I had check the path for which this error is coming that path location seems to be in flow-build-info.json file . I had done changes also in application.properties & build.gradle file but still getting error.


application.properties

-Pvaadin.productionMode=true

Build.gradle


war { 
    enabled = false
}

vaadin {
optimizeBundle = false
}

plugins {
    id 'war'
}

extends SpringBootServletInitializer implements AppShellConfigurator

Resolved corrected the configuration.

Hello,
things to check:

  • go to IntelliJ, terminal, type ./gradlew “-Pvaadin.productionMode=true” bootJar
    This will output the production mode build into /build/libs folder of your project.

I recommend you add application-prod.properties in the same place where your application.properties file is. In that new file (spring profile) enter the database credentials, or additional or different setting that you need for production (spring profile will use application.properties as default if a property is not present in the new file)
You can also set different logging, location of log file etc

main.datasource.url = jdbc:postgresql://
main.datasource.username = ---
main.datasource.password = ---

ui.login.defaultUsername =
ui.login.defaultPassword =


# Set the application work directory
jmix.core.work-dir=/opt/yourprojectname/work

# Set the root logging level to ERROR or WARN or INFO or DEBUG or TRACE
logging.level.root=INFO
logging.level.com.pcl=INFO

# Specify the log file path
logging.file.name=./jmix-application.log

# Specify the log file pattern
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} - %msg%n

Then, copy that bootJar and start it with
java -jar ./yourprojectname-0.0.1-SNAPSHOT.jar --spring.profiles.active=prod

See if it works, and if yes, create a new service that you can start or stop using systemctl, assuming you are using Linux.

If there is again access error, then you will need to see if the user that you are starting the app has proper rights to the folders and files in question. In my example, I have placed jar inside /opt/yourprojectname
directory, and made sure that the user I created to start the application has permission to that and work directory etc.

Kind regards,
Mladen