记第一次发布Springboot项目,所遇到的问题

第1个问题 maven打包异常

[ERROR] Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-8:codeserver (default-cli) on project xxx: GWT exited with status 1 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-8:codeserver (default-cli) on project praemissen_modul: GWT exited with status 1 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216) at org.apache.maven.cli.MavenCli.main(MavenCli.java:160) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 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: GWT exited with status 1 at net.ltgt.gwt.maven.CommandLine.execute(CommandLine.java:50) at net.ltgt.gwt.maven.AbstractDevModeMojo.execute(AbstractDevModeMojo.java:237) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more

解决方案:项目目录下边存在有不同版本的maven管理的jar包,将项目中target目录下边的之前打好的jar包手动删除,然后再通过mvn clean install即可打包成功


第2个问题 文件目录无法找到

  • Springboot项目打包后路径如下
    |—BOOT-INF
    |——classes
    |——config
    |———jdbc.properties
  • Springboot项目达成jar包后有可能找不到里边的配置文件

解决方案:将文件读取转换为流形式读取,默认路径在BOOT-INF下开始读取

	InputStream in = getClass().getClassLoader().getResourceAsStream("jdbc.properties");

第3个问题 Maven管理ojdbc依赖

由于Oracle数据库的版权问题,所以maven无法自动管理ojdbc依赖,需要自己手动将ojdbc.jar包安装包本地仓库中

mvn install:install-file -Dfile=jar包的位置 -DgroupId=自定义的groupId -DartifactId=自定义的artifactId -Dversion=自定义的version -Dpackaging=jar

然后使用的时候在pom.xml中添加引用

<dependency>
	<groupId>com.oraclegroupId>		---这里对用上边的DgroupId
		<artifactId>ojdbc6artifactId>	---这里对应上边的artifactId
	<version>1.6version>				---这里对应上边的Dversion
dependency>

第4个问题 Oracle集群数据库与非集群数据库连接字符串URL的差别

Oracle非集群数据库的URL

url=jdbc:oracle:thin:@IP地址:端口号:数据库名称

Oracle集群数据库的URL

url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=IP地址)(PORT=端口号))(LOAD_BALANCE=yes)(FAILOVER=on))(CONNECT_DATA=(SERVICE_NAME=数据库名称)))

如果需要添加集群数据库多个地址,则可在ADDRESS_LIST中添加多个如下代码

(ADDRESS=(PROTOCOL=TCP)(HOST=IP地址)(PORT=端口号))(LOAD_BALANCE=yes)(FAILOVER=on)

此为个人理解,如有失误,敬请指正,万分感激

你可能感兴趣的:(记第一次发布Springboot项目,所遇到的问题)