2019年10月6日 星期日

The HTTP status code in IIS 7 and later versions

https://support.microsoft.com/en-us/help/943891/the-http-status-code-in-iis-7-0-iis-7-5-and-iis-8-0

IIS設定了URL Rewrite但網頁回應404 Not Found

Pattern設定如下
http://localhost:8080/{R:0}
Rewrite URL設定如下
(examples.+)
因為SSL憑證設定在IIS,目的是把https請求導到Tomcat
但是設定好之後用瀏覽器連https和http都是HTTP 404 Not Found
但用Test pattern測試都是符合的
後來找到一篇文章
https://forums.iis.net/t/1238069.aspx
Did you enable the proxy in IIS manager->server node->application request
routing cache->proxy setting->enable.
發現還需要安裝IIS的ARR(Application Request Routing)模組
安裝ARR模組並啟用"Enable proxy"就正常了
Microsoft Application Request Routing 3.0 (x64)
https://www.microsoft.com/en-us/download/details.aspx?id=47333

鍵盤按鍵都亂掉了?打U變4、I變5、O變6、J變1、K變2、L變3

https://mrtang.tw/blog/post/37364351

誤觸「Number Lock」
筆電可能要Fn + 「Number Lock」

2019年8月12日 星期一

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

application.properties要設定資料庫DataSource,範例如下:
spring.datasource.url=jdbc:sqlserver://localhost:1433;DatabaseName=AdventureWorks2017
spring.datasource.username=資料庫登入帳號
spring.datasource.password=資料庫登入密碼
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.default_schema=dbo



2019-08-12 22:14:57.490  INFO 21212 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-08-12 22:14:57.510  INFO 21212 --- [           main] o.apache.catalina.core.
StandardService   : Starting service [Tomcat]
2019-08-12 22:14:57.510  INFO 21212 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.22]
2019-08-12 22:14:57.628  INFO 21212 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-08-12 22:14:57.629  INFO 21212 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1034 ms
2019-08-12 22:14:57.694  WARN 21212 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-08-12 22:14:57.696  INFO 21212 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-08-12 22:14:57.708  INFO 21212 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-08-12 22:14:57.713 ERROR 21212 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

2019年8月7日 星期三

DBCP和c3p0連線timeout設置

因為預設值都是indefinitely無限制等待
如果Connection Pool滿載,應用程式要不到閒置的Connection,會造成應用程式的Block無任何反應
建議一定要設定 timeout

https://blog.csdn.net/qq_34359363/article/details/72763491
DBCP 
最小连接数 minIdle(預設值為0)
初始化连接数 initialSize(預設值為0)
最大连接数 maxTotal(預設值為8)
最大等待时间 maxWaitMillis(預設值為無限毫秒)
詳細資訊 https://commons.apache.org/proper/commons-dbcp/configuration.html
Hibernate要設定hibernate.dbcp.maxWaitMillis

c3p0    
最小连接数 minPoolSize(預設值為3)
初始化连接数 initialPoolSize(預設值為3)
最大连接数 maxPoolSize(預設值為15)
最大等待时间 maxIdleTime(預設值為無限秒)
詳細資訊 https://www.mchange.com/projects/c3p0/#maxIdleTime
Hibernate要設定hibernate.c3p0.maxIdleTime 

2019年6月22日 星期六

Java 版本清查作業 PowerShell指令

Get-ChildItem -Recurse –Path C:\ -Include *jre* | ?{ $_.PSIsContainer } | Select-Object FullName

C:\要改成要清查的磁碟機
指令只會找資料夾
JDK也會有JRE資料夾
找到後再用java -version確認Java廠商(Oracle、IBM等)和版本

2019年5月21日 星期二

Docker與ISO

原文網址:https://kknews.cc/zh-tw/tech/nq4jnq.html

PCI DSS第2.2.1章節當中指出一個虛擬系統組件或者設備只能實現一項主要功能


用戶權限

如果大家在容器內擁有root權限,那麼在主機上亦將具備root身份。在系統中非root用戶只要加入Docker用戶組,就無需使用sudo的情況下運行Docker命令。同樣,添加了--privileged參數運行的容器也將獲得主機的完全控制權。這種情況,首先,建議大家儘量不要使用--privileged參數,若實在有業務需求,可以將所有需要--privileged參數的容器嚴格控制在一台或某幾台主機以隔離其他容器。其次,建議大家配合sudo來增加用戶的審計和日誌功能,在/ect/sudoers中添加以下內容: user ALL=(ALL) /usr/bin/docker ,這樣user使用Docker命令的時候需要密碼驗證,並會在系統中記錄所有的操作日誌用於審計。