Как добавить клиент базы данных Oracle jdbc в загрузочное приложение Spring в Heroku? - PullRequest
0 голосов
/ 15 сентября 2018

У меня есть приложение Spring Boot, которое я скопировал с https://github.com/husseinterek/spring-boot-jpa-hibernate. У меня есть база данных Oracle Standard Edition, которую я создал с помощью Amazon RDS. Я хочу подключить это основное приложение Spring Boot к моей базе данных Oracle, но я продолжаю получать эту ошибку из журналов Heroku:

heroku logs --tail
…
2018-09-15T05:08:02.154176+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: Unable to load class: oracle.jdbc.OracleDriver from ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@6b884d57;ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@6b884d57
2018-09-15T05:08:02.154177+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
2018-09-15T05:08:02.154179+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:272)
2018-09-15T05:08:02.154181+00:00 app[web.1]: ... 47 common frames omitted
2018-09-15T05:08:02.154183+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
2018-09-15T05:08:02.154184+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
2018-09-15T05:08:02.154186+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
2018-09-15T05:08:02.154188+00:00 app[web.1]: at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
2018-09-15T05:08:02.154190+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2018-09-15T05:08:02.154192+00:00 app[web.1]: at java.lang.Class.forName0(Native Method)
2018-09-15T05:08:02.154194+00:00 app[web.1]: at java.lang.Class.forName(Class.java:348)
2018-09-15T05:08:02.154196+00:00 app[web.1]: at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)
…

Я думаю, это означает, что файл jar, oracle-ojdbc6-11.2.0.3.jar, не находится в пути к классам, поэтому его нельзя найти. Я пытаюсь следовать этим инструкциям:

https://devcenter.heroku.com/articles/local-maven-dependencies

Но я не очень знаком с Maven, поэтому я не знаю о локальных репозиториях Maven. Когда говорится «Добавить стандартный каталог репозитория Maven с именем repo», я просто делаю mkdir repo? Или есть специальная команда для создания стандартного каталога репозитория Maven? Что такое стандартный каталог репозитория Maven? Я просто предположил, что это похоже на обычный каталог файловой системы на основе Linux, поэтому я сделал это, так что теперь у меня есть что-то вроде этого:

oracle database driver

и я стараюсь следовать инструкциям, выполнив:

$ mvn deploy:deploy-file -Durl=/Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/repo/ -Dfile=oracle-ojdbc6-11.2.0.3.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -X

и я получаю:

Maven home: /Users/username/Downloads/NewDownloads/apache-maven-3.5.4
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: javax.annotation.* < plexus.core
[DEBUG]   Imported: javax.annotation.security.* < plexus.core
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
...
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.fusesource.jansi.* < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: org.slf4j.helpers.* < plexus.core
[DEBUG]   Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Message scheme: color
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from /Users/username/Downloads/NewDownloads/apache-maven-3.5.4/conf/settings.xml
[DEBUG] Reading user settings from /Users/username/.m2/settings.xml
[DEBUG] Reading global toolchains from /Users/username/Downloads/NewDownloads/apache-maven-3.5.4/conf/toolchains.xml
[DEBUG] Reading user toolchains from /Users/username/.m2/toolchains.xml
[DEBUG] Using local repository at /Users/username/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/username/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-starter-parent:pom:1.5.10.RELEASE: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project org.springframework.boot:spring-boot-dependencies:pom:1.5.10.RELEASE: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc6:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar will be unresolvable by dependent projects @ line 58, column 23
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[DEBUG] Resolving plugin prefix deploy from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix deploy to org.apache.maven.plugins:maven-deploy-plugin from POM com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT
[DEBUG] Tasks:   [deploy:deploy-file]
[DEBUG] Style:   Aggregating
[DEBUG] =======================================================================
[INFO] 
[INFO] --------------< com.programmer.gate:SpringBootHibernate >---------------
[INFO] Building SpringBootHibernate 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[DEBUG] Resolving plugin prefix deploy from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix deploy to org.apache.maven.plugins:maven-deploy-plugin from POM com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.programmer.gate:SpringBootHibernate:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] Repositories (dependencies): [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins)     : [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <artifactId>${artifactId}</artifactId>
  <classifier>${classifier}</classifier>
  <classifiers>${classifiers}</classifiers>
  <description>${generatePom.description}</description>
  <file>${file}</file>
  <files>${files}</files>
  <generatePom default-value="true">${generatePom}</generatePom>
  <groupId>${groupId}</groupId>
  <javadoc>${javadoc}</javadoc>
  <localRepository default-value="${localRepository}"/>
  <offline default-value="${settings.offline}"/>
  <packaging>${packaging}</packaging>
  <pomFile>${pomFile}</pomFile>
  <project default-value="${project}"/>
  <repositoryId default-value="remote-repository">${repositoryId}</repositoryId>
  <repositoryLayout default-value="default">${repositoryLayout}</repositoryLayout>
  <retryFailedDeploymentCount default-value="1">${retryFailedDeploymentCount}</retryFailedDeploymentCount>
  <sources>${sources}</sources>
  <types>${types}</types>
  <uniqueVersion default-value="true">${uniqueVersion}</uniqueVersion>
  <updateReleaseInfo default-value="false">${updateReleaseInfo}</updateReleaseInfo>
  <url>${url}</url>
  <version>${version}</version>
</configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] --- maven-deploy-plugin:2.8.2:deploy-file (default-cli) @ SpringBootHibernate ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1404673, ConflictMarker.markTime=761624, ConflictMarker.nodeCount=36, ConflictIdSorter.graphTime=795659, ConflictIdSorter.topsortTime=540897, ConflictIdSorter.conflictIdCount=16, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=6536060, ConflictResolver.conflictItemCount=36, DefaultDependencyCollector.collectTime=158497347, DefaultDependencyCollector.transformTime=12915304}
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.2:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.2.1:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.2.1:compile
[DEBUG]       org.apache.maven:maven-artifact-manager:jar:2.2.1:compile
[DEBUG]          org.apache.maven:maven-repository-metadata:jar:2.2.1:compile
[DEBUG]          backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.2.1:compile
[DEBUG]       org.codehaus.plexus:plexus-interpolation:jar:1.11:compile
[DEBUG]       org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG]          junit:junit:jar:3.8.1:compile
[DEBUG]          classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.2.1:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.2.1:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.15:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2
[DEBUG]   Included: org.apache.maven.plugins:maven-deploy-plugin:jar:2.8.2
[DEBUG]   Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
[DEBUG]   Included: org.codehaus.plexus:plexus-interpolation:jar:1.11
[DEBUG]   Included: junit:junit:jar:3.8.1
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0.15
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file' with basic configurator -->
[DEBUG]   (f) artifactId = ojdbc6
[DEBUG]   (f) file = /Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/oracle-ojdbc6-11.2.0.3.jar
[DEBUG]   (f) generatePom = true
[DEBUG]   (f) groupId = com.oracle
[DEBUG]   (s) localRepository =       id: local
      url: file:///Users/username/.m2/repository/
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => true, update => always]

[DEBUG]   (f) offline = false
[DEBUG]   (f) packaging = jar
[DEBUG]   (f) project = MavenProject: com.programmer.gate:SpringBootHibernate:0.0.1-SNAPSHOT @ /Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/pom.xml
[DEBUG]   (f) repositoryId = remote-repository
[DEBUG]   (f) repositoryLayout = default
[DEBUG]   (f) retryFailedDeploymentCount = 1
[DEBUG]   (f) uniqueVersion = true
[DEBUG]   (f) updateReleaseInfo = false
[DEBUG]   (f) url = /Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/repo/
[DEBUG]   (f) version = 11.2.0.3
[DEBUG] -- end configuration --
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.494 s
[INFO] Finished at: 2018-09-15T11:51:07-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project SpringBootHibernate: No transfer protocol found. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project SpringBootHibernate: No transfer protocol found.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: No transfer protocol found.
    at org.apache.maven.plugin.deploy.DeployFileMojo.execute (DeployFileMojo.java:244)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Я тоже пробовал:

$ mvn install:install-file -Dfile=/Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/repo/com/oracle/oracle-ojdbc6-11.2.0.3.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

и я получаю:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.programmer.gate:SpringBootHibernate:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc6:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar will be unresolvable by dependent projects @ line 58, column 23
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] --------------< com.programmer.gate:SpringBootHibernate >---------------
[INFO] Building SpringBootHibernate 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install-file (default-cli) @ SpringBootHibernate ---
[INFO] pom.xml not found in oracle-ojdbc6-11.2.0.3.jar
[INFO] Installing /Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/repo/com/oracle/oracle-ojdbc6-11.2.0.3.jar to /Users/username/.m2/repository/com/oracle/ojdbc6/11.2.0.3/ojdbc6-11.2.0.3.jar
[INFO] Installing /var/folders/5l/vlthy3b54cg70yvnrtvxygf00000gn/T/mvninstall1229283220201634256.pom to /Users/username/.m2/repository/com/oracle/ojdbc6/11.2.0.3/ojdbc6-11.2.0.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.583 s
[INFO] Finished at: 2018-09-15T11:54:16-04:00
[INFO] ------------------------------------------------------------------------

Обратите внимание, что в проекте, который я извлек из https://github.com/husseinterek/spring-boot-jpa-hibernate, существует этот файл jar , о котором я думаю, что он жалуется в приведенном выше предупреждении.

Если это имеет значение, мой файл application.properties в папке ресурсов выглядит следующим образом:

# Commented this out because I don't know if I need this for Heroku
# server.port=9093

# create and drop tables and sequences, loads import.sql
spring.jpa.hibernate.ddl-auto=create-drop

# Oracle settings.
spring.datasource.url=jdbc:oracle:thin:@oracle-instance.abcdefghijkl.ap-northeast-2.rds.amazonaws.com:1521:ORCL
spring.datasource.username=oracleusername
spring.datasource.password=[redacted]
spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver

# logging
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
logging.level.org.hibernate.SQL=debug
#logging.level.org.hibernate.type.descriptor.sql=trace
#logging.level.=debug

### Copied from: https://springframework.guru/configuring-spring-boot-for-oracle/

#hibernate config
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect

Мой файл pom.xml выглядит так:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.programmer.gate</groupId>
  <artifactId>SpringBootHibernate</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>

  <name>SpringBootHibernate</name>
  <description>Demo project for Spring Boot</description>

  <parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>1.5.10.RELEASE</version> <!-- <version>2.0.5.RELEASE</version> -->
       <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <properties>
       <maven.compiler.source>1.8</maven.compiler.source>
       <maven.compiler.target>1.8</maven.compiler.target>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
       <java.version>1.8</java.version>
  </properties>

  <dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
      <!-- ORACLE database driver DOES NOT WORK-->
      <!--
      <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc6</artifactId>
          <version>11.2.0.3</version>
      </dependency>
      -->
      <!-- /3297476/kak-dobavit-lokalnye-faily-jar-v-proekt-maven -->
      <!-- ORACLE database driver STILL DOES NOT WORK-->
      <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc6</artifactId>
          <version>11.2.0.3</version>
          <scope>system</scope>
          <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar</systemPath>
      </dependency>

  </dependencies>

  <build>
      <plugins>
          <plugin>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-maven-plugin</artifactId>
          </plugin>
      </plugins>
  </build>

</project>
<!--
Note that to set up the oracle jar I tried:
$ mvn install:install-file -Dfile=/Users/username/Downloads/NewDownloads/spring-boot-jpa-hibernate-master/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
And then added:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
in accordance with:
https://ejazazeem.wordpress.com/2016/08/29/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
-->

Я надеялся, что добавление:

  <!-- /3297476/kak-dobavit-lokalnye-faily-jar-v-proekt-maven -->
  <!-- ORACLE database driver STILL DOES NOT WORK-->
  <dependency>
      <groupId>com.oracle</groupId>
      <artifactId>ojdbc6</artifactId>
      <version>11.2.0.3</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar</systemPath>
  </dependency>

избавился бы от java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver, но это не так.

Мне просто нужен базовый начальный шаблон для Oracle Standard Edition + Hibernate + Spring Boot + Heroku, но это самое близкое, что я могу найти, поэтому я стараюсь настроить его, но я не знаю, Maven или Весна, так что это полная боль.

1 Ответ

0 голосов
/ 15 сентября 2018

Драйвер Oracle JDBC не размещен в Maven Central.В дополнение к зависимости добавьте ниже хранилище datanucleus в свой pom.xml, чтобы maven мог вытащить его оттуда.

    <repositories>
        <repository>
          <id>datanucleus</id>
          <url>http://www.datanucleus.org/downloads/maven2/</url>
        </repository>
    </repositories>

Чтобы избавиться от этого предупреждающего сообщения, возможно, вам следует переместить банку в другое место за пределамикаталог вашего проекта и повторите команду.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...