Delete a particular item from a container in cosmos db java - java

I have tried:
PartitionKey partitionKey = new PartitionKey("/sid");
CosmosItemRequestOptions options = new CosmosItemRequestOptions();
cosmosContainer.deleteItem("dbs/Student/colls/Stu/docs/104", partitionKey, options);
But getting error:
Aug 24, 2020 4:47:15 PM com.azure.cosmos.implementation.ClientRetryPolicy shouldRetry
SEVERE: locationEndpoint is null because ClientRetryPolicy::onBeforeRequest(.) is not invoked, probably request creation failed due to invalid options, serialization setting, etc.
Aug 24, 2020 4:47:15 PM com.azure.cosmos.implementation.RenameCollectionAwareClientRetryPolicy lambda$shouldRetry$2
SEVERE: onBeforeSendRequest is not invoked, encountered failure due to request being null
java.lang.IllegalArgumentException: Entity with the specified id does not exist in the system.
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:190)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:218)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:243)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:292)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.create(RxDocumentServiceRequest.java:510)
at com.azure.cosmos.implementation.RxDocumentClientImpl.deleteDocumentInternal(RxDocumentClientImpl.java:1431)
at com.azure.cosmos.implementation.RxDocumentClientImpl.lambda$deleteDocument$33(RxDocumentClientImpl.java:1418)
at com.azure.cosmos.implementation.RxDocumentClientImpl$$Lambda$525.0000000012AE2210.call(Unknown Source)
at com.azure.cosmos.implementation.ObservableHelper.lambda$inlineIfPossibleAsObs$1(ObservableHelper.java:44)
at com.azure.cosmos.implementation.ObservableHelper$$Lambda$198.00000000127DD800.call(Unknown Source)
at com.azure.cosmos.implementation.BackoffRetryUtility.lambda$executeRetry$0(BackoffRetryUtility.java:35)
at com.azure.cosmos.implementation.BackoffRetryUtility$$Lambda$80.00000000112EA850.get(Unknown Source)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:79)
at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2344)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:162)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:103)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90)
at reactor.core.publisher.MonoCurrentContext.subscribe(MonoCurrentContext.java:35)
at reactor.core.publisher.Mono.subscribe(Mono.java:4213)
at reactor.core.publisher.Mono.block(Mono.java:1679)
at com.azure.cosmos.CosmosContainer.blockDeleteItemResponse(CosmosContainer.java:236)
at com.azure.cosmos.CosmosContainer.deleteItem(CosmosContainer.java:344)
at com.cosmos.poc.POC.deleteItem(POC.java:160)
at com.cosmos.poc.POC.printListContainers(POC.java:72)
at com.cosmos.poc.POC.printListDataBases(POC.java:54)
at com.cosmos.poc.POC.main(POC.java:30)
Exception in thread "main" java.lang.IllegalArgumentException: Entity with the specified id does not exist in the system.
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:190)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:218)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:243)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.<init>(RxDocumentServiceRequest.java:292)
at com.azure.cosmos.implementation.RxDocumentServiceRequest.create(RxDocumentServiceRequest.java:510)
at com.azure.cosmos.implementation.RxDocumentClientImpl.deleteDocumentInternal(RxDocumentClientImpl.java:1431)
at com.azure.cosmos.implementation.RxDocumentClientImpl.lambda$deleteDocument$33(RxDocumentClientImpl.java:1418)
at com.azure.cosmos.implementation.RxDocumentClientImpl$$Lambda$525.0000000012AE2210.call(Unknown Source)
at com.azure.cosmos.implementation.ObservableHelper.lambda$inlineIfPossibleAsObs$1(ObservableHelper.java:44)
at com.azure.cosmos.implementation.ObservableHelper$$Lambda$198.00000000127DD800.call(Unknown Source)
at com.azure.cosmos.implementation.BackoffRetryUtility.lambda$executeRetry$0(BackoffRetryUtility.java:35)
at com.azure.cosmos.implementation.BackoffRetryUtility$$Lambda$80.00000000112EA850.get(Unknown Source)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:79)
at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2344)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:162)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:103)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90)
at reactor.core.publisher.MonoCurrentContext.subscribe(MonoCurrentContext.java:35)
at reactor.core.publisher.Mono.subscribe(Mono.java:4213)
at reactor.core.publisher.Mono.block(Mono.java:1679)
at com.azure.cosmos.CosmosContainer.blockDeleteItemResponse(CosmosContainer.java:236)
at com.azure.cosmos.CosmosContainer.deleteItem(CosmosContainer.java:344)
at com.cosmos.poc.POC.deleteItem(POC.java:160)
at com.cosmos.poc.POC.printListContainers(POC.java:72)
at com.cosmos.poc.POC.printListDataBases(POC.java:54)
at com.cosmos.poc.POC.main(POC.java:30)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
at reactor.core.publisher.Mono.block(Mono.java:1680)
... 6 more
Aug 24, 2020 4:52:11 PM com.azure.cosmos.implementation.RxDocumentClientImpl$1 getDatabaseAccountFromEndpoint

The parameters passed to deleteItem method are not correct in your code snippet.
Parameters:
1st param itemId: It should be the document ID. You passed the whole hierarchical path.
2nd param partitionKey: It should contain the value of the partition key. You passed the field name I guess.
For example, you can refer this example for correct usage.

cosmosContainer.deleteItem("", new PartitionKey(), options);
your could remove the options argument since you are not configuring it.
cosmosContainer.deleteItem("", new PartitionKey());

Related

Camel Route read Mail by call url IMAP Server, but will throw RuntimeCamelException if Content-Transfer-Encoding:quoted-printable

everyone.
I have an application using camel route to call url IMAP to read mail and retrieve content, from("{{route1.imap.protocol}}://{{route1.imap.host}}?username={{route1.imap.username}}&password={{route1.imap.password}}&consumer.delay={{route1.consumer.delay}}&fetchSize={{route1.fetchSize}}{{route1.otherOptions}}")"
, most of the emails are read successfully by the application. But recently, we have encountered the client sends email with Content-Transfer-Encoding:quoted-printable, then the application will throw RuntimeCamelException
org.apache.camel.RuntimeCamelException: Failed to extract body due to: Unknown encoding: quoted-printable . Exchange: Exchange[]. Message: com.sun.mail.imap.IMAPMessage#7970ebf3
at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:278) ~[camel-mail-2.18.1.jar:2.18.1]
at org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:105) ~[camel-mail-2.18.1.jar:2.18.1]
at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47) ~[camel-core-2.18.1.jar:2.18.1]
at org.apache.camel.component.mail.MailConsumer.createExchanges(MailConsumer.java:354) ~[camel-mail-2.18.1.jar:2.18.1]
at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:128) ~[camel-mail-2.18.1.jar:2.18.1]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) [camel-core-2.18.1.jar:2.18.1]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) [camel-core-2.18.1.jar:2.18.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_281]
at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_281]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [na:1.8.0_281]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_281]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_281]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_281]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_281]
Caused by: java.io.IOException: Unknown encoding: quoted-printable
at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:115) ~[javax.mail-1.5.5.jar:1.5.5]
at com.sun.mail.handlers.text_plain.getContent(text_plain.java:80) ~[javax.mail-1.5.5.jar:1.5.5]
at javax.activation.DataSourceDataContentHandler.getContent(Unknown Source) ~[na:1.8.0_281]
at javax.activation.DataHandler.getContent(Unknown Source) ~[na:1.8.0_281]
at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1454) ~[javax.mail-1.5.5.jar:1.5.5]
at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:250) ~[camel-mail-2.18.1.jar:2.18.1]
... 13 common frames omitted
Caused by: javax.mail.MessagingException: Unknown encoding: quoted-printable
at javax.mail.internet.MimeUtility.decode(MimeUtility.java:389) ~[javax.mail-1.5.5.jar:1.5.5]
at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:108) ~[javax.mail-1.5.5.jar:1.5.5]
I try to find the solution, which i have found maybe to set System property mail.mime.ignoreunknownencoding to "true", but i couldn't understand where to set mail.mime.ignoreunknownencoding. If anyone knows where to set? In Outlook, IMAP Server or my application properties?
And The application using dependency camel-mail:2.18.1, the dependency class MailBinding.class in the method extractBodyFromMail throw this exception. Or should I rewrite the MailBinding Class to override method extractBodyFromMail.
if anyone could help me, thank you very much.
Add some details the infos email
Date: Mon, 23 May 2022 12:50:19 +0000
From: <xxx#xxxx>
To: <xxx#xxxxx>, <xx#xxx>, <xx#xxx>
Subject: 1964790 - SCR_CNX_ADEP_STANDARD
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Content-Type: text/plain
Message-ID: <991336a1-5f3d-449a-91af-c9a54cfb2e0f#xx.xx.local>
Return-Path: xx#xxx
X-Originating-IP: [10.1.128.112]
X-ClientProxiedBy: polar.airdolomiti.local (10.1.128.215) To
polar.airdolomiti.local (10.1.128.215)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xxxxxx.it; h=date:from:to:subject:content-transfer-encoding:mime-version:content-type:message-id; s=default; bh=2KBKjicvV/qIKyzYQAsZqkpDEKd3+uRQ8VlcakqOVx0=; b=E9wS98Kd+RrFNdRSOdPNwWT4Ga7P0/64LrM8plbjw1Fx7vtI1330ebvhVBjMNOuWlj8ctv+UmUs+GBnrEP/VNdLRv4vX+uPhq7JwWs9A6mlS0hWcOL4S711WLHrHdW8C4wXyQN4VmYfDRHx7jnhPwJBcY5RdWgjHf9sgOAfcdI4=
X-MS-Exchange-Organization-ExpirationStartTime: 23 May 2022 12:50:20.4282
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id:
e760ac37-bb92-4d82-685f-08da3cbacba1
X-EOPAttributedMessage: 0
X-EOPTenantAttributedMessage: d3fc41ce-14c2-4518-9065-8fe78ff84136:0
X-MS-Exchange-Organization-MessageDirectionality: Incoming
X-MS-PublicTrafficType: Email
X-MS-Exchange-Organization-AuthSource:
PR2FRA01FT010.eop-fra01.prod.protection.outlook.com
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Office365-Filtering-Correlation-Id: e760ac37-bb92-4d82-685f-08da3cbacba1
X-MS-TrafficTypeDiagnostic: PR0P264MB2439:EE_
X-MS-Exchange-Organization-SCL: -1
X-Microsoft-Antispam: BCL:0;
X-Forefront-Antispam-Report:
CIP:151.11.112.123;CTRY:IT;LANG:en;SCL:-1;SRV:;IPV:NLI;SFV:SFE;H:mail.airdolomiti.it;PTR:mail.airdolomiti.it;CAT:NONE;SFS:;DIR:INB;
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2022 12:50:20.2876
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: e760ac37-bb92-4d82-685f-08da3cbacba1
X-MS-Exchange-CrossTenant-Id: d3fc41ce-14c2-4518-9065-8fe78ff84136
X-MS-Exchange-CrossTenant-AuthSource:
PR2FRA01FT010.eop-fra01.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB2439
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.9451105
X-MS-Exchange-Processed-By-BccFoldering: 15.20.5273.022
X-Microsoft-Antispam-Mailbox-Delivery:
finally. I found the solution to modifier the properties before application run.it works.
System.getProperties().setProperty("mail.mime.ignoreunknownencoding","true");
SpringApplication.run(xxx.class, args);

sql sytax error in my java code [duplicate]

This question already has answers here:
Syntax error due to using a reserved word as a table or column name in MySQL
(1 answer)
How to map an entity field whose name is a reserved word in JPA
(8 answers)
Closed 5 years ago.
2017-12-26 18:35:02 [http-nio-8080-exec-10] WARN SqlExceptionHelper:129 - SQL Error: 1064, SQLState: 42000
2017-12-26 18:35:02 [http-nio-8080-exec-10] ERROR SqlExceptionHelper:131 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEAVE leave0_ where leave0_.ORGLOCATION_ID=3 and leave0_.USER_ID=3' at line 1
Dec 26, 2017 6:35:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEAVE leave0_ where leave0_.ORGLOCATION_ID=3 and leave0_.USER_ID=3' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)

Can't retrieve data back from UMLS

I have been trying to run the ctakes-temporal-demo on github.
Currently I have configured everything in eclipse correctly. I have set the correct password and id for UMLS account. When I try to run it I get the following error:
Exception in thread "main" java.lang.Exception: org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator" failed. (Descriptor: <unknown>)
at com.optum.cda.Main.main(Main.java:103)
Caused by: org.apache.uima.resource.ResourceInitializationException: Initialization of annotator class "org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator" failed. (Descriptor: <unknown>)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:252)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:156)
at org.apache.uima.impl.AnalysisEngineFactory_impl.produceResource(AnalysisEngineFactory_impl.java:94)
at org.apache.uima.impl.CompositeResourceFactory_impl.produceResource(CompositeResourceFactory_impl.java:62)
at org.apache.uima.UIMAFramework.produceResource(UIMAFramework.java:269)
at org.apache.uima.UIMAFramework.produceAnalysisEngine(UIMAFramework.java:387)
at org.apache.uima.analysis_engine.asb.impl.ASB_impl.setup(ASB_impl.java:254)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initASB(AggregateAnalysisEngine_impl.java:431)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initializeAggregateAnalysisEngine(AggregateAnalysisEngine_impl.java:375)
at org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl.initialize(AggregateAnalysisEngine_impl.java:185)
at org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine(AnalysisEngineFactory.java:711)
at org.apache.uima.fit.factory.AggregateBuilder.createAggregate(AggregateBuilder.java:207)
at com.optum.cda.Main.main(Main.java:101)
Caused by: org.apache.uima.resource.ResourceInitializationException: EXCEPTION MESSAGE LOCALIZATION FAILED: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key Could not construct org.apache.ctakes.dictionary.lookup2.dictionary.UmlsJdbcRareWordDictionary
at org.apache.ctakes.dictionary.lookup2.ae.AbstractJCasTermAnnotator.initialize(AbstractJCasTermAnnotator.java:131)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:250)
... 12 more
Caused by: org.apache.uima.analysis_engine.annotator.AnnotatorContextException: EXCEPTION MESSAGE LOCALIZATION FAILED: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key Could not construct org.apache.ctakes.dictionary.lookup2.dictionary.UmlsJdbcRareWordDictionary
at org.apache.ctakes.dictionary.lookup2.dictionary.DictionaryDescriptorParser.parseDictionary(DictionaryDescriptorParser.java:199)
at org.apache.ctakes.dictionary.lookup2.dictionary.DictionaryDescriptorParser.parseDictionaries(DictionaryDescriptorParser.java:156)
at org.apache.ctakes.dictionary.lookup2.dictionary.DictionaryDescriptorParser.parseDescriptor(DictionaryDescriptorParser.java:128)
at org.apache.ctakes.dictionary.lookup2.ae.AbstractJCasTermAnnotator.initialize(AbstractJCasTermAnnotator.java:129)
... 13 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.ctakes.dictionary.lookup2.dictionary.DictionaryDescriptorParser.parseDictionary(DictionaryDescriptorParser.java:196)
... 16 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -7
at java.lang.String.substring(Unknown Source)
at org.apache.ctakes.dictionary.lookup2.util.JdbcConnectionFactory.getConnectionUrl(JdbcConnectionFactory.java:110)
at org.apache.ctakes.dictionary.lookup2.util.JdbcConnectionFactory.getConnection(JdbcConnectionFactory.java:63)
at org.apache.ctakes.dictionary.lookup2.dictionary.JdbcRareWordDictionary.<init>(JdbcRareWordDictionary.java:91)
at org.apache.ctakes.dictionary.lookup2.dictionary.JdbcRareWordDictionary.<init>(JdbcRareWordDictionary.java:72)
at org.apache.ctakes.dictionary.lookup2.dictionary.UmlsJdbcRareWordDictionary.<init>(UmlsJdbcRareWordDictionary.java:31)
... 21 more
Can someone familiar with ctakes help me find out the error. I have tried the mailing list, but no replies.
Finally found a solution ! It seems like the path to the XML descriptor of the dictionary-fast is not reachable. Thus after validating an UMLS user the database setup could not be proceeded.
One of the solution I used was to use a static address for the database (which I will have to change always if the project is moved.). This is not very elegant but works.
Love to hear if anyone has another solution.
Have you put the data of ctakesnorx.script into the database?
Also we do need to update the following attribute values :
<property key="jdbcUrl" value="jdbc:hsqldb:file:org/apache/ctakes/dictionary/lookup/fast/ctakessnorx/ctakessnorx"/>
<property key="jdbcUser" value="sa"/>
<property key="jdbcPass" value=""/>
<property key="rareWordTable" value="cui_terms"/>

Expected content type of 'application/javascript' in HtmlUnitDriver

i'm trying to execute javascript but couldn't find any way to do so ..
i have to mention that i've tried my code with FirefoxDriver and it's work great and do exactly what i want but the problem with FirefoxDriver is that the browser actually work and visible to user which i don't want . that's why i've switch to HtmlUnitdriver
--here's my code--
HtmlUnitDriver driver = new HtmlUnitDriver(true);
driver.get("https://blahblah.edu/home.faces");
WebElement select = driver.findElement(By.name("loginForm:userType"));
Select tbs = new Select(select);
tbs.selectByValue("1");
driver.findElement(By.name("loginForm:username")).sendKeys("username");
driver.findElement(By.name("loginForm:password")).sendKeys("password");
driver.executeScript("javascript:userTypeSelect();");//throws exception
driver.executeScript("if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('menuForm'),{'menuForm:serLinkDropAdd2':'menuForm:serLinkDropAdd2'},'');}return false");
WebDriverWait driverWait = new WebDriverWait(driver, 10000);
driverWait.until(ExpectedConditions.presenceOfElementLocated(By.id("saveBut1")));
driver.findElement(By.id("saveBut1")).click();
System.out.println(driver.getTitle());
--here's the Error--
Aug 30, 2013 2:44:04 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://edugate.blahblah.edu/ksu/include/js/calendar/deleteTooltip.js', but got 'text/plain'.
Aug 30, 2013 2:44:05 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://edugate.blahblah.edu/ksu/include/js/calendar/deleteNote.js', but got 'text/plain'.
Aug 30, 2013 2:44:05 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://edugate.blahblah.edu/ksu/include/js/menu/styleswitcher.js', but got 'text/plain'.
Aug 30, 2013 2:44:07 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://edugate.blahblah.edu/ksu/include/css/style_ar.css' [8:9] Error in pseudo class or element. (Invalid token ":". Was expecting one of: <IDENT>, <FUNCTION_NOT>, <FUNCTION_LANG>, <FUNCTION>.)
Aug 30, 2013 2:44:07 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warning
WARNING: CSS warning: 'https://edugate.blahblah.edu/ksu/include/css/style_ar.css' [8:9] Ignoring the whole rule.
Aug 30, 2013 2:44:08 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler error
WARNING: CSS error: 'https://edugate.blahblah.edu/ksu/skins/1/style_ar.css' [8:9] Error in pseudo class or element. (Invalid token ":". Was expecting one of: <IDENT>, <FUNCTION_NOT>, <FUNCTION_LANG>, <FUNCTION>.)
Aug 30, 2013 2:44:08 AM com.gargoylesoftware.htmlunit.DefaultCssErrorHandler warning
WARNING: CSS warning: 'https://edugate.blahblah.edu/ksu/skins/1/style_ar.css' [8:9] Ignoring the whole rule.
Aug 30, 2013 2:44:11 AM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'https://edugate.blahblah.edu:443/ksu/include/js/table/table.js', but got 'text/plain'.
Exception in thread "main" org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property [Window].length that has only a getter to 15. (https://edugate.blahblah.edu:443/ksu/include/js/table/table.js#2)
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_21'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.executeScript(HtmlUnitDriver.java:497)
at edugate.ADD2.<init>(ADD2.java:32)
at edugate.Edugate.main(Edugate.java:31)
Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property [Window].length that has only a getter to 15. (https://edugate.blahblah.edu:443/ksu/include/js/table/table.js#2)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:601)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:576)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:1005)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.executeScript(HtmlUnitDriver.java:491)
... 2 more
Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property [Window].length that has only a getter to 15. (https://edugate.blahblah.edu:443/ksu/include/js/table/table.js#2)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:555)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1082)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:399)
at com.gargoylesoftware.htmlunit.html.HtmlScript$3.execute(HtmlScript.java:260)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:276)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:676)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:635)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1169)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1071)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:330)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3074)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2041)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:918)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:892)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:241)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:187)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:434)
at com.gargoylesoftware.htmlunit.WebClient.loadDownloadedResponses(WebClient.java:2289)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.doProcessPostponedActions(JavaScriptEngine.java:697)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.access$500(JavaScriptEngine.java:91)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:664)
... 8 more
Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot set property [Window].length that has only a getter to 15. (https://edugate.blahblah.edu:443/ksu/include/js/table/table.js#2)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3603)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3587)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3608)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3630)
at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.isReadOnlySettable(SimpleScriptable.java:461)
at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject$GetterSlot.setValue(ScriptableObject.java:259)
at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.putImpl(ScriptableObject.java:2796)
at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.put(ScriptableObject.java:521)
at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.putProperty(ScriptableObject.java:2479)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setName(ScriptRuntime.java:1846)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1207)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:275)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3031)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:546)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:654)
... 38 more
Java Result: 1
i appreciate your help , thanks in advance
webClient java script disable will help, add a code line
webClient.setJavaScriptEnabled(false);
before your get request.
MSR

Datanucleus JDO with SQLite

For JUnit tests in our application, I'm attempting to initialize Datanucleus to use an SQLite database. However, when I try to get a PersistenceManager it fails while trying to create a DELETEME******** table (I'm not fully aware WHY it needs this table yet, either).
It appears to be failing during truncate() because of some identifier length issue. I have attempted to tweak all sorts of various datanucleus configuration properties to no avail.
Can anyone explain to me why Datanucleus feels the need to create these DELETEME**** tables, and what might potentially cause this truncation failure with a SQLite (org.sqlite.JDBC) database and not with MySQL?
Log:
Apr 12, 2011 1:30:16 PM org.datanucleus.store.rdbms.table.AbstractTable create
INFO: Creating table DELETEME1302640216142
Apr 12, 2011 1:32:10 PM org.datanucleus.store.rdbms.RDBMSStoreManager <init>
SEVERE: Failed initialising database. Please check that your database JDBC driver is accessible, and the database URL and username/password are correct. Exception : The length argument (=-3) is less than HASH_LENGTH(=4)!
java.lang.IllegalArgumentException: The length argument (=-3) is less than HASH_LENGTH(=4)!
Full stack trace:
java.lang.IllegalArgumentException: The length argument (=-3) is less than HASH_LENGTH(=4)!
at org.datanucleus.store.mapped.identifier.AbstractIdentifierFactory.truncate(AbstractIdentifierFactory.java:314)
at org.datanucleus.store.mapped.identifier.AbstractIdentifierFactory.newPrimaryKeyIdentifier(AbstractIdentifierFactory.java:661)
at org.datanucleus.store.rdbms.key.PrimaryKey.<init>(PrimaryKey.java:37)
at org.datanucleus.store.rdbms.table.TableImpl.getPrimaryKey(TableImpl.java:128)
at org.datanucleus.store.rdbms.table.TableImpl.getSQLCreateStatements(TableImpl.java:1264)
at org.datanucleus.store.rdbms.table.AbstractTable.create(AbstractTable.java:419)
at org.datanucleus.store.rdbms.RDBMSStoreManager.initialiseSchema(RDBMSStoreManager.java:676)
at org.datanucleus.store.rdbms.RDBMSStoreManager.<init>(RDBMSStoreManager.java:350)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:597)
at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:300)
at org.datanucleus.ObjectManagerFactoryImpl.initialiseStoreManager(ObjectManagerFactoryImpl.java:227)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:591)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:293)
at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)

Categories

Resources