Getting Exceptions from logs on *nix using sed/awk/whatever - java

I want to get exceptions from log files created by tomcat.
Yes, I did some research, but because I don't have any experience with sed or awk - adjusting what I've found to what I need is kinda difficult.
A sample file is shown below to have something to work on:
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 39 more
2014-10-24 11:40:01,558 ERROR [aaa.bbb.ccc.ddd.SomeClass] - some exception on parsing '2007/11/45' bla bla
javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 32 more
2014-10-24 11:40:01,561 ERROR [aaa.bbb.ccc.ddd] - some error with id = 1214
java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
2014-10-24 11:44:48,253 INFO [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean] - Closing Hibernate SessionFactory
2014-10-24 11:44:48,253 INFO [org.hibernate.impl.SessionFactoryImpl] - closing
2014-10-24 11:44:48 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
2014-10-24 11:44:50 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8096
As we can see there are: 2 FULL EXCEPTIONS (we want them), 1 PARTIAL EXCEPTION(we dont want it). To make this example short I deleted some important stuff, like log4j:ERRORs, which we dont want.
so far I tried:
AWK (its my 1st day with AWK, please dont laugh :D). its pretty straight forward.
it finds "/t" (tab) + at + " " (empty space) in the beginning of every line. if 2 lines before it match given conditions (Exception and date) it prints them too. it works pretty well, but it also prints partial exception, which we DO NOT want.
BEGIN {
preprevious = "";
previous = "";
}
/^\tat / {
if( previous != "" ) {
if(preprevious ~ /20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]/){
print preprevious;
preprevious = "";
}
if(previous ~ /.*Exception/) {
print previous;
previous = "";
}
}
print;
next;
}
{ preprevious = previous;
previous = $0; }
which i run like this:
awk -f awkScript testFileExceptions.txt
and SED in a bash script (I prefer that)
#!/bin/sh
if [ "$#" -eq "2" ]
then
tail -n $2 $1 | sed -n "/ ERROR \[/,/20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]/p"
else
echo "usage: scriptName filePath amountOfLastLinesInFile"
fi
it matches '" "+ERROR+" "' (with empty spaces on both sides of ERROR, so log4j:ERROR will not be matched) to date. it kind of works...
disadvantages:
1)it will work IF there are some additional lines between exceptions - like this:
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 32 more
2014-10-24 11:40:01,561 INFO [aaa.bbb.ccc.ddd] - AAAAAAAAAAAAAAAAAAAAAAAA
2014-10-24 11:40:01,561 ERROR [aaa.bbb.ccc.ddd] - some error with id = 1214
java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
if not - then the 2nd exception will not be shown
2)it will also print out the last matched line (which is the one with the date match)
so to sum up, what I want on outcome is:
2014-10-24 11:40:01,558 ERROR [aaa.bbb.ccc.ddd.SomeClass] - some exception on parsing '2007/11/45' bla bla javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 32 more
2014-10-24 11:40:01,561 ERROR [aaa.bbb.ccc.ddd] - some error with id = 1214 java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
I also want to save different exceptions to different files (lets say exceptionOutputNNN.txt, for example exceptionOutput001.txt), but I'll figure it out later, shouldn't be that hard after I figured out how to do that for XMLs... :P
well.. that's it. I hope someone can help me:)
cheers
edit: please note, that Exceptions can end with "... NN more" and with simple "\tat org.*"

Still not sure exactly what you want
This should work for what output you want though
awk '/^[0-9]+/{x=0}/ERROR/{x=1}x' file
output
2014-10-24 11:40:01,558 ERROR [aaa.bbb.ccc.ddd.SomeClass] - some exception on parsing '2007/11/45' bla bla
javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '503: Service Temporarily Unavailable' when communicating with http://66.66.66.66:1234/aaa/bbb/ccc
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1546)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 32 more
2014-10-24 11:40:01,561 ERROR [aaa.bbb.ccc.ddd] - some error with id = 1214
java.lang.NullPointerException
at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Edit: For your original file
awk 'a=/^[0-9]+/{x=0}a&&/ERROR/{x=1}x' file
or
awk '(/^[0-9]/&&x=/ERROR/)||x' file

for any people viewing this post in the future, below is the script which uses Jidders solution and saves output to files (1 file perexception)
#!/bin/sh
if [ "$#" -eq "2" ]
then
rm output/errorOutputFile* 2>/dev/null
tail -n $2 $1 | awk '(/^[0-9]/&&x=/ERROR/)||x' | awk '/^[0-9]/{g++} { print $0 > "errorOutputFile"g".txt"}'
else
echo "usage: scriptName filePath amountOfLastLinesInFile"
fi
cheers

Related

Apigee edge-message-processor Error while starting up

We are trying to deploy APIGEE in a 5 node model and all other components seems correct except edge-message-processor-4.50.00-0.0
The configs are standard and stored in /opt/apigee/edge-message-processor/conf
The error shows as below
2023-02-03 07:19:04,028 main ERROR KERNEL.DEPLOYMENT - ServiceDeployer.startService() : ServiceDeployer.deploy() : Got a life cycle exception while starting service [MessageProcessorService, For input string: "/etc"] : {}
java.lang.NumberFormatException: For input string: "/etc"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at org.eclipse.jetty.util.security.Password.deobfuscate(Password.java:191)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.getSslKeyPassword(MessageProcessorServiceImpl.java:618)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.registerHttpServer(MessageProcessorServiceImpl.java:510)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.start(MessageProcessorServiceImpl.java:271)
at com.apigee.kernel.service.deployment.ServiceDeployer.startService(ServiceDeployer.java:210)
at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
at com.apigee.kernel.MicroKernel.deployAll(MicroKernel.java:244)
at com.apigee.kernel.MicroKernel.start(MicroKernel.java:157)
at com.apigee.kernel.MicroKernel.start(MicroKernel.java:152)
at com.apigee.kernel.MicroKernel.main(MicroKernel.java:101)
2023-02-03 07:19:04,032 main ERROR KERNEL - MicroKernel.deployAll() : MicroKernel.deployAll() : Error in deploying the deployment : MessageProcessorService
com.apigee.kernel.exceptions.spi.UncheckedException: Starting of Service MessageProcessorService failed unexpectedly
at com.apigee.kernel.service.deployment.ServiceDeployer.getUncheckedException(ServiceDeployer.java:236)
at com.apigee.kernel.service.deployment.ServiceDeployer.startService(ServiceDeployer.java:219)
at com.apigee.kernel.service.deployment.ServiceDeployer.deploy(ServiceDeployer.java:77)
at com.apigee.kernel.MicroKernel.deployAll(MicroKernel.java:244)
at com.apigee.kernel.MicroKernel.start(MicroKernel.java:157)
at com.apigee.kernel.MicroKernel.start(MicroKernel.java:152)
at com.apigee.kernel.MicroKernel.main(MicroKernel.java:101)
Caused by: java.lang.NumberFormatException: For input string: "/etc"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at org.eclipse.jetty.util.security.Password.deobfuscate(Password.java:191)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.getSslKeyPassword(MessageProcessorServiceImpl.java:618)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.registerHttpServer(MessageProcessorServiceImpl.java:510)
at com.apigee.messaging.configuration.MessageProcessorServiceImpl.start(MessageProcessorServiceImpl.java:271)
at com.apigee.kernel.service.deployment.ServiceDeployer.startService(ServiceDeployer.java:210)
... 5 common frames omitted
2023-02-03 07:19:04,033 Thread-1 INFO KERNEL - ShutdownHook.run() : ShutdownHook.run : System shutdown in progress...
Other info
>> echo $PATH
/usr/lib/jvm/jre/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/apigee/apigee-adminapi-4.50.00-0.0.604/bin:/opt/apigee/apigee-service/bin:/root/bin
>> cat /opt/apigee/etc/defaults.sh
JAVA_HOME=/usr/lib/jvm/jre
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
MIN_PASSWORD_LENGTH=8
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=ip-10-164-156-123.eu-west-1.compute.internal"
Anyone have seen similar errors?
The above error shows the password is passed as a ""/etc" instead of a numerical value, the system is unable to parse it as an integer.
For the Message Processor service, SSL key password configuration is failing it is used as an integer. check the SSL key password configuration in the /opt/apigee/edge-message-processor/conf directory.

What does it mean when Java could not read the lastModifiedTime attribute on Windows?

A customer has lots of following stacktraces appearing in the logs of my application.
It runs on WildFly 18 and JDK 11 on Windows Server.
2022-10-14 14:36:19,382 ERROR [io.undertow.request] (default I/O-2) UT005071: Undertow request failed HttpServerExchange{ GET /application/images/gray/qtip/nul}: java.lang.RuntimeException: java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:65)
at org.wildfly.extension.undertow#18.0.1.Final//org.wildfly.extension.undertow.deployment.ServletResource.getLastModified(ServletResource.java:61)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.resource.CachedResource.<init>(CachedResource.java:59)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.resource.CachingResourceManager.getResource(CachingResourceManager.java:119)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.resource.CachingResourceManager.getResource(CachingResourceManager.java:32)
at io.undertow.servlet#2.0.27.Final//io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:96)
at io.undertow.servlet#2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:91)
at org.wildfly.extension.undertow#18.0.1.Final//org.wildfly.extension.undertow.Host$OptionsHandler.handleRequest(Host.java:399)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
at org.wildfly.extension.undertow#18.0.1.Final//org.wildfly.extension.undertow.Host$AcmeResourceHandler.handleRequest(Host.java:421)
at org.wildfly.extension.undertow#18.0.1.Final//org.wildfly.extension.undertow.Host$HostRootHandler.handleRequest(Host.java:430)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:64)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:78)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
at org.wildfly.extension.undertow#18.0.1.Final//org.wildfly.extension.undertow.Server$DefaultHostHandler.handleRequest(Server.java:190)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:211)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.DisallowedMethodsHandler.handleRequest(DisallowedMethodsHandler.java:61)
at io.undertow.core#2.0.27.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
at io.undertow.core#2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255)
at io.undertow.core#2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
at io.undertow.core#2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
at org.jboss.xnio#3.7.3.Final//org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.jboss.xnio#3.7.3.Final//org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at io.undertow.core#2.0.27.Final//io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1176)
at org.jboss.xnio.nio#3.7.3.Final//org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
at org.jboss.xnio.nio#3.7.3.Final//org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
at java.base/java.nio.file.Files.getLastModifiedTime(Files.java:2315)
at io.undertow.core#2.0.27.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:63)
... 36 more
So always the method getLastModifiedTime triggers this issue. Does this mean that there are issues with permissions problems? I guess that my Java program doesn't have the sufficient rights to access these files, but I'm not sure about this.
Can someone help me?
If we look at the underlying exception:
java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.
We can see that the file’s final path component is nul. That name is not allowed in Windows at all, which is the reason for the cryptic exception message (which probably came from Windows, not from Java). This is documented at https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file :
Do not use the following reserved names for the name of a file:
CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.
Solution: don’t name a file nul.

Processing Java exceptions with AWK

I am wondering what is the best approach to collect all the different exceptions that happened from a log file.
An entry look like this:
/var/log/hadoop-hdfs/hadoop-cmf-hdfs-DATANODE-aaa.log.out.5
2017-08-30 13:54:44,561 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: DataNode{data=FSDataset{dirpath='[/var/hadoop/sdc/dn/current, /var/hadoop/sdd/dn/current]'}, localName='host.tld:50010', datanodeUuid='aaaaaa-6828-44dd-xxx-bbbbb', xmitsInProgress=0}:Exception transfering block BP-111111-172.16.9.110-1471873778315:blk_1086251547_12532682 to mirror 172.16.9.8:50010: org.apache.hadoop.hdfs.protocol.datatransfer.InvalidEncryptionKeyException: Can't re-compute encryption key for nonce, since the required block key (keyID=-111) doesn't exist. Current key: 123
Or this:
2016-08-22 15:50:09,706 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer: Disk Balancer is not enabled.
I would like to print out the exception or if there is no exception then the remaining fields after $4.
Current code:
awk '/ERROR/{print $3" "$4}' /var/log/hadoop-hdfs/*.log.out | sort | uniq -c
Is there an easy way to look through all of the fields after $4 and if there is an exception print out the field that has the exception, if there isn't just print out everything?
The output is like this right now:
93 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode:
8403 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer:
The expected output is:
xx ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Broken pipe
yy ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.net.SocketTimeoutException
8403 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer: Disk Balancer is not enabled.
Sample input:
2016-08-22 16:35:42,502 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer: Disk Balancer is not enabled.
2016-08-22 16:36:42,506 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer: Disk Balancer is not enabled.
2016-08-22 16:37:29,515 ERROR org.apache.hadoop.hdfs.server.datanode.DiskBalancer: Disk Balancer is not enabled.
2016-08-22 16:37:29,530 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: RECEIVED SIGNAL 15: SIGTERM
2018-01-06 13:45:18,899 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: hostname:50010:DataXceiver error processing WRITE_BLOCK operation src: /172.16.9.68:53477 dst: /172.16.9.6:50010
2018-01-06 14:04:05,176 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: DataNode{data=FSDataset{dirpath='[/var/hadoop/sdc/dn/current, /var/hadoop/sdd/dn/current]'}, localName='hostname:50010', datanodeUuid='uuid', xmitsInProgress=11}:Exception transfering block BP-1301709078-172.16.9.110-1471873778315:blk_1095601056_21903280 to mirror 172.16.9.34:50010: java.net.SocketTimeoutException: 65000 millis timeout while waiting for channel to be ready for read. ch : java.nio.channels.SocketChannel[connected local=/172.16.9.6:37439 remote=/172.16.9.34:50010]

Oracle 11g dbms_java.start_jmx_agent throws an exception

I'm trying to profile a Java stored proc inside an Oracle DB. My user has been granted role JMXSERVER, but when I run call dbms_java.start_jmx_agent('22222', 'false', 'false'); I get:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.RuntimeException: java.lang.RuntimeException: Management agent class failed
ORA-06512: at "SYS.DBMS_JAVA", line 803
ORA-06512: at "SYS.DBMS_JAVA", line 812
ORA-06512: at line 1
I've traced the error to this line in JDK: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/sun/management/Agent.java#L483, and the exception details are printed to System.err, but where does Oracle write its stderr to?
You have to redirect the output like this:
select DBMS_JAVA.SET_OUTPUT_TO_SQL('1', 'begin dbms_output.put_line(:1); end;','TEXT') from dual;
Then the error will be printed to the SQL session output. In my case the culprit was a missing file javavm//lib/management/management.properties, so I went to server admins.
You can also redirect the Java System.out and System.err to DBMS_OUTPUT:
dbms_java.set_output(100);
By the way, I tried the DBMS_JAVA.SET_OUTPUT_TO_SQL function as provided by Alexey but it failed with "Parameter 2 has invalid SQL" error. Did it work for you?

How to update document in TrueVault

I am trying to do update a document in TrueVault using document id and schema id but it gives me error like this
Response Code : 400Exception in thread "main"
java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.truevault.com/v1/vaults/vault-id/documents/document-id at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at TrueVaultGetRequest.sendPut(TrueVaultGetRequest.java:264)
at TrueVaultGetRequest.main(TrueVaultGetRequest.java:140)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://api.truevault.com/v1/vaults/vault-id/documents/document-id
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at TrueVaultGetRequest.sendPut(TrueVaultGetRequest.java:260)
... 1 more
my encoded json is also correct. I have check it multiple times but still I have not get any solution. please give me solution.
Thank you
This request is described in TrueVault documentation on Updating A Document.
Your request needs to look something like this format:
curl https://api.truevault.com/v1/vaults/00000000-0000-0000-0000-000000000000/documents/00000000-0000-0000-0000-000000000000 \
-u [API_KEY | ACCESS_TOKEN]: \
-X PUT \
-d "document=e30="
Try manually inputing this curl command on the command line using your information. A more descriptive error message will be a part of the response.
Note: I assume you replaced your actual Vault and Document IDs in this SO with vault-id and document-id to keep that data private, but if not then that would be your mistake. Insert the actual Vault and Document IDs in place of those strings to move on.

Categories

Resources