AWS XRay recorder trying to instrument classes on startup - spring-aop

I'm trying to add the aws-xray-recorder-sdk-spring lib to an existing spring boot service, as described in the docs here.
I get this error on startup:
{"#timestamp":"2018-05-08T08:04:23.026+10:00","#version":1,"message":"Application run failed","logger_name":"org.springframework.boot.SpringApplication","thread_name":"main","level":"ERROR","level_value":40000,"stack_trace":"org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'meterRegistryPostProcessor' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: org.springframework.data.repository.Repository [Xlint:invalidAbsoluteTypeName]
\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
\tat org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:238)
\tat org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:709)
\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:534)
\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
\tat net.nxbos.vti.Application.main(Application.java:34)
Caused by: java.lang.IllegalArgumentException: warning no match for this type name: org.springframework.data.repository.Repository [Xlint:invalidAbsoluteTypeName]
\tat org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:319)
\tat org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:226)
\tat org.springframework.aop.aspectj.AspectJExpressionPointcut.obtainPointcutExpression(AspectJExpressionPointcut.java:197)
\tat org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:176)
\tat org.springframework.aop.support.AopUtils.canApply(AopUtils.java:224)
\tat org.springframework.aop.support.AopUtils.canApply(AopUtils.java:283)
\tat org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:315)
\tat org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:124)
\tat org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:93)
\tat org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:74)
\tat org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:352)
\tat org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:304)
\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438)
\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1714)
\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
\t... 15 common frames omitted
"}
I have set the Interceptor to run on classes annotated with #XRayEnabled like so
#Override
#Around("#annotation(com.amazonaws.xray.spring.aop.XRayEnabled)")
public void xrayEnabledClasses() {}
I don't have spring-data in my project so a little confused as to why AOP is trying to match on it.
Theres a post here that mentions the Thread local usage on startup could be to blame, and suggests instrumenting manually. Would prefer to use the AWS SDK if possible, any ideas on the above error?
The AWS X-Ray Recorder SDK relies on InheritableThreadLocal storage in
order to propagate information about the current (sub)segments
throughout the program's execution. It seems that Spring is using a
pre-instantiated ThreadPoolExecutor to run its Bean creation tasks.
Thus, the "InitializerListener" segment, after being created on an
alternate thread, is not available to the I18nCache initializing
function.

I was facing the same issue. I found out that my project was missing spring-data-commons dependency. As a result, we are encountering ClassNotFoundException for org.springframework.data.repository.Repository. The exception gets masked by Spring AOP. My issue got fixed once I added this dependency.

Related

when generating build of AngularJS project getting Uglifying source .tmp/concat/scripts/scripts.js failed

Creating build of angularjs project inside folder dist /script I am not getting one script.js file.
I have tried grunt build --prod --force command for creating the build
Running "uglify:generated" (uglify) task
JS_Parse_Error {enter code here
message: 'Unexpected token: punc ())',
filename: '../../.tmp/concat/scripts/scripts.js',
line: 5122,
col: 59,
pos: 161138,
stack:
'Error\n at new JS_Parse_Error (D:\\...node_modules\\uglify-node_modules\\uglify-js\\lib\\parse.js:1427:20)' }
>> Uglifying source .tmp/concat/scripts/scripts.js failed.
Warning: Uglification failed.
Unexpected token: punc ()).
Line 5122 in .tmp/concat/scripts/scripts.jsenter code here
Used --force, continuing.
Warning: Cannot read property min of undefined Used --enter code hereforce, continuing.

Apache Camel: How to stream large files from AWS?

I have a route as follows. It works for small files, but for large ones (around 6GB or more), my program runs out of memory. How do I stream the content without storing in memory?
public void configure() throws Exception {
S3LastModifiedFilter lastModifiedFilter =
new S3LastModifiedFilter(s3Properties.getLastModifiedWithinSeconds(), s3Properties.getPrefix());
from(inboundS3Uri)
.filter().method(lastModifiedFilter, "accept")
.idempotentConsumer(header(S3Constants.KEY),
MemoryIdempotentRepository.memoryIdempotentRepository(inboundCacheSize))
.convertBodyTo(byte[].class, UTF_8.name())
.process(new ForHttpMessageProcessor(httpProperties))
.to(outboundHttpUri);
}
Error:
Caused by: org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: byte[] with value [Body is instance of java.io.InputStream] due java.lang.OutOfMemoryError: Java heap space
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:629)
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:190)
at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:108)
... 23 common frames omitted
Caused by: org.apache.camel.RuntimeCamelException: java.lang.OutOfMemoryError: Java heap space
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1774)
Turns out the line convertBodyTo(byte[].class, UTF_8.name()) was the problem. It was trying to buffer the content in memory and convert to string. I commented it out, and now the code works.

Babel/browserify throws "Error while parsing JSON - Unexpected token o"

Weird error when attempting to use browserify and babel:
./node_modules/.bin/browserify app/index.js -o bundle.js -t [ babelify --presets [ es2015 react ] ]
gives:
SyntaxError: /.../package.json: Error while parsing JSON - Unexpected token o in JSON at position 1 while parsing file: /.../index.js
at Object.parse (native)
at ConfigChainBuilder.addConfig (/.../dash/node_modules/babelify/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:155:65)
at ConfigChainBuilder.findConfigs (/.../dash/node_modules/babelify/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:107:30)
at buildConfigChain (/.../dash/node_modules/babelify/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:66:13)
at OptionManager.init (/.../dash/node_modules/babelify/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:58)
at File.initOptions (/.../dash/node_modules/babelify/node_modules/babel-core/lib/transformation/file/index.js:223:65)
at new File
I have the proper presets installed for es2015 and react, but I have no idea why it's throwing up this error. The weird thing is, this command is working on my production server...
Any ideas?
This is the package.json parsing error, Check whether there is an package.json file at my user directory, if exist, delete it.

angularjs gulp build fail angular not defined

Hi i'm building an app with gulp build command after a few seconds shows an error "angular is no defined" and several error more, this is the log :
{lamb} gulp build
[23:45:11] Requiring external module babel-register
[23:45:13] Using gulpfile C:\Apps\test\gulpfile.babel.js
[23:45:13] Starting 'lint'...
[23:45:14] Starting 'styles'...
[23:45:15] Starting 'scripts'...
[23:45:15] Starting 'images'...
[23:45:16] Starting 'fonts'...
[23:45:16] Starting 'extras'...
[23:45:16] Finished 'images' after 923 ms
[23:45:16] Finished 'fonts' after 90 ms
[23:45:16]
C:\Apps\test\app\scripts\main.js
3:10 error "angular" is not defined no-undef
5:34 error A space is required after ',' comma-spacing
9:12 error Extra space after key "controller" key-spacing
10:11 error Trailing spaces not allowed no-trailing-spaces
12:11 error Extra space after key "templateUrl" key-spacing
13:12 error Extra space after key "controller" key-spacing
16:10 error Extra space after key "templateUrl" key-spacing
17:12 error Extra space after key "controller" key-spacing
C:\Apps\test\app\scripts\controllers\controllerView.js
2:1 error "angular" is not defined no-undef
✖ 9 problems (9 errors, 0 warnings)
[23:45:16] 'lint' errored after 3.17 s
[23:45:16] ESLintError in plugin 'gulp-eslint'
Message:
Failed with 9 errors
[23:45:16] Finished 'styles' after 2.07 s
[23:45:16] Finished 'extras' after 609 ms
[23:45:16] Finished 'scripts' after 1.53 s
Add this to your .eslintrc file:
{
"globals": {
"angular": true
},
// ...
}
See the accepted answer for this question for more information:
ESLint's "no-undef" rule is calling my use of Underscore an undefined variable

Exception in android build. Build error in codenameone

Hello I have tried to build an application and send it to an android build but am getting an build error.
This is a small snippet of exception in error log that I got when I put the build onto the server.
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : java.lang.RuntimeException: Exception parsing classes
Unknown source file : at com.android.dx.command.dexer.Main.processClass(Main.java:752)
Unknown source file : at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
Unknown source file : at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
Unknown source file : at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
Unknown source file : at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Unknown source file : at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Unknown source file : at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Unknown source file : at com.android.dx.command.dexer.Main.processOne(Main.java:672)
Unknown source file : at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)
Unknown source file : Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
Unknown source file : at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
Unknown source file : at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
Unknown source file : at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Unknown source file : at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
Unknown source file : at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
Unknown source file : at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
Unknown source file : at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
Unknown source file : at com.android.dx.command.dexer.Main.processClass(Main.java:749)
Unknown source file : ... 12 more
Unknown source file : 1 error; aborting
:preDexDebug FAILED
:preDexDebug (Thread[Daemon worker,5,main]) completed. Took 56.932 secs.
Starting process 'command '/usr/java/jdk1.7.0_67/bin/java''. Working directory: /tmp/build2186746778357232766xxx/Starter Command: /usr/java/jdk1.7.0_67/bin/java -Xmx2048M -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/ec2-user/android-sdk/build-tools/23.0.1/lib/dx.jar com.android.dx.command.Main --dex --verbose --force-jumbo --num-threads=4 --output /tmp/build2186746778357232766xxx/Starter/build/intermediates/pre-dexed/debug/classes-050c44252ac48b6fb75508d313fd95ce08e1abcc.jar /tmp/build2186746778357232766xxx/Starter/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/8.3.0/jars/classes.jar
FAILURE: Build failed with an exception.
Please find the attached error log
This was due to us changing the behavior of Google Play Services. We are looking to redeploy the change with a slightly more conservative approach so we would still need the error log to confirm exactly what went wrong.
same happen for me
Log
com.codename1.social.GoogleImpl.init();
^
symbol: class GoogleImpl
location: package com.codename1.social
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileReleaseJavaWithJavac FAILED
:compileReleaseJavaWithJavac (Thread[Daemon worker,5,main]) completed. Took 21.094 secs.

Resources