Plugin starts jar file with SpringBoot, can't acces sqlite.db, Access denied
I develop an IntelliJ plugin which starts an extra jar file with a ProcessBuilder. This jar will start with SpringBoot and creates a sqlite database.
When I start the jar from the commandline or from test, as well when I start the plugin with gradle:runIde it works fine and the database exists.
However if I deploy the plugin and install it in a IntelliJ version it won't work. I get the error above, that I can't access the database. When I start IntelliJ as admin it works (and also if I later start it normal again, only once starting as admin is enough to solve the problem).
I would like however avoid having each user restart their Ide as admin though.
With which rights do get Plugins started and is there a way to let the ProcessBuilder have rights?
. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.2.6.RELEASE)
2021-10-08 15:48:29,024 INFO [main] App: Starting App v1.0.0-SNAPSHOT on NB340 with PID 28800 (C:\Users\User\AppData\Local\Temp\program.jar started by User in C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.2\jbr\bin)
2021-10-08 15:48:29,029 INFO [main] App: The following profiles are active: websocket,rest,sqlite,default
2021-10-08 15:48:33,072 INFO [main] TomcatWebServer: Tomcat initialized with port(s): 0 (http)
2021-10-08 15:48:33,090 INFO [main] Http11NioProtocol: Initializing ProtocolHandler ["http-nio-127.0.0.1-auto-1"]
2021-10-08 15:48:33,091 INFO [main] StandardService: Starting service [Tomcat]
2021-10-08 15:48:33,091 INFO [main] StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.33]
2021-10-08 15:48:33,182 INFO [main] [/]: Initializing Spring embedded WebApplicationContext
2021-10-08 15:48:33,182 INFO [main] ContextLoader: Root WebApplicationContext: initialization completed in 4059 ms
2021-10-08 15:48:34,570 INFO [main] VersionPrinter: Flyway Community Edition 6.0.8 by Redgate
2021-10-08 15:48:34,584 INFO [main] HikariDataSource: HikariPool-1 - Starting...
2021-10-08 15:48:35,641 ERROR [main] HikariPool: HikariPool-1 - Exception during pool initialization.
java.sql.SQLException: opening db: 'sqlite.db': Access denied
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:115)
at org.sqlite.JDBC.connect(JDBC.java:90)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:354)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)
at org.flywaydb.core.Flyway.execute(Flyway.java:438)
at org.flywaydb.core.Flyway.migrate(Flyway.java:149)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
请先登录再写评论。
Instead of using ProcessBuilder you may try with: