I'm running Neo4j 2.0.1 in Embedded HA mode in Tomcat 7. Everything works fine, I also managed to make the "webadmin" module work using the solution described here: https://github.com/theon/neo4j-war-with-webadmin
The Embedded server runs on localhost:7474, http://localhost:7474/webadmin/#/info/org.neo4j/High%20Availability/ showing all nodes in the cluster.
The problem is that accessing http://localhost:7474/db/manage/server/ha/master (or /slave or /master) always returns 404.
Curl:
C:\Windows\system32>curl -v localhost:7474/db/manage/server/ha/available
* Adding handle: conn: 0x2053d10
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x2053d10) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 7474 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 7474 (#0)
> GET /db/manage/server/ha/available HTTP/1.1
> User-Agent: curl/7.33.0
> Host: localhost:7474
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Access-Control-Allow-Origin: *
< Content-Type: text/html; charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 0
* Server Jetty(9.0.5.v20130815) is not blacklisted
< Server: Jetty(9.0.5.v20130815)
<
* Connection #0 to host localhost left intact
Tomcat log:
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.server.Server - REQUEST /db/manage/server/ha/available on HttpChannelOverHttp#956fe72{r=1,a=DISPATCHED,uri=/db/manage/server/ha/available}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.j.server.handler.ContextHandler - scope null||/db/manage/server/ha/available # o.e.j.s.h.MovedContextHandler#6703f008{/,null,AVAILABLE}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.j.server.handler.ContextHandler - context=||/db/manage/server/ha/available # o.e.j.s.h.MovedContextHandler#6703f008{/,null,AVAILABLE}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.j.server.handler.ContextHandler - scope null||/db/manage/server/ha/available # o.e.j.w.WebAppContext#2e612ff1{/webadmin,file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/main_webapp/WEB-INF/classes/webadmin-html/,AVAILABLE}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.j.server.handler.ContextHandler - scope null||/db/manage/server/ha/available # o.e.j.s.ServletContextHandler#1384d8d1{/db/manage,null,AVAILABLE}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.j.server.handler.ContextHandler - context=/db/manage||/server/ha/available # o.e.j.s.ServletContextHandler#1384d8d1{/db/manage,null,AVAILABLE}
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.server.session - sessionManager=org.eclipse.jetty.server.session.HashSessionManager#56444482
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.server.session - session=null
17:28:24.775 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.servlet.ServletHandler - servlet /db/manage||/server/ha/available -> org.neo4j.server.web.NeoServletContainer-2094766571#81874825==org.neo4j.server.web.NeoServletContainer,-1,true
17:28:24.776 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.servlet.ServletHandler - chain=org.neo4j.server.rest.security.SecurityFilter-828500158->org.neo4j.server.web.NeoServletContainer-2094766571#81874825==org.neo4j.server.web.NeoServletContainer,-1,true
17:28:24.776 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.servlet.ServletHandler - call filter org.neo4j.server.rest.security.SecurityFilter-828500158
17:28:24.776 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.servlet.ServletHandler - call servlet org.neo4j.server.web.NeoServletContainer-2094766571#81874825==org.neo4j.server.web.NeoServletContainer,-1,true
17:28:24.776 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.server.HttpConnection - org.eclipse.jetty.server.HttpConnection$CommitCallback#2e5af328 generate: NEED_HEADER (null,[p=0,l=0,c=0,r=0],true)#START
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.server.HttpConnection - org.eclipse.jetty.server.HttpConnection$CommitCallback#2e5af328 generate: FLUSH ([p=0,l=204,c=20480,r=204],[p=0,l=0,c=0,r=0],true)#COMPLETING
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.WriteFlusher - write: WriteFlusher#42289da6{IDLE} [HeapByteBuffer#1c21a7ab[p=0,l=204,c=20480,r=204]={<<<HTTP/1.1 404 Not ....v20130815)||||>>>?????????????????...???????????????}]
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.WriteFlusher - update WriteFlusher#42289da6{WRITING}:IDLE-->WRITING
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.ChannelEndPoint - flushed 204 SelectChannelEndPoint#1728ae41{/127.0.0.1:49466<r-l>/127.0.0.1:7474,o=true,is=false,os=false,fi=FillInterest#6fc83947{false,null},wf=WriteFlusher#42289da6{WRITING},it=30000}{HttpConnection#78861f38{FILLING},g=HttpGenerator{s=COMPLETING},p=HttpParser{s=END,0 of 0}}{io=0,kio=0,kro=1}
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.WriteFlusher - flushed true
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.WriteFlusher - update WriteFlusher#42289da6{IDLE}:WRITING-->IDLE
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.server.HttpConnection - org.eclipse.jetty.server.HttpConnection$CommitCallback#2e5af328 generate: SHUTDOWN_OUT ([p=204,l=204,c=20480,r=0],[p=0,l=0,c=0,r=0],true)#END
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.io.ChannelEndPoint - oshut SelectChannelEndPoint#1728ae41{/127.0.0.1:49466<r-l>/127.0.0.1:7474,o=true,is=false,os=false,fi=FillInterest#6fc83947{false,null},wf=WriteFlusher#42289da6{IDLE},it=30000}{HttpConnection#78861f38{FILLING},g=HttpGenerator{s=END},p=HttpParser{s=END,0 of 0}}{io=0,kio=0,kro=1}
17:28:24.777 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG o.e.jetty.server.HttpConnection - org.eclipse.jetty.server.HttpConnection$CommitCallback#2e5af328 generate: DONE ([p=204,l=204,c=20480,r=0],[p=0,l=0,c=0,r=0],true)#END
17:28:24.778 [qtp1865404499-150 - /db/manage/server/ha/available] DEBUG org.eclipse.jetty.server.Server - RESPONSE /db/manage/server/ha/available 404 handled=true
Update 1
I was missing MasterInfoService.class from the classpath. I've added a dependecy to neo4j-server-enterprise but this hasn't fixed the problem, MasterInfoService seems to not be called.
Related
ES cloud is hosted in Azure. It works in spring data ES 4.1.5(ES client 7.9.3). But spring data ES 4.4.1 (ES client 7.17.4) requires cluster:monitor/main permission.
My admin doesn't want to grant such permission.
"root_cause":[{"type":"security_exception","reason":"action [cluster:monitor/main] is unauthorized for user [xxxx] with roles
I first asked question in this post. Val pointed out / end point cluster level API requires this permission.
why does it need cluster:monitor/main permission
I did some debug and found out more details. Spring data ES is sending HEAD / and GET / during SimpleElasticsearchRepository initialization.
Sorry I can't get the format working. So I attach screenshot here
There is error during SimpleElasticsearchRepository initialization. SimpleElasticsearchRepository -> RestIndexTemplate -> RestHighLevelClient
During SimpleElasticsearchRepository initialization, indices are empty. So the normal HEAD request on actual index becomes HEAD /. This user account doesn't have permission on sending HEAD /
Since the purpose is to check if index exists, is it possible to skip checking with server if indices are empty? Because it turns into request to check cluster level info. And below requests require total different permission.
HEAD /
HEAD /actual_index
I also find this error in the log. I couldn't find out how it was being sent out in spring data ES. This use can't run GET / neither.
It works in spring data ES 4.1.5 Why didn't Spring data ES 4.1.5 send out above HEAD / and GET / requests?
Updated to include my original post.
I found out my details about the issues.
HEAD /
During SimpleElasticsearchRepository initialization, it does below. My index has createIndex = true. So it goes to check exists(). But the index is empty here, so HEAD / my_index becomes HEAD /.
I don't know why index is empty here. But I set createIndex = false to skip it.
if (this.shouldCreateIndexAndMapping() && !this.indexOperations.exists()) {
this.indexOperations.createWithMapping();
}
GET /
Based on my testing, GET / is being sent out once per session. It acts like network connectivity testing. If there is any error, it will be ignored.
//MainClientExec - [exchange: 1] start execution -- GET / HTTP/1.1[\r][\n] -- once per session
11:58:46.648 [main] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 1] start execution
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> GET / HTTP/1.1
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> X-Elastic-Client-Meta: es=7.17.4p,jv=1.8,t=7.17.4p,hc=4.1.4,kt=1.6,gy=2.4
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 0
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: xxx.azure.elastic-cloud.com:9243
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: elasticsearch-java/7.17.4-SNAPSHOT (Java/1.8.0_331)
11:58:46.967 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: Basic xxx
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 403 Forbidden[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Length: 4157[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Cloud-Request-Id: 3TA-1pHlTXuLbAoue0rKZw[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Elastic-Product: Elasticsearch[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Found-Handling-Cluster: aaf9bff719c349bbad7a015615a994f7[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Found-Handling-Instance: instance-0000000001[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Fri, 22 Jul 2022 16:58:46 GMT[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
11:58:47.105 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 << "{"error":{"root_cause":[{"type":"security_exception","reason":"action [cluster:monitor/main] is unauthorized for user
11:58:47.115 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 403 Forbidden
11:58:47.115 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 1] Response received HTTP/1.1 403 Forbidden
11:58:47.126 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.InternalIODispatch - http-outgoing-0 [ACTIVE(4157)] Input ready
11:58:47.126 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 1] Consume content
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.InternalHttpAsyncClient - [exchange: 1] Connection can be kept alive indefinitely
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 1] Response processed
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.InternalHttpAsyncClient - [exchange: 1] releasing connection
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl - http-outgoing-0
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Releasing connection: [id: http-outgoing-0][route: {s}->https://
11:58:47.131 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Connection [id: http-outgoing-0][route: {s}->https://
11:58:47.132 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl - http-outgoing-0 10.2
11:58:47.133 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager - Connection released: [id: http-outgoing-0][
After above, the real query is sent.
//MainClientExec - [exchange: 2] start execution - GET /my_index/_doc/asdf HTTP/1.1
11:58:47.137 [main] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 2] start execution
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> GET /my_index/_doc/asdf HTTP/1.1
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> X-Elastic-Client-Meta: es=7.17.4p,jv=1.8,t=7.17.4p,hc=4.1.4,kt=1.6,gy=2.4
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 0
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: xxx.azure.elastic-cloud.com:9243
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: elasticsearch-java/7.17.4-SNAPSHOT (Java/1.8.0_331)
11:58:47.147 [I/O dispatcher 1] DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: Basic xx==
11:58:47.148 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl - http-outgoing-0 10.24.15.131:58069<->52.158.162.229:9243[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][0]: Event set [w]
11:58:47.148 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.client.MainClientExec - [exchange: 2] Request completed
11:58:47.148 [I/O dispatcher 1] DEBUG org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl - http-outgoing-0 10.24.15.131:58069<->52.158.162.229:9243[ACTIVE][rw:w][ACTIVE][rw][NOT_HANDSHAKING][0][0][372]: 343 bytes written
11:58:47.148 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 >> "GET /my_index/_doc/asdf HTTP/1.1[\r][\n]"
11:58:47.148 [I/O dispatcher 1] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-Elastic-Client-Meta: es=7.17.4p,jv=1.8,t=7.17.4p,hc=4.1.4,kt=1.6,gy=2.4[\r][\n]"
I tried to build an application to connect to Twitter and post tweets. I created twitter template using spring social.
pom.xml
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-twitter</artifactId>
<version>1.1.0.RELEASE</version>
</dependency>
twitter template
return new TwitterTemplate(consumerKey, consumerSecret, accessToken,
accessTokenSecret);
But I am getting the following error.
Caused by: org.springframework.social.MissingAuthorizationException: Authorization is required for the operation, but the API binding was created without authorization.
I added Read and Write permissions under app settings in the developer portal as well.
logs, of HTTPS calls, made to Twitter
12:19:49.750 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /1.1/statuses/update.json HTTP/1.1[\r][\n]"
12:19:49.751 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/json, application/*+json[\r][\n]"
12:19:49.751 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/x-www-form-urlencoded;charset=UTF-8[\r][\n]"
12:19:49.751 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Authorization: OAuth oauth_nonce="2562115169", oauth_token="my_token", oauth_consumer_key="my_key", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1632466188", oauth_version="1.0", oauth_signature="iwmB09dBm2R7SJ07w8CAlN4EiT8%3D"[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 27[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: api.twitter.com[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.10 (Java/1.8.0_231)[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
12:19:49.752 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
12:19:49.753 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "status=Test+eng+model+tweet"
12:19:50.257 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 401 Unauthorized[\r][\n]"
What am I missing, any help is appreciated. Thanks in advance
I have an inverse wish from most other posts regarding log4j2 logging of MyBatis. I am getting the MyBatis SQL logged, but I want to reduce it.
Below is my log4j2.properties file.
At present, I have the rootLogger.level=ALL in effect.
This is nicely displaying all log messages, including the MyBatis Prepare SQL and parameters list.
When I change it to
rootLogger.level=FATAL
all MyBatis messages stop appearing in console and log file, as do other messages.
So this is working well.
But I would like to have MyBatis logging at level=ERROR (or higher) for normal circumstances and the rest staying at ALL.
When I change the
# MyBatis logging configuration...
com.wert.bus.mappers=TRACE
to any other Level, it does not take effect.
I prefixed "log4j", "log4j2", "log4j.logger", "log4j2.logger" before "com.wert"
but it had no effect.
The mappers have namespace com.wert.bus.mappers
The output on the first session:
[DEBUG] 2018-07-21 01:56:35.648 [main] LogFactory - Logging initialized using 'class org.apache.ibatis.logging.log4j2.Log4j2Impl' adapter.
[DEBUG] 2018-07-21 01:56:43.201 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.207 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.213 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.219 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.225 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.231 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
[DEBUG] 2018-07-21 01:56:43.237 [main] PooledDataSource - PooledDataSource forcefully closed/removed all connections.
The output on a query:
[DEBUG] 2018-07-21 02:00:10.047 [main] JdbcTransaction - Opening JDBC Connection
[DEBUG] 2018-07-21 02:00:19.739 [main] PooledDataSource - Created connection 105321150.
[DEBUG] 2018-07-21 02:00:19.823 [main] insertJobStatus - ==> Preparing: insert bus_loc ( loc_date, loc_name, status, start_time, end_time) values ( ?, ?, ?, ?, ?)
[DEBUG] 2018-07-21 02:00:24.512 [main] insertJobStatus - ==> Parameters: 2018-07-21 01:56:26.978(String), Boston(String), Prep(String), 2018-07-21 01:59:41(String), null
[DEBUG] 2018-07-21 02:00:25.034 [main] insertJobStatus - <== Updates: 1
What have I missed?
Thanks in advance for your help.
log4j2.properties
#status = trace for log4j2 startup issues
#status other values: trace, debug, info, warn, error, fatal
status = error
dest = err
#Time interval to check for changes to file in seconds
monitorInterval = 300
name=BusLoggingConfig
property.filename=logs
appenders=console,rolling
# MyBatis logging configuration...
com.wert.bus.mappers=TRACE
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %m%n
#appender.console.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
appender.rolling.type = RollingFile
appender.rolling.name = RollingFile
appender.rolling.fileName = ${filename}/Bus.log
appender.rolling.filePattern = logs/Bus-%d{yyyyMMdd-HHmmss}-%i.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 20
loggers=rolling
logger.rolling.name=com.wert.bus
#logger.rolling.level=debug
logger.rolling.additivity=true
logger.rolling.appenderRef.rolling.ref=RollingFile
rootLogger.level=ALL
rootLogger.appenderRefs=stdout
rootLogger.appenderRef.stdout.ref=STDOUT
One of the problems is using additivity for child logger:
logger.rolling.additivity=true
This settings means that every logging event will be processed twice. First time using appenders and levels for logger com.wert.bus and then by parent (in your case root) logger.
Im trying to switch the pool for my Grails 2.5.4 app for Hikari and found it to make a pretty big performance boost compared to the default Tomcat jdbc!
However, Ive stumbled upon a problem when running some integration tests. This is the test method that is now failing:
def 'Returns the bar with the least foo'() { given:
def foobar = Foobar.build()
and:
def bar1 = Bar.build(foo: 25, foobar: foobar)
def item1 = BarItem.build(state: AVAILABLE)
item1.addToBars(bar1)
and:
def bar2 = Bar.build(foo: 12, foobar: foobar)
def item2 = BarItem.build(state: AVAILABLE)
item2.addToBars(bar2)
when:
def bestBar = foobar.getBestBar()
then:
bestBar.id == bar2.id
when:
item2.state = State.BLACKED_OUT
item2.save(flush: true)
def refreshedFoobar
Foobar.withNewSession {
refreshedFoobar = Foobar.get(foobar.id) //This is returning null
}
and:
bestBar = refreshedFoobar.getBestBar() //null pointer exception here
then:
bestBar.id == bar1.id
}
Why is this happening? Seems like things arent being pushed into the database properly, like its just holding them in session waiting to send them later.
Here is my Hikari config:
def hp = new Properties()
hp.username = ds.username
hp.password = ds.password
hp.connectionTimeout = ds.maxWait
hp.maximumPoolSize = ds.maxActive
hp.minimumIdle = ds.minIdle
hp.jdbcUrl = ds.url
hp.driverClassName = ds.driverClassName
HikariConfig hc = new HikariConfig(hp)
hc.with{
addDataSourceProperty("prepStmtCacheSize", 500)
addDataSourceProperty("prepStmtCacheSqlLimit", 2048)
addDataSourceProperty("cachePrepStmts", true)
addDataSourceProperty("useServerPrepStmts", true)
}
values being
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
driverClassName = 'com.mysql.jdbc.Driver'
username = 'user'
password = 'pass'
maxActive = 250
minIdle = 5
maxWait = 10000
Log:
2016-08-04 17:49:28,070 [main] DEBUG hikari.HikariConfig - HikariPool-1 - configuration:
2016-08-04 17:49:28,071 [main] DEBUG hikari.HikariConfig - allowPoolSuspension.............false
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - autoCommit......................true
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - catalog.........................null
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - connectionInitSql...............null
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - connectionTestQuery.............null
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - connectionTimeout...............10000
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - dataSource......................null
2016-08-04 17:49:28,072 [main] DEBUG hikari.HikariConfig - dataSourceClassName.............null
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - dataSourceJNDI..................null
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - dataSourceProperties............{password=<masked>}
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - driverClassName................."com.mysql.jdbc.Driver"
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - healthCheckProperties...........{}
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - healthCheckRegistry.............null
2016-08-04 17:49:28,073 [main] DEBUG hikari.HikariConfig - idleTimeout.....................600000
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - initializationFailFast..........true
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - isolateInternalQueries..........false
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - jdbc4ConnectionTest.............false
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - jdbcUrl........................."jdbc:mysql://localhost:3306/foo_test?autoReconnect=true"
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - leakDetectionThreshold..........0
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - maxLifetime.....................1800000
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - maximumPoolSize.................250
2016-08-04 17:49:28,074 [main] DEBUG hikari.HikariConfig - metricRegistry..................null
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - metricsTrackerFactory...........null
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - minimumIdle.....................250
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - password........................<masked>
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - poolName........................"HikariPool-1"
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - readOnly........................false
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - registerMbeans..................false
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - scheduledExecutorService........null
2016-08-04 17:49:28,075 [main] DEBUG hikari.HikariConfig - threadFactory...................null
2016-08-04 17:49:28,076 [main] DEBUG hikari.HikariConfig - transactionIsolation............null
2016-08-04 17:49:28,076 [main] DEBUG hikari.HikariConfig - username........................"root"
2016-08-04 17:49:28,076 [main] DEBUG hikari.HikariConfig - validationTimeout...............5000
2016-08-04 17:49:28,077 [main] INFO hikari.HikariDataSource - HikariPool-1 - Started.
2016-08-04 17:49:28,287 [main] INFO pool.PoolBase - HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
2016-08-04 17:49:28,312 [HikariPool-1 housekeeper] DEBUG pool.HikariPool - HikariPool-1 - Pool stats (total=0, active=0, idle=0, waiting=0)
2016-08-04 17:49:28,381 [HikariPool-1 connection adder] DEBUG pool.HikariPool - HikariPool-1 - Added connection com.mysql.jdbc.JDBC4Connection#2929ca0e
....
Then I get a lot of these:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
But I think thats just because of my local mysql settings, since I am using production pool size in settings
I have an ontology that imports another ontology (both are stored in the same folder on my machine, created using Protege & saved as RDF/XML). When I create the ontology model in my java application through Jena, I get the following
0 [main] DEBUG org.apache.jena.riot.system.stream.JenaIOEnvironment - Failed to find configuration: location-mapping.ttl;location-mapping.rdf;location-mapping.n3;etc/location-mapping.rdf;etc/location-mapping.n3;etc/location-mapping.ttl
297 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
300 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.LocationMapper - Failed to find configuration: file:location-mapping.rdf;file:location-mapping.n3;file:location-mapping.ttl;file:etc/location-mapping.rdf;file:etc/location-mapping.n3;file:etc/location-mapping.ttl
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorURL
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorFile
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: LocatorURL
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Add location: ClassLoaderLocator
301 [main] DEBUG com.hp.hpl.jena.util.FileManager - Found: file:ont-policy.rdf (ClassLoaderLocator)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - readModel(model,http://www.semanticweb.org/myOnt)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - readModel(model,http://www.semanticweb.org/myOnt, null)
1002 [main] DEBUG com.hp.hpl.jena.util.FileManager - Not mapped: http://www.semanticweb.org/myOnt
2065 [main] WARN com.hp.hpl.jena.ontology.OntDocumentManager - An error occurred while attempting to read from http://www.semanticweb.org/myOnt. Msg was 'http://www.semanticweb.org/myOnt'.
This exception is also thrown
com.hp.hpl.jena.shared.DoesNotExistException
I understand that it is unable to find the imported ontology, and that one solution might be to create separate models for both ontologies, but there's an objective property in parent ontology which relates one of its class to the classes of imported ontology.
What can I do?