Mod_sec rule fails with hex CR or LF in POST - http-status-code-500

On a shared hosting platform, running a WordPress site with comments enabled, some comments are causing 500 errors. The server error.log file shows entries similar to this (some obfustication of path and IP address, and line breaks added for visual clarity):
[Thu Aug 12 13:38:35.782008 2021] [:error] [pid 24207:tid 3383178114816]
[client 24.113.161.xxx:59792] [client xx.xx.xx.x] ModSecurity: Warning.
Pattern match "(?:get|post|head|options|connect|put|delete|trace|track|patch|propfind|propatch|mkcol|copy|move|lock|unlock)
\\\\s+(?:\\\\/|\\\\w)[^\\\\s]*(?:\\\\s+http\\\\/\\\\d|[\\\\r\\\\n])"
at REQUEST_BODY. [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-921-PROTOCOL-ATTACK.conf"] [line "52"] [id "921110"]
[msg "HTTP Request Smuggling Attack"]
[data "Matched Data: post request.\\x0d found within REQUEST_BODY: comment=#nick - the error logs indicate that there is some hex characters embedded in the text that causes the 500 error. you may not be able to see the hex characters,
but they are recognized as a code injection attempt, which is why the server blocks them (via the mod_sec3_crs module, which interprets the pattern as being a security risk, and therefore blocks the request, which is returned as a 500 error).
\\x0d\\x0a\\x0d\\x0athe embedded characters..."]
[severity "CRITICAL"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"]
[tag "paranoia- [hostname "www.ttgnet.com"]
[uri "/journal/wp-comments-post.php"] [unique_id "YRWGy9SRhtRZmIT81gkAvAAAAA8"], referer: https://example.com/journal/
Similar entries in the error log also catch the hex values for CR/LF as rule violations. Not all comment posts cause the 500 error (or entries in the server error log), but all of the errors seem to include the CR/LF hex pattern in the error message.
I am not well-versed in how mod-sec works. Where should I start to diagnose?
Added
Here's a sample complete line from the log file, with folder names anonymized:
Line 49: [Tue Sep 21 14:16:06.979253 2021] [:error] [pid 21757:tid 3479988672256] [client 38.13.110.xxx:60982] [client 38.13.110.xxx] ModSecurity: Warning. detected SQLi using libinjection with fingerprint 'son;n' [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-942-APPLICATION-ATTACK-SQLI.conf"] [line "65"] [id "942100"] [msg "SQL Injection Attack Detected via libinjection"] [data "Matched Data: son;n found within ARGS:comment: \\x22Put the MP3 files in a zip archive, with a password, put the file in Dropbox, email the link in one email, password in a separate email. No postage involved. \\x22\\x0d\\x0a\\x0d\\x0a \\x0d\\x0a\\x0d\\x0aI can do that.\\xc2\\xa0 A password protected folder on my website.\\xc2\\xa0 Great idea Ray!!!\\x0d\\x0a\\x0d\\x0a "] [severity "CRITICAL"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-sqli"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/152/248/66"] [tag "PCI/6.5.2"] [hostname "www.example.com"] [uri "/folder/wp-comments-post.php"] [unique_id "YUpLllhFado5xTTGY0P7wwAAAA8"], referer: https://www.example.com/journal/post-title/
This is a comment to a WordPress post, and from a known commentor. Standard comment entry box.
Why would this be blocked - and causing a 500 error?
ADDED
Here's another error from the server error log. Note that the submitter is not a hacker (I know the person); just a commenter on the site.
[Thu Sep 23 11:43:42.440238 2021] [:error] [pid 8853:tid 3479955101440] [client 75.53.225.xxx:56406] [client 75.53.225.xxx] ModSecurity: Warning. Pattern match "(?:get|post|head|options|connect|put|delete|trace|track|patch|propfind|propatch|mkcol|copy|move|lock|unlock)\\\\s+(?:\\\\/|\\\\w)[^\\\\s]*(?:\\\\s+http\\\\/\\\\d|[\\\\r\\\\n])" at ARGS:comment. [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-921-PROTOCOL-ATTACK.conf"] [line "52"] [id "921110"] [msg "HTTP Request Smuggling Attack"] [data "Matched Data: lock home.\\x0d found within ARGS:comment: it's the people.\\xc2\\xa0 the un isn't forcing them to be dirty.\\xc2\\xa0 the clinton's removed people from the island, which should have helped (yeah, poor taste).\\x0d\\x0a\\x0d\\x0a\\xa0\\x0d\\x0a\\x0d\\x0aif they don't want to live in garbage under a bridge stay the flock home.\\x0d\\x0a\\x0d\\x0a\\xa0\\x0d\\x0a\\x0d\\x0an"] [severity "CRITICAL"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "capec/1000/210/272/220/33"] [hostname "www.example.com"] [uri "/journal/wp-comments-post.php"] [unique_id "YUzK3shjwDZMxbYxHQ83EQAAAA8"], referer: https://www.example.com/journal/2021/09/23/thur-sept-23-2021-tired-but-the-weather-is-great/
[Thu Sep 23 11:43:42.440563 2021] [:error] [pid 8853:tid 3479955101440] [client 75.53.225.xxx:56406] [client 75.53.225.xxx] ModSecurity: Warning. Pattern match "(?:get|post|head|options|connect|put|delete|trace|track|patch|propfind|propatch|mkcol|copy|move|lock|unlock)\\\\s+(?:\\\\/|\\\\w)[^\\\\s]*(?:\\\\s+http\\\\/\\\\d|[\\\\r\\\\n])" at REQUEST_BODY. [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-921-PROTOCOL-ATTACK.conf"] [line "52"] [id "921110"] [msg "HTTP Request Smuggling Attack"] [data "Matched Data: lock home.\\x0d found within REQUEST_BODY: comment=it's the people.\\xc2\\xa0 the un isn't forcing them to be dirty.\\xc2\\xa0 the clinton's removed people from the island, which should have helped (yeah, poor taste).\\x0d\\x0a\\x0d\\x0a\\xa0\\x0d\\x0a\\x0d\\x0aif they don't want to live in garbage under a bridge stay the flock home.\\x0d\\x0a\\x0d\\x0a\\xa0\\x0d\\x0a\\x0d\\x0an&author=nick flandrey&email=flandrey#aol.com&url=https://www.example.com/journal/&wp-comment-cookies-consent=yes&bcsb_hidden=6f29fb34-6a01..."] [severity "CRITICAL"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "paranoia- [hostname "www.example.com"] [uri "/journal/wp-comments-post.php"] [unique_id "YUzK3shjwDZMxbYxHQ83EQAAAA8"], referer: https://www.example.com/journal/2021/09/23/thur-sept-23-2021-tired-but-the-weather-is-great/
[Thu Sep 23 11:43:42.458524 2021] [:error] [pid 8853:tid 3479955101440] [client 75.53.225.xxx:56406] [client 75.53.225.xxx] ModSecurity: Access denied with code 418 (phase 2). Operator GE matched 7 at TX:anomaly_score. [file "/dh/apache2/template/etc/mod_sec3_CRS/REQUEST-949-BLOCKING-EVALUATION.conf"] [line "93"] [id "949110"] [msg "Inbound Anomaly Score Exceeded (Total Score: 10)"] [severity "CRITICAL"] [ver "OWASP_CRS/3.3.2"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-generic"] [hostname "www.example.com"] [uri "/journal/wp-comments-post.php"] [unique_id "YUzK3shjwDZMxbYxHQ83EQAAAA8"], referer: https://www.example.com/journal/2021/09/23/thur-sept-23-2021-tired-but-the-weather-is-great/

Are you sure these are really not attack attempts?

You will probably need to write an exclusion rule, here's an example of very simple one which should work:
SecRule REQUEST_FILENAME "#streq /journal/wp-comments-post.php" \
"id:9990000,\
phase:1,\
pass,\
t:none,\
nolog,\
ctl:ruleRemoveTargetById=921110;ARGS:comment,\
ctl:ruleRemoveTargetById=921110;REQUEST_BODY"
Put it into file REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf .

Related

an error only occur when observing in lib/pq

I tried to debug a go server with gorm & pgsql, an it exitted with panic when gorm try to connect to the pgsql with code:
d, err := gorm.Open("postgres", param)
and as I followed the stack, I found it is the problem with lib/pq proccess the server version:
case "server_version":
var major1 int
var major2 int
var minor int
//r.string is the string of pgsql version.
//mine is: 12.4 (Debian 12.4-1.pgdg100+1)
_, err = fmt.Sscanf(r.string(), "%d.%d.%d", &major1, &major2, &minor)
if err == nil {
cn.parameterStatus.serverVersion = major1*10000 + major2*100 + minor
}
obivisouly, the string 12.4 (Debian 12.4-1.pgdg100+1) dosen't match format %d.%d.%d, so it exitted with error.
but the strange thing is, it will only exit when debugging in GoLand (don't know about vscode). It will not happen when simplely build & run, the output is:
[INFO] 2022-11-04 15:30:52 +0800 [start_postgres.go:103] detecting database connecting... pgdir=%v/yak/tmp_build/database
[INFO] 2022-11-04 15:30:52 +0800 [start_postgres.go:106] detected exsited database.
[INFO] 2022-11-04 15:30:52 +0800 [core.go:107] health info manager is loading
[INFO] 2022-11-04 15:30:52 +0800 [manager.go:70] health info: cache 60 infos
[INFO] 2022-11-04 15:30:52 +0800 [core.go:112] start to connection postgres
[INFO] 2022-11-04 15:30:52 +0800 [core.go:117] build basic database manager instance
which is absloutly normal. then I did some modify on the source code in lib/pq/conn.go
rString := r.string()
fmt.Printf("\n%s\n\n", rString)
_, err = fmt.Sscanf(r.string(), "%d.%d.%d", &major1, &major2, &minor)
if err == nil {
cn.parameterStatus.serverVersion = major1*10000 + major2*100 + minor
}
and here is the strangest thing, the server crashed with infinite loop of error logging:
[INFO] 2022-11-04 16:37:00 +0800 [start_postgres.go:103] detecting database connecting... pgdir=%v/yak/tmp_build/database
12.4 (Debian 12.4-1.pgdg100+1)
[WARN] 2022-11-04 16:37:00 +0800 [start_postgres.go:110] open database failed: pq: invalid message format; expected string terminator
[INFO] 2022-11-04 16:37:00 +0800 [start_postgres.go:113] try to start a database...
12.4 (Debian 12.4-1.pgdg100+1)
[WARN] 2022-11-04 16:37:02 +0800 [start_postgres.go:206] try pq: invalid message format; expected string terminator times... waiting for the postgres starting up...
12.4 (Debian 12.4-1.pgdg100+1)
[WARN] 2022-11-04 16:37:03 +0800 [start_postgres.go:206] try pq: invalid message format; expected string terminator times... waiting for the postgres starting up...
12.4 (Debian 12.4-1.pgdg100+1)
[WARN] 2022-11-04 16:37:04 +0800 [start_postgres.go:206] try pq: invalid message format; expected string terminator times... waiting for the postgres starting up...
...
I can't figure it out why would this happen, I don't think it's in a goroutine because the main routine is blocked, so is there anyone can offer some helps?
versions of dependencies and IDE:
GoLand v2022.2.4
go version go1.19.2 linux/amd64
gorm v1.9.2
github.com/lib/pq v1.1.0
postgresql v12.4 (Debian 12.4-1.pgdg100+1)
I figured it out about the infinity loop of error, there's a select struct after the init connection, the code is:
select {
case <-ticker:
count++
conn, err := gorm.Open("postgres", param)
//conn, err := net.Dial("tcp", "127.0.0.1:5432")
if err != nil {
log.Warningf("try %v times... waiting for the postgres starting up...", err)
continue
}
_ = conn.Close()
return nil
}
so the problem is, when I print r.string(), it will return an error.
also it will exitted with panic in debug (GoLand) but work normally when build and run.

TEIID40007 Keepalive failed for session

I am trying to connect to federated vdb via Spotfire. I keep getting following error after fetching 200K plus records. There total of 3M records in the view
TEIID session timeout has no limit.
TEIID40007 Keepalive failed for session E0NBLogYqzk3
I am not experiencing the above error when I try to read the vdb in sql client like dbeaver or squirrel and can fetch entire dataset.
Below is the snippet from server.log in Jboss:
setup [PolicyOutInterceptor]
pre-logical [ClientRequestFilterInterceptor]
prepare-send [MessageSenderInterceptor]
write [BodyWriter]
prepare-send-ending [MessageSenderEndingInterceptor]
2022-09-08 12:01:06,358 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Invoking handleMessage on interceptor org.apache.cxf.jaxrs.client.WebClient$BodyWriter#511fa86c
2022-09-08 12:01:06,358 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor#4a217e2f
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.Headers] (Worker1579_QueryProcessorQueue29181462) Accept: application/json
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.Headers] (Worker1579_QueryProcessorQueue29181462) User-Agent: Teiid Server
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.Headers] (Worker1579_QueryProcessorQueue29181462) Content-length: 0
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.Headers] (Worker1579_QueryProcessorQueue29181462) Content-Type: application/json
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.HTTPConduit] (Worker1579_QueryProcessorQueue29181462) No Trust Decider for Conduit '{http://solrserver.net:8983/solr/document/select}WebClient.http-conduit'. An afirmative Trust Decision is assumed.
2022-09-08 12:01:06,359 FINE [org.apache.cxf.transport.http.HTTPConduit] (Worker1579_QueryProcessorQueue29181462) Sending POST Message with Headers to http://solrserver.net:8983/solr/document/select Conduit :{http://solrserver.net:8983/solr/document/select}WebClient.http-conduit
2022-09-08 12:01:06,359 INFO [org.teiid.SECURITY] (SessionMonitor) TEIID40007 Keepalive failed for session E0NBLogYqzk3
2022-09-08 12:01:06,359 INFO [org.teiid.SECURITY] (SessionMonitor) TEIID40007 Keepalive failed for session E0NBLogYqzk3
2022-09-08 12:01:06,359 DEBUG [org.teiid.SECURITY] (SessionMonitor) closeSession E0NBLogYqzk3
2022-09-08 12:01:06,359 DEBUG [org.teiid.SECURITY] (SessionMonitor) closeSession E0NBLogYqzk3
2022-09-08 12:01:06,359 DEBUG [org.teiid.AUDIT_LOG] (SessionMonitor) [svcpds] <session.logoff>
2022-09-08 12:01:06,359 DEBUG [org.teiid.AUDIT_LOG] (SessionMonitor) [svcpds] <session.logoff>
2022-09-08 12:01:06,359 DEBUG [org.teiid.COMMAND_LOG] (SessionMonitor) CANCEL SRC COMMAND: endTime=2022-09-08 12:01:06.359 requestID=E0NBLogYqzk3.5 sourceCommandID=7 executionID=8950651 txID=null modelName=PDS_SOURCE_MODEL translatorName=delegate sessionID=E0NBLogYqzk3 principal=svcpds finalRowCount=-1
2022-09-08 12:01:06,359 DEBUG [org.teiid.COMMAND_LOG] (SessionMonitor) CANCEL SRC COMMAND: endTime=2022-09-08 12:01:06.359 requestID=E0NBLogYqzk3.5 sourceCommandID=7 executionID=8950651 txID=null modelName=PDS_SOURCE_MODEL translatorName=delegate sessionID=E0NBLogYqzk3 principal=svcpds finalRowCount=-1
2022-09-08 12:01:06,360 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Adding interceptor org.apache.cxf.ws.policy.PolicyInInterceptor#3404a1c0 to phase receive
2022-09-08 12:01:06,360 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Adding interceptor org.apache.cxf.jaxrs.client.WebClient$ClientAsyncResponseInterceptor#6f403813 to phase unmarshal
2022-09-08 12:01:06,360 DEBUG [org.teiid.COMMAND_LOG] (SessionMonitor) CANCEL SRC COMMAND: endTime=2022-09-08 12:01:06.36 requestID=E0NBLogYqzk3.5 sourceCommandID=3 executionID=9226341 txID=null modelName=GF translatorName=rest sessionID=E0NBLogYqzk3 principal=svcpds finalRowCount=-1
2022-09-08 12:01:06,360 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Adding interceptor org.apache.cxf.jaxrs.client.spec.ClientResponseFilterInterceptor#43b0a15f to phase pre-protocol-frontend
2022-09-08 12:01:06,360 FINE [org.apache.cxf.phase.PhaseInterceptorChain] (Worker1579_QueryProcessorQueue29181462) Chain org.apache.cxf.phase.PhaseInterceptorChain#5af24963 was created. Current flow:
receive [PolicyInInterceptor]
pre-protocol-frontend [ClientResponseFilterInterceptor]
unmarshal [ClientAsyncResponseInterceptor]
Below is the error I am getting on Spotfire client:
ImportException at Spotfire.Dxp.Data:
Failed to create DataTable (HRESULT: 80131500)
Stack Trace:
at Spotfire.Dxp.Data.ColumnFactory.CreateColumns(DataRowReader reader, String documentTitleForOrigin, IDataPropertyContainer defaultProperties, DataPropertyRegistry dataPropertyRegistry, GlobalMethodRegistry globalMethodRegistry, CxxSession session, Boolean addNewProperties, PartialDataLoadReport loadReport, ResultProperties resultProperties, PendingViewRequestsManager pendingViewRequestsManager, Boolean mangleColumnNames)
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.<>c__DisplayClass75_0.<CreateView>b__0()
at Spotfire.Dxp.Framework.ApplicationModel.Progress.ExecuteSubtask(String title, ProgressOperation operation)
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.CreateView(CxxSession session, DataPropertyRegistry propertyRegistry, GlobalMethodRegistry globalMethodRegistry, DataSourceConnection connection, IDataPropertyContainer defaultColumnProperties, PartialDataLoadReport& partialLoadReport)
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.GetColumnsAndProperties(DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataItem.PerformUpdate(SourceColumnProducer producer, DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataItem.Update(SourceColumnProducer producer, DataSourceConnection connection)
at Spotfire.Dxp.Data.Persistence.DataPool.<LoadData>d__15.MoveNext()
at Spotfire.Dxp.Data.Producers.SourceColumnProducer.OnConfigure()
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<>c.<ConfigureSubTree>b__47_0(Node node)
at Spotfire.Dxp.Framework.DocumentModel.UndoableListAvlLeaf`1.ForEachChild(Action`1 action, Boolean includeFrozen)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<>c.<ConfigureSubTree>b__47_0(Node node)
at Spotfire.Dxp.Framework.DocumentModel.UndoableList`1.ForEachChild(Action`1 action, Boolean includeFrozen)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.DocumentModel.Node.<>c.<ConfigureSubTree>b__47_0(Node node)
at Spotfire.Dxp.Framework.DocumentModel.State.NodeState.<>c__DisplayClass92_0.<ForEachManagedChild>b__0(IDocumentNodeChild documentNodeChild)
at Spotfire.Dxp.Framework.DocumentModel.State.NodeState.ForEachChild(IDocumentNodeChild[] children, Action`1 action)
at Spotfire.Dxp.Framework.DocumentModel.Node.ConfigureSubTree()
at Spotfire.Dxp.Framework.ApplicationModel.Progress.ExecuteSubtask(String title, IndeterminateProgressFormatter progressFormatter, ProgressOperation operation)
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.ConfigureAndAttachFromNew()
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.AttachSubTreeWhileExecuting(UndoableNodeBase newOwner)
at Spotfire.Dxp.Framework.DocumentModel.UndoableNode.Spotfire.Dxp.Framework.DocumentModel.IUndoableNode.AttachItemToUndoableNode(Object item)
at Spotfire.Dxp.Framework.DocumentModel.UndoableKeyedCollection`2.<>c__DisplayClass43_0.<Insert>b__0()
at Spotfire.Dxp.Framework.DocumentModel.Node.InternalTransaction(Executor executor, Boolean rollbackNestedInternalTransactionAtException, Boolean isStreamingProperty)
at Spotfire.Dxp.Framework.DocumentModel.UndoableKeyedCollection`2.Insert(Int32 index, TNode item)
at Spotfire.Dxp.Data.DataTableCollection.<>c__DisplayClass89_0.<Add>b__0()
at Spotfire.Dxp.Framework.DocumentModel.Node.InternalTransaction(Executor executor, Boolean rollbackNestedInternalTransactionAtException, Boolean isStreamingProperty)
at Spotfire.Dxp.Data.DataTableCollection.Add(DataTable dataTable)
at Spotfire.Dxp.Application.PartiallyOpenedDataSource.<LoadData>d__9.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.<OpenPartiallyOpenedDocument>d__98.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.<OpenDataSource>d__91.MoveNext()
at Spotfire.Dxp.Application.AnalysisApplication.ConsumeDataLoadPromptRequests(IEnumerable`1 prompts)
at Spotfire.Dxp.Application.AnalysisApplication.Open(DataSource source, DocumentOpenSettings settings)
at Spotfire.Dxp.Forms.Data.Import.DataSourceFactoryService.OpenDataSourceWithoutPrompting(DataSource dataSource, DocumentOpenSettings documentOpenSettings, IServiceProvider serviceProvider)
at Spotfire.Dxp.Forms.Data.Import.DataSourceFactoryService.OpenDataSource(InformationLinkDataSource dataSource, DocumentOpenSettings documentOpenSettings, IServiceProvider serviceProvider)
at Spotfire.Dxp.Framework.ApplicationModel.Progress.<>c__DisplayClass21_0.<Start>b__0()
at Spotfire.Dxp.Framework.ApplicationModel.MonitorableProgress.Start[T](Func`1 action)
at Spotfire.Dxp.Forms.Application.FormsProgressService.ProgressThread.DoOperationLoop()
InformationModelException at Spotfire.Dxp.Data:
Failed to get data: 57014 TEIID30160 The request /IK4StVK70Kl.1 has been cancelled. (HRESULT: 80131500)
Stack Trace:
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.GetNextBlock()
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Spotfire.Dxp.Internal.Utilities.SeekableStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Spotfire.Dxp.Framework.ApplicationModel.ProgressIncrementStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Spotfire.Dxp.Internal.Utilities.SharedMemoryStream.CopyUnprotected(Stream inputStream, Int32 bufferSize)
at Spotfire.Dxp.Data.Cxx.CxxColumnManager.LoadSBDF(String id, Stream shm, Action streamWriter, Action abortAction, PartialTableCallback partialTableCallback, Boolean useFasterWipImplementation)
at Spotfire.Dxp.Data.Cxx.CxxDataTransfer.LoadSBDF(CxxSession session, Stream stream, PartialTableCallback partialTableCallback, Boolean useFasterSBDF)
at Spotfire.Dxp.Data.Import.SbdfDataRowReader.TryCreateCxxRepresentation(CxxSession session, Int64 exclusiveStartRowIndex, UInt64 maxRowsThatWillBeRead, PendingViewRequestsManager pendingViewRequestsManager, CxxTable& table)
at Spotfire.Dxp.Data.Cxx.CxxDataTransfer.CreateTable(DataRowReader dataRowReader, CxxSession session, PartialDataLoadReport report, Advancer rowAdvancer, Boolean needsReset, Int64 exclusiveStartRowIndex, UInt64 maxRowsThatWillBeRead, PendingViewRequestsManager partiallyLoadedConsumers)
at Spotfire.Dxp.Data.Cxx.CxxDataTransfer.CreateTable(DataRowReader dataRowReader, CxxSession session, PartialDataLoadReport report, PendingViewRequestsManager pendingViewRequestsManager, Boolean needsReset, UInt64 maxRowsToConsume)
at Spotfire.Dxp.Data.ColumnFactory.CreateColumns(DataRowReader reader, String documentTitleForOrigin, IDataPropertyContainer defaultProperties, DataPropertyRegistry dataPropertyRegistry, GlobalMethodRegistry globalMethodRegistry, CxxSession session, Boolean addNewProperties, PartialDataLoadReport loadReport, ResultProperties resultProperties, PendingViewRequestsManager pendingViewRequestsManager, Boolean mangleColumnNames)
InformationModelServiceException at Spotfire.Dxp.Services:
Failed to get data: 57014 TEIID30160 The request /IK4StVK70Kl.1 has been cancelled. (HRESULT: 80131509)
Stack Trace:
at Spotfire.Dxp.Services.WebServiceBase`1.InvokeService[T](ServiceMethod`1 serviceMethod, ExceptionFactoryMethod exceptionFactoryMethod, String customMethodNameForLogging)
at Spotfire.Dxp.Services.Data.InformationModel.QueryManagerService.InvokeService[T](ServiceMethod`1 serviceMethod)
at Spotfire.Dxp.Data.InformationModel.InternalInformationModelManager.DataStream.GetNextBlock()
Appreciate the help. Thanks

org.springframework.security.authentication.InternalAuthenticationServiceException: while authenticate user with oracle db

Dears,
I am trying to authenticate user with oracle db.
This is my security context spring configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select user_name username, password, 'true' enabled from USERS where user_name=?"
authorities-by-username-query="select u.user_name username, ur.authority from USERS u, USERS_ROLES ur where u.user_id = ur.user_id and u.user_name = ?"/>
<security:password-encoder ref="passwordEncoder" />
</security:authentication-provider>
</security:authentication-manager>
<security:http use-expressions="true">
<security:intercept-url pattern="/CreateOffer" access="isAuthenticated()" />
<security:intercept-url pattern="/docreate" access="isAuthenticated()" />
<security:intercept-url pattern="/static/**" access="permitAll" />
<security:intercept-url pattern="/" access="permitAll" />
<security:intercept-url pattern="/newaccount" access="permitAll" />
<security:intercept-url pattern="/createaccount" access="permitAll" />
<security:intercept-url pattern="/createaccountvalidation" access="permitAll" />
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/ShowOffer" access="permitAll" />
<security:intercept-url pattern="/**" access="denyAll" />
<security:form-login login-page="/login"
login-processing-url="/login" username-parameter="custom_username"
password-parameter="custom_password"
authentication-failure-url="/login?error=true" />
</security:http>
<jee:jndi-lookup jndi-name="jdbc/myoracle"
id="dataSource" expected-type="javax.sql.DataSource">
</jee:jndi-lookup>
<bean id="passwordEncoder"
class="org.springframework.security.crypto.password.NoOpPasswordEncoder">
</bean>
</beans>
User:
Name Null? Type
--------- ----- -------------
USER_ID NUMBER(10)
USER_NAME VARCHAR2(50)
PASSWORD VARCHAR2(100)
ENABLED CHAR(1)
EMAIL VARCHAR2(50)
Users_roles:
Name Null? Type
------------ ----- ------------
USER_ROLE_ID NUMBER
USER_ID NUMBER
AUTHORITY VARCHAR2(45)
I believe error is coming because it is not able to convert char ( enabled column) to boolean. I have checked but couldn't find any solution. Even I have hardcorded 'true' as the value for enabled but still it is not working.
Caused by: java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.CharCommonAccessor.getBoolean(CharCommonAccessor.java:185)
Complete Error message:
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.37
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 30 2020 20:09:49 UTC
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.37.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk-12.0.2
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 12.0.2+10
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 9.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Aug 23, 2020 12:09:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [C:\Program Files\Java\jdk-12.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk-12.0.2/bin/server;C:/Program Files/Java/jdk-12.0.2/bin;c:\app\Sanjay\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files\Apache Software Foundation\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;C:\Program Files\Apache Software Foundation\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;C:\Users\Sanjay\AppData\Local\Microsoft\WindowsApps;;C:\WINDOWS\system32;;.]
Aug 23, 2020 12:09:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8686"]
Aug 23, 2020 12:09:13 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [782] milliseconds
Aug 23, 2020 12:09:13 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Aug 23, 2020 12:09:13 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.37]
Aug 23, 2020 12:09:13 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [153] milliseconds.
Aug 23, 2020 12:09:15 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
WARNING: Name = myoracle Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "20" for "maxActive" property, which is being ignored.
Aug 23, 2020 12:09:15 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
WARNING: Name = myoracle Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "-1" for "maxWait" property, which is being ignored.
Aug 23, 2020 12:09:15 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 23, 2020 12:09:15 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 23, 2020 12:09:15 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring DispatcherServlet 'offer'
Aug 23, 2020 12:09:15 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: Initializing Servlet 'offer'
Aug 23, 2020 12:09:15 PM org.springframework.security.core.SpringSecurityCoreVersion performVersionChecks
INFO: You are running with Spring Security Core 5.2.6.RELEASE
Aug 23, 2020 12:09:15 PM org.springframework.security.config.SecurityNamespaceHandler <init>
INFO: Spring Security 'config' module version is 5.2.6.RELEASE
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'isAuthenticated()' for /CreateOffer
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'isAuthenticated()' for /docreate
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /static/**
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /newaccount
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /createaccount
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /createaccountvalidation
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /login
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /ShowOffer
Aug 23, 2020 12:09:16 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'denyAll' for /**
Aug 23, 2020 12:09:16 PM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder
INFO: Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, Root bean: class [org.springframework.security.web.header.HeaderWriterFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 500, Root bean: class [org.springframework.security.web.csrf.CsrfFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 700, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1900, Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.security.config.http.HttpConfigurationBuilder$SecurityContextHolderAwareRequestFilterBeanFactory#0; factoryMethodName=getBean; initMethodName=null; destroyMethodName=null, order = 2000, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2300, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2400, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2500, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2600]
Aug 23, 2020 12:09:16 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 6.1.5.Final
Aug 23, 2020 12:09:17 PM org.springframework.security.provisioning.JdbcUserDetailsManager initDao
INFO: No authentication manager set. Reauthentication of users when changing passwords will not be performed.
Aug 23, 2020 12:09:17 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: any request, [org.springframework.security.web.context.SecurityContextPersistenceFilter#299c86f0, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#4fbed6fc, org.springframework.security.web.header.HeaderWriterFilter#1b1d93e9, org.springframework.security.web.csrf.CsrfFilter#129b0ed, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#4ccf1d3e, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#75ff2b6d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#20a7ce0, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#4ee80a94, org.springframework.security.web.session.SessionManagementFilter#7afac89a, org.springframework.security.web.access.ExceptionTranslationFilter#76d220eb, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#276eafad]
Aug 23, 2020 12:09:17 PM org.springframework.security.config.http.DefaultFilterChainValidator checkLoginPageIsntProtected
INFO: Checking whether login URL '/login' is accessible with your configuration
Aug 23, 2020 12:09:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: Completed initialization in 2225 ms
Aug 23, 2020 12:09:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8686"]
Aug 23, 2020 12:09:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [4343] milliseconds
Aug 23, 2020 12:09:25 PM org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter doFilter
SEVERE: An internal error occurred while trying to authenticate the user.
org.springframework.security.authentication.InternalAuthenticationServiceException: PreparedStatementCallback; uncategorized SQLException for SQL [select user_name username, password, 'true' enabled from USERS where user_name=?]; SQL state [99999]; error code [17059]; Fail to convert to internal representation; nested exception is java.sql.SQLException: Fail to convert to internal representation
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:123)
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:144)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:175)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:195)
at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:95)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:141)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select user_name username, password, 'true' enabled from USERS where user_name=?]; SQL state [99999]; error code [17059]; Fail to convert to internal representation; nested exception is java.sql.SQLException: Fail to convert to internal representation
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:700)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:712)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:763)
at org.springframework.security.provisioning.JdbcUserDetailsManager.loadUsersByUsername(JdbcUserDetailsManager.java:150)
at org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl.loadUserByUsername(JdbcDaoImpl.java:181)
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108)
... 41 more
Caused by: java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.CharCommonAccessor.getBoolean(CharCommonAccessor.java:185)
at oracle.jdbc.driver.T4CCharAccessor.getBoolean(T4CCharAccessor.java:697)
at oracle.jdbc.driver.OracleResultSetImpl.getBoolean(OracleResultSetImpl.java:640)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getBoolean(DelegatingResultSet.java:358)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getBoolean(DelegatingResultSet.java:358)
at org.springframework.security.provisioning.JdbcUserDetailsManager.lambda$loadUsersByUsername$0(JdbcUserDetailsManager.java:155)
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:94)
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:61)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:679)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
... 48 more
Thanks in advance for your help.
I was using char as enabled datatype and char is converted to java.lang.String or oracle.sql.CHAR.
I changed it to number as number can be converted to boolean and it worked fine.
Please use the below link for complete reference:
https://docs.oracle.com/cd/E11882_01/java.112/e16548/apxref.htm#JJDBC28906

TypeError: expected string or Unicode object, long found (Flask app)

This is my views.py:
# -*- coding: utf-8 -*-
from flask import Blueprint, request, render_template, flash, g, session, redirect, url_for
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import db
from app.users.models import User
from app.news.models import News, NewsImg
from app.main.forms import LoginForm
mod = Blueprint('main', __name__, url_prefix='/')
#mod.route('/', methods=['GET', 'POST'])
def main():
form = LoginForm()
if form.validate_on_submit():
username = request.form['username']
password = request.form['password']
user = User.query.filter_by(username=username, password=password).first()
if user is None:
flash('Incorrect login or password', 'error')
return redirect("/")
login_user(user)
return redirect("/")
news = News.query.order_by(News.putdate.desc()).limit(3)
return render_template("main/main.html",
news= news,
form = form)
After authorization (Flask-Login) in logs an error:
TypeError: expected string or Unicode object, long found
On the local machine it works, the problem only on the server
[Fri Feb 06 10:58:01 2015] [error] [client 81.24.82.162] mod_wsgi
(pid=59836): Exception occurred processing WSGI script
'/home/users/s/sadwolf/domains/e-dag.com/dad.wsgi'., referer: url [Fri
Feb 06 10:58:01 2015] [error] [client 81.24.82.162] Traceback (most
recent call last):, referer: url [Fri Feb 06 10:58:01 2015] [error]
[client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1836, in call, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] return self.wsgi_app(environ,
start_response), referer: url [Fri Feb 06 10:58:01 2015] [error]
[client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1820, in wsgi_app, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] response =
self.make_response(self.handle_exception(e)), referer: url [Fri Feb 06
10:58:01 2015] [error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1403, in handle_exception, referer: url [Fri Feb 06 10:58:01
2015] [error] [client 81.24.82.162] reraise(exc_type, exc_value,
tb), referer: url [Fri Feb 06 10:58:01 2015] [error] [client
81.24.82.162] File "/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1817, in wsgi_app, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] response =
self.full_dispatch_request(), referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1477, in full_dispatch_request, referer: url [Fri Feb 06 10:58:01
2015] [error] [client 81.24.82.162] rv =
self.handle_user_exception(e), referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1381, in handle_user_exception, referer: url [Fri Feb 06 10:58:01
2015] [error] [client 81.24.82.162] reraise(exc_type, exc_value,
tb), referer: url [Fri Feb 06 10:58:01 2015] [error] [client
81.24.82.162] File "/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1475, in full_dispatch_request, referer: url [Fri Feb 06 10:58:01
2015] [error] [client 81.24.82.162] rv = self.dispatch_request(),
referer: url [Fri Feb 06 10:58:01 2015] [error] [client 81.24.82.162]
File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/flask/app.py",
line 1461, in dispatch_request, referer: url [Fri Feb 06 10:58:01
2015] [error] [client 81.24.82.162] return
self.view_functionsrule.endpoint, referer: url [Fri
Feb 06 10:58:01 2015] [error] [client 81.24.82.162] File
"/home/users/s/sadwolf/prj/dad/app/main/views.py", line 17, in main,
referer: url [Fri Feb 06 10:58:01 2015] [error] [client 81.24.82.162]
user = User.query.filter_by(username=username,
password=password).first(), referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 2367, in first, referer: url [Fri Feb 06 10:58:01 2015] [error]
[client 81.24.82.162] ret = list(self[0:1]), referer: url [Fri Feb
06 10:58:01 2015] [error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/query.py",
line 2228, in getitem, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] return list(res), referer: url [Fri
Feb 06 10:58:01 2015] [error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/loading.py",
line 73, in instances, referer: url [Fri Feb 06 10:58:01 2015] [error]
[client 81.24.82.162] rows = [process[0](row, None) for row in
fetch], referer: url [Fri Feb 06 10:58:01 2015] [error] [client
81.24.82.162] File "/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/loading.py",
line 455, in _instance, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] populate_state(state, dict_, row,
isnew, only_load_props), referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/loading.py",
line 305, in populate_state, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] populator(state, dict_, row),
referer: url [Fri Feb 06 10:58:01 2015] [error] [client 81.24.82.162]
File
"/home/users/s/sadwolf/virtualenv/dagavtodor/lib/python2.7/site-packages/sqlalchemy/orm/strategies.py",
line 169, in fetch_col, referer: url [Fri Feb 06 10:58:01 2015]
[error] [client 81.24.82.162] dict_[key] = row[col], referer: url
[Fri Feb 06 10:58:01 2015] [error] [client 81.24.82.162] TypeError:
expected string or Unicode object, long found, referer: url
Please exchange all your models':
def __repr__(self):
return self.xxx
or
def __str__(self):
return self.xxx
to unicode methods like:
def __unicode__(self):
return unicode(self.xxx)
Because you may shows a long type or null/None type for your model, the __repr__ and __str__ does not support these type.
__unicode__() take effect.
update: data in your locale may not be the same type with your server' data.So this error does not appear on your local machine.

Symfony/Doctrine/SfGuardPlugin: Redirect to requested page (route), and not referrer

I want to be able to take the user to the requested page after login, but this does not happen with sfGuard.
** My Register action requires SignIn ;) **
On the listing page [http://cim/frontend_dev.php/]
-> user clicks the 'Register' link [#register = register/index]
-> user is taken to 'Signin' page provided by sfGuard
-> after sign-in, user is taken back to the Listing page (instead of Register)
This is quite annoying! But logical, because the referrer is the listing page.
How can I change logic to make #register the referrer? Pl help. thanks
public function executeSignin($request)
{
$user = $this->getUser();
$this->logMessage('Signin>>> form - isAuth() '.$user->isAuthenticated(), 'info');
if ($user->isAuthenticated())
{
$this->getUser()->setAttribute('tenant', $this->getUser()->getGuardUser()->sfuser->Tenant->getID());
return $this->redirect($user->getReferer($request->getReferer()));
}
$class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
$this->form = new $class();
$referer = $user->getReferer($request->getReferer());
$this->logMessage('Signin>>> referer: '.$referer, 'info');
$this->logMessage('Signin>>> referer: '.$request->getReferer(), 'info');
if ($request->isMethod('post'))
{
$this->form->bind($request->getParameter('signin'));
if ($this->form->isValid())
{
$values = $this->form->getValues();
$this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
$this->getUser()->setAttribute('tenant', $this->getUser()->getGuardUser()->sfuser->Tenant->getID());
$this->logMessage('Signin>>> sfUrl | #homepage: '.sfConfig::get('app_sf_guard_plugin_success_signin_url','#homepage'), 'info');
return $this->redirect("" != $referer ? $referer : sfConfig::get('app_sf_guard_plugin_success_signin_url','#homepage'));
}
}
else
{
if ($request->isXmlHttpRequest())
{
$this->getResponse()->setHeaderOnly(true);
$this->getResponse()->setStatusCode(401);
return sfView::NONE;
}
// if we have been forwarded, then the referer is the current URL
// if not, this is the referer of the current request
$user->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer());
$this->logMessage('Signin>>> oldy: '.$request->getUri(), 'info');
$this->logMessage('Signin>>> oldy: '.$request->getReferer(), 'info');
$module = sfConfig::get('sf_login_module');
if ($this->getModuleName() != $module)
{
return $this->redirect($module.'/'.sfConfig::get('sf_login_action'));
}
$this->getResponse()->setStatusCode(401);
}
}
Trace:
May 27 10:10:14 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/login)
May 27 10:10:14 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/logout)
May 27 10:10:14 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_password" (/request_password)
May 27 10:10:14 symfony [info] {sfPatternRouting} Match route "register" (/register) for /register with parameters array ( 'module' => 'register', 'action' => 'index',)
May 27 10:10:14 symfony [info] {sfFilterChain} Executing filter "sfGuardRememberMeFilter"
May 27 10:10:14 symfony [info] {sfFilterChain} Executing filter "sfRenderingFilter"
May 27 10:10:14 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
May 27 10:10:14 symfony [info] {registerActions} Call "registerActions->executeIndex()"
May 27 10:10:14 symfony [info] {sfFrontWebController} Redirect to "http://cim/frontend_dev.php/login"
May 27 10:10:14 symfony [info] {sfWebResponse} Send status "HTTP/1.1 302 Found"
May 27 10:10:14 symfony [info] {sfWebResponse} Send header "Location: http://cim/frontend_dev.php/login"
May 27 10:10:14 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
May 27 10:10:14 symfony [info] {sfWebDebugLogger} Configuration 13.39 ms (9)
May 27 10:10:14 symfony [info] {sfWebDebugLogger} Factories 50.02 ms (1)
May 27 10:10:14 symfony [info] {sfWebDebugLogger} Action "register/index" 1.94 ms (1)
May 27 10:10:14 symfony [info] {sfWebResponse} Send content (104 o)
May 27 10:10:16 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/login)
May 27 10:10:16 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/logout)
May 27 10:10:16 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_password" (/request_password)
May 27 10:10:16 symfony [info] {sfPatternRouting} Match route "sf_guard_signin" (/login) for /login with parameters array ( 'module' => 'sfGuardAuth', 'action' => 'signin',)
May 27 10:10:16 symfony [info] {sfFilterChain} Executing filter "sfGuardRememberMeFilter"
May 27 10:10:16 symfony [info] {sfFilterChain} Executing filter "sfRenderingFilter"
May 27 10:10:16 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Call "sfGuardAuthActions->executeSignin()"
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Signin>>> form - isAuth()
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Signin>>> referer: http://cim/frontend_dev.php/
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Signin>>> referer: http://cim/frontend_dev.php/
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Signin>>> oldy: http://cim/frontend_dev.php/login
May 27 10:10:16 symfony [info] {sfGuardAuthActions} Signin>>> oldy: http://cim/frontend_dev.php/
May 27 10:10:16 symfony [info] {sfPHPView} Render "D:/projects/cim/plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/templates/signinSuccess.php"
May 27 10:10:16 symfony [info] {sfPHPView} Decorate content with "D:\projects\cim\apps\frontend\templates/layout.php"
May 27 10:10:16 symfony [info] {sfPHPView} Render "D:\projects\cim\apps\frontend\templates/layout.php"
May 27 10:10:16 symfony [info] {main} Get slot "title"
May 27 10:10:16 symfony [info] {sfWebResponse} Send status "HTTP/1.1 401 Unauthorized"
May 27 10:10:16 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
May 27 10:10:16 symfony [info] {sfWebDebugLogger} Configuration 16.06 ms (10)
May 27 10:10:16 symfony [info] {sfWebDebugLogger} Factories 50.00 ms (1)
May 27 10:10:16 symfony [info] {sfWebDebugLogger} Action "sfGuardAuth/signin" 14.53 ms (1)
May 27 10:10:16 symfony [info] {sfWebDebugLogger} View "Success" for "sfGuardAuth/signin" 34.44 ms (1)
May 27 10:10:16 symfony [info] {sfWebResponse} Send content (38057 o)
I think the best way to get the referrer is $request->getReferer()
So far, it has worked well for me!