漠北空城

听海观潮


  • 首页

  • 关于

  • 标签

  • 归档

  • 搜索

syntax error near unexpected token `newline'脚本无法执行

发表于 2016-12-30

问题描述

执行run.sh脚本是报错,报错信息如下:

1
2
3
4
5
/data/app/information-provider
: No such file or directory
: command not found
./run.sh: line 4: syntax error near unexpected token `newline'
'/run.sh: line 4: `case "$1" in

问题分析

查找脚本,脚本并没有问题, 于是怀疑是否文件格式不正确。
通过下面命令查看文件,

1
cat -A run.sh

发现run.sh中,换行是以^M$结尾

1
2
3
4
5
6
server="$( dirname "${BASH_SOURCE[0]}" )" && pwd ^M$
cd $server^M$
^M$
case "$1" in ^M$
^M$
...

阅读全文 »

springboot-Mybatis多数据源配置

发表于 2016-12-05

环境信息:

1
2
Spring Boot:1.3.5
Java:1.7

配置信息

application.yml配置文件配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# SPRING PROFILES
spring:
datasource:
# 主数据源配置信息
primaryDataSource:
url: jdbc:oracle:thin:@192.168.10.111:1521:orcl
username: username
password: password
connectionTestQuery: SELECT 1+1 FROM DUAL
dataSourceClassName: oracle.jdbc.pool.OracleDataSource
typeAliasesPackage: com.hhly.template.entity.database
mapperLocations: classpath:com/hhly/template/dao/database/*.xml
configLocation: classpath:com/hhly/template/config/mybatis/mybatis-config.xml
# 中间库数据源配置信息
middleDataSource:
dataSourceClassName: oracle.jdbc.pool.OracleDataSource
url: jdbc:oracle:thin:@192.168.2.222:1521:orcl
username: username
password: password
max-idle: 10
max-wait: 10000
min-idle: 5
initial-size: 5
test-on-borrow: false
test-while-idle: true
time-between-eviction-runs-millis: 18800
cachePrepStmts: true
prepStmtsSize: 250
prepStmtsCacheSqlLimit: 2048
userServerPrepStmts: true
connectionTestQuery: SELECT 1+1 FROM DUAL
typeAliasesPackage: com.hhly.template.entity.middatabase
mapperLocations: classpath:com/hhly/template/dao/middatabase/*.xml
configLocation: classpath:com/hhly/template/config/mybatis/mybatis-config.xml

阅读全文 »

java.io.File中mkdir和mkdirs的差别

发表于 2016-11-17

mkdirs()可以成功建立多级文件夹, mkdir()只能成功建立一级的文件夹,多层目录就不能创建成功

阅读全文 »

本地Eclipse中Tomcat运行测试环境代码

发表于 2016-10-15

1、复制测试环境代码对应项目到本地

2、对本地Eclipse中server.xml

2.1、找到Eclipse下面的Servers下的server.xml文件:

server.xml

2.2、将xml中Host元素下代码配置进行修改:

1
2
3
4
5
6
7
8
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
<!-- 将已部署的项目删除,或者将下面这段部署项目的配置注释 -->
<!-- <Context docBase="temp" path="/temp" reloadable="true" source="org.eclipse.jst.jee.server:mlottery"/> -->
<!-- 增加如下配置,其中修改对应的docBase对应的路径及path-->
<Context crossContext="true" debug="0" docBase="C:\Users\Administrator\Desktop\temp" path="/temp" reloadable="false"/>
</Host>

3、点击启动Tomcat按钮即可将测试环境代码运行起来

如果想修改代码,其对应java文件将会自动编译在\WebRoot\WEB-INF\classes目录下,如果要排查是哪个位置代码不一致导致的,需要将对应class文件替换即可进行排查

Spring-boot打成jar包问题总结

发表于 2016-09-09

Spring boot 打成jar包问题总结

1、Unable to find a single main class from the following candidates

1.1、问题描述

maven build时出现以下错误提示日志:

1
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) on project information: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.5.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.hhly.InformationApplication, com.hhly.test.Application] -> [Help 1]

1.2、日志分析

1
2
Unable to find a single main class from the following candidates [com.hhly.InformationApplication, com.hhly.test.Application]
// 不能从下面的候选类中找到单一的main类

1.3、解决办法

查看着两个类,发现两个类中确实两个类中均有一个main方法,去掉一个多余的main方法,保留唯一的main方法。

阅读全文 »
1…678…14
漠北空城

漠北空城

69 日志
19 标签
链接
  • xyz327
© 2024 漠北空城
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4
粤ICP备18054530号-2   |     |