2019年10月6日 星期日
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
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
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).
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.
2019-08-12 22:14:57.510 INFO 21212 --- [ main] org.apache.catalina.core.
2019-08-12 22:14:57.628 INFO 21212 --- [ main] o.a.c.c.C.[Tomcat].[localhost]
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] ConfigServletWebServerApplicat
2019-08-12 22:14:57.696 INFO 21212 --- [ main] o.apache.catalina.core.
2019-08-12 22:14:57.708 INFO 21212 --- [ main] ConditionEvaluationReportLoggi
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.
***************************
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
如果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年8月5日 星期一
TSQL的outer apply範例
http://sqlfiddle.com/#!18/d47fe/2
ref:
https://docs.microsoft.com/zh-tw/sql/t-sql/queries/from-transact-sql?view=sql-server-2017
合併查詢結果
http://vito-note.blogspot.com/2013/05/blog-post_134.html
[SQL] APPLY
http://jengting.blogspot.com/2014/03/apply.html
https://www.mssqltips.com/sqlservertip/1958/sql-server-cross-apply-and-outer-apply/
SQL Server 2005 新功能-APPLY 運算子
https://blog.xuite.net/sunnysoap/r/15570805-SQL+Server+2005+%E6%96%B0%E5%8A%9F%E8%83%BD-APPLY+%E9%81%8B%E7%AE%97%E5%AD%90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select c.cid as CUSTOMER_cid,c.name,c.sex,t.arm,t.note,t.lastupdatedate ,t.cid as MilitaryServiceHistory_cid from CUSTOMER AS c | |
Outer apply | |
(select top (1) mh.cid ,mh.arm ,mh.note ,mh.lastupdatedate | |
from MilitaryServiceHistory AS mh | |
where mh.cid = c.cid | |
order by mh.lastupdatedate desc | |
) t; |
ref:
https://docs.microsoft.com/zh-tw/sql/t-sql/queries/from-transact-sql?view=sql-server-2017
合併查詢結果
http://vito-note.blogspot.com/2013/05/blog-post_134.html
[SQL] APPLY
http://jengting.blogspot.com/2014/03/apply.html
https://www.mssqltips.com/sqlservertip/1958/sql-server-cross-apply-and-outer-apply/
SQL Server 2005 新功能-APPLY 運算子
https://blog.xuite.net/sunnysoap/r/15570805-SQL+Server+2005+%E6%96%B0%E5%8A%9F%E8%83%BD-APPLY+%E9%81%8B%E7%AE%97%E5%AD%90
2019年6月22日 星期六
Java 版本清查作業 PowerShell指令
Get-ChildItem -Recurse –Path C:\ -Include *jre* | ?{ $_.PSIsContainer } | Select-Object FullName
C:\要改成要清查的磁碟機
指令只會找資料夾
JDK也會有JRE資料夾
找到後再用java -version確認Java廠商(Oracle、IBM等)和版本
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命令的時候需要密碼驗證,並會在系統中記錄所有的操作日誌用於審計。
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命令的時候需要密碼驗證,並會在系統中記錄所有的操作日誌用於審計。
訂閱:
文章 (Atom)