Does hawt.io still work with camel-http? - apache-camel

We are running standalone java application using apache camel. We've embedded haw.io in the application and everything seems to be working.
When we add a dependency on camel-http, hawtio will no longer start. Are these not compatible?
This is the exception we are getting:
2013-07-01 13:55:10,002 WARN [Thread-5] - HawtioLoader.run (HawtioLoader.java:35) - hawt.io failed to run
java.lang.SecurityException: class "javax.servlet.FilterRegistration"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:806) ~[?:1.6.0_51]
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487) ~[?:1.6.0_51]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:625) ~[?:1.6.0_51]
at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[?:1.6.0_51]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[?:1.6.0_51]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) ~[?:1.6.0_51]
at java.net.URLClassLoader.access$000(URLClassLoader.java:58) ~[?:1.6.0_51]
at java.net.URLClassLoader$1.run(URLClassLoader.java:197) ~[?:1.6.0_51]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.6.0_51]
at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[?:1.6.0_51]
at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[?:1.6.0_51]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) ~[?:1.6.0_51]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[?:1.6.0_51]
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:129) ~[jetty-webapp-8.1.3.v20120416.jar:8.1.3.v20120416]
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:109) ~[jetty-webapp-8.1.3.v20120416.jar:8.1.3.v20120416]
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:97) ~[jetty-webapp-8.1.3.v20120416.jar:8.1.3.v20120416]
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:171) ~[jetty-webapp-8.1.3.v20120416.jar:8.1.3.v20120416]
at io.hawt.embedded.Main.run(Main.java:56) ~[hawtio-embedded-1.1.jar:?]
at HawtioLoader.run(HawtioLoader.java:33) [classes/:?]

I think the problem is that both hawt.io and camel-http will include some javax-packages. From what I remember when I had this problem the solution was to look at the chained dependencies (in for example Eclipse) and find packages that are linked in from both. When you have found them (probably javax.servlet-something) exclude them from the camel-http dependency definition and your project will most likely work.
/S Laven

Related

Could not initialize class sun.security.ssl.SSLExtension when deploying spring boot with mssql database to glassfish 5.1

I am new to glassfish server and I am trying to deploy a Spring boot application in glassfish 5.1.
My Spring boot application communicates with database via JPA and Hibernate.
When I compile and deploy with mysql, deployment went fine.
However, when I change the database to Microsoft Sql Server (MSSQL) deployment fails with the error below:
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLExtension
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:136)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:408)
at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:377)
at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:174)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:750)
]]
Server: Galssfish 5.1
Databse used: mssql
Dependency: runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
Java: jdk8
Properties file Config:
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.url=jdbc:sqlserver://127.0.0.1;databaseName=test_db
spring.datasource.username= SA
spring.datasource.password= Somepassword
Kindly assist.
Thanks to the explanation in Stackoverflow-glassfish5, the issue is now resolved.
There is a problem with Glassfish 5 dependency on Java8 sun package which is causing a clash during deployment.
To fix the issue, we needed to delete the sun folder from grizzly-npn-bootstrap.jar.
Location is: {{glassfish5_home}}/glassfish5/glassfish/modules/endorsed/grizzly-npn-bootstrap.jar.
Procedure is to extract it with a zip application (Winrar), then delete the sun folder and save.
Restart Glassfish 5 and then you are good.

CN1 crash linked to skins?

I just updated to the latest CN1 sources, but now I get the below error for a project that compiled just before. Any idea about is causing this issue?
NB. I've activated CSS for this demo example since I'm trying debug an issue I have with that. Notice the line with "Failed loading the skin file: /iPhoneX.skin". I have reloaded the CN1 settings for this project, so the iPhoneX skin should be there as far as I understood.
Sorry in advance if I did something stupid, I'm pretty nagged this evening :-)
JavaSE.build-skins:
JavaSE.init-skins:
DEPRECATED - The copydir task is deprecated. Use copy instead.
Copying 1 file to /Users/user/NetBeansProjects/CodenameOne/Ports/JavaSE/build/classes
Expanding: /Users/user/NetBeansProjects/cn1-binaries/javase/sqlite-jdbc-3.7.15-M1.jar into /Users/user/NetBeansProjects/CodenameOne/Ports/JavaSE/build/classes
Expanding: /Users/user/NetBeansProjects/cn1-binaries/javase/Filters.jar into /Users/user/NetBeansProjects/CodenameOne/Ports/JavaSE/build/classes
JavaSE.compile:
Building jar: /Users/user/NetBeansProjects/CodenameOne/Ports/JavaSE/dist/JavaSE.jar
To run this application from the command line without Ant, try:
/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home/jre/bin/java -cp /Users/user/NetBeansProjects/CodenameOne/CodenameOne/dist/CodenameOne.jar:/Users/user/NetBeansProjects/cn1-binaries/javase/sqlite-jdbc-3.7.15-M1.jar:/Users/user/NetBeansProjects/cn1-binaries/javase/Filters.jar:/Users/user/NetBeansProjects/cn1-binaries/javase/jcef.jar:/Users/user/NetBeansProjects/cn1-binaries/javase/jmf-2.1.1e.jar:/Users/user/NetBeansProjects/cn1-binaries/jfxrt.jar:/Users/user/NetBeansProjects/CodenameOne/Ports/JavaSE/dist/JavaSE.jar com.codename1.impl.javase.Simulator
JavaSE.deploy:
JavaSE.jar:
Retina Scale: 2.0
Using stateful mode. Use -help flag to see options for new stateless mode.
Updating merge file /Users/user/NetBeansProjects/safearedemo/css/theme.css.merged
Compiling /Users/user/NetBeansProjects/safearedemo/css/theme.css.merged to /Users/user/NetBeansProjects/safearedemo/src/theme.res
File has not changed since last compile.
CSS file successfully compiled. /Users/user/NetBeansProjects/safearedemo/src/theme.res
Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
code size and wider device support
compile:
run:
Adding CEF to classpath
Found theme.css file. Watching for changes...
CSS> Retina Scale: 2.0
CSS> Using stateful mode. Use -help flag to see options for new stateless mode.
CSS> Looks like this CSS file needs CEF on classpath... adding it now, and retrying...
CSS> Adding CEF to classpath
Retina Scale: 2.0
Failed loading the skin file: /iPhoneX.skin
java.lang.NullPointerException
at com.codename1.impl.javase.JavaSEPort.initializeCoordinates(JavaSEPort.java:2270)
at com.codename1.impl.javase.JavaSEPort.loadSkinFile(JavaSEPort.java:2491)
at com.codename1.impl.javase.JavaSEPort.loadSkinFile(JavaSEPort.java:4400)
at com.codename1.impl.javase.JavaSEPort.init(JavaSEPort.java:4612)
at com.codename1.impl.CodenameOneImplementation.initImpl(CodenameOneImplementation.java:178)
at com.codename1.ui.Display.init(Display.java:500)
at com.codename1.impl.javase.Executor$3.run(Executor.java:242)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
CSS> Retina Scale: 2.0
CSS> Using stateful mode. Use -help flag to see options for new stateless mode.
CSS> Updating merge file /Users/user/NetBeansProjects/safearedemo/css/theme.css.merged
CSS> Starting watch thread to watch [/Users/user/NetBeansProjects/safearedemo/css/theme.css]
CSS> Compiling /Users/user/NetBeansProjects/safearedemo/css/theme.css.merged to /Users/user/NetBeansProjects/safearedemo/src/theme.res
CSS> File has not changed since last compile.
CSS> CSS file successfully compiled. /Users/user/NetBeansProjects/safearedemo/src/theme.res
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1321)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1296)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
at com.codename1.impl.javase.JavaSEPort$C.blit(JavaSEPort.java:1392)
at com.codename1.impl.javase.JavaSEPort.flushGraphics(JavaSEPort.java:5613)
at com.codename1.impl.javase.JavaSEPort$C$3.run(JavaSEPort.java:1557)
at com.codename1.ui.Display.processSerialCalls(Display.java:1338)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1125)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.NullPointerException
at com.codename1.impl.javase.JavaSEPort$C.drawScreenBuffer(JavaSEPort.java:1467)
at com.codename1.impl.javase.JavaSEPort$C.access$600(JavaSEPort.java:1189)
at com.codename1.impl.javase.JavaSEPort$C$1.run(JavaSEPort.java:1358)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Rendering frame took too long 6473 milliseconds
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1321)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1296)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
at com.codename1.impl.javase.JavaSEPort$C.blit(JavaSEPort.java:1392)
at com.codename1.impl.javase.JavaSEPort$C.blit(JavaSEPort.java:1400)
at com.codename1.impl.javase.JavaSEPort.flushGraphics(JavaSEPort.java:5602)
at com.codename1.impl.CodenameOneImplementation.paintDirty(CodenameOneImplementation.java:644)
at com.codename1.impl.javase.JavaSEPort.paintDirty(JavaSEPort.java:2247)
at com.codename1.ui.Display.edtLoopImpl(Display.java:1259)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1162)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.NullPointerException
at com.codename1.impl.javase.JavaSEPort$C.drawScreenBuffer(JavaSEPort.java:1467)
at com.codename1.impl.javase.JavaSEPort$C.access$600(JavaSEPort.java:1189)
at com.codename1.impl.javase.JavaSEPort$C$1.run(JavaSEPort.java:1358)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
If you're working from sources then the skin file for iPhoneX needs to be in the JavaSEPort/src. Normally the build script copies it but we've undergone some changes in our build process and it's possible this is no longer seamless.

Testing camel 2.24.x routes in Karaf 4.2.7 with CamelTestSupport

I want to test Camel 2.24.x routes in Karaf 4.2.x. I use Pax-Exam 4.13.1 to run Karaf. The Camel Testing Manual does not cover Karaf testing. For older Karaf and Camel versions there are blog articles which demonstrate how to do that by extending a test class from CamelTestSupport:
Testing Camel JPA routes with Pax-Exam and Karaf
Testing (utest and itest) Apache Camel Blueprint route
However, they are so old that the code no longer runs without adjustments. The former is pretty hopeless, I have stopped trying to fix it. For the latter I was able to get it to work on Karaf 2.4 with Camel 2.12.1 on JDK 8, but not with the current Karaf 4.2.7 using Camel 2.24.2.
With the current Karaf 4 and Camel 2.24 I get the following error message when CamelTestSupport tries to create a JndiContext in CamelTestSupport#createRegistry.
java.lang.ClassNotFoundException: org.apache.camel.util.jndi.CamelInitialContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.felix.framework.BundleWiringImpl.doImplicitBootDelegation(BundleWiringImpl.java:1859)
at org.apache.felix.framework.BundleWiringImpl.tryImplicitBootDelegation(BundleWiringImpl.java:1788)
at org.apache.felix.framework.BundleWiringImpl.searchDynamicImports(BundleWiringImpl.java:1741)
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1617)
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:91)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
at org.apache.camel.test.junit4.CamelTestSupport.createJndiContext(CamelTestSupport.java:790)
at org.apache.camel.test.junit4.CamelTestSupport.createRegistry(CamelTestSupport.java:776)
at org.apache.camel.test.junit4.CamelTestSupport.createCamelContext(CamelTestSupport.java:770)
at org.apache.camel.test.junit4.CamelTestSupport.doSetUp(CamelTestSupport.java:325)
at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
The missing class is in camel-core and it used to be working with the older versions of Camel and Karaf, so I am at a loss why that class would not be available when using the latest Karaf and Camel.
What could be the reason why the CamelInitialContextFactory cannot be found? As in the older version, I install camel-blueprint and camel-test in my test, so I would expect that camel-core should be included.
Is it still a good idea to work with CamelTestSupport on Karaf? While there is a CamelKarafTestSupport which seems to demonstrate that approach, I could not find a working example for such a test and I could not get it to work myself either. With CamelKarafTestSupport I get an error telling me that ProbeInvoker never came up:
org.ops4j.pax.swissbox.tracker.ServiceLookupException: gave up waiting for service org.ops4j.pax.exam.ProbeInvoker
at org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:199)
at org.ops4j.pax.swissbox.tracker.ServiceLookup.getService(ServiceLookup.java:136)
at org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
at com.sun.proxy.$Proxy15.remoteCall(Unknown Source)
at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl$1.invoke(RemoteBundleContextClientImpl.java:102)
at com.sun.proxy.$Proxy16.call(Unknown Source)
at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.call(RemoteBundleContextClientImpl.java:290)
at org.ops4j.pax.exam.container.remote.RBCRemoteTarget.call(RBCRemoteTarget.java:60)
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.call(KarafTestContainer.java:665)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.invoke(EagerSingleStagedReactor.java:109)
at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Should I go a different route, maybe the AbstractFeatureTest from camel-test-karaf, which is used extensively by camel-itest-karaf?
The advice in the pax-exam group was to use KarafTestSupport from org.apache.camel.itests:common for integration tests in pax-exam and stick to CamelTestSupport for unit tests.
With that, I got the camel itests running again: https://github.com/dschulten/blog-camel-blueprint/tree/karaf4-paxexam4.
In Karaf 4.2.7 KarafTestSupport requires numerous spring and activemq version system properties (see the configuration of the maven-surefire-plugin), that will go away as of Karaf 4.2.8.
It is still possible to use camel mock routes in KarafTestSupport-based integration tests.

Executing Spring Cloud application in Google AppEngine

We are trying to deploy a Spring Cloud (Boot + Netflix API wrappers) based project in Google AppEngine. We want to use spring-cloud-starter-zuul as an API Gateway.
For reasons beyond the development team, we have to deploy this in the AppEngine Standard Environment (Java7, Servlet 2.5). We can't use the newer AppEngine Flexible Environment (container based, Java 8).
We have created a sample Gradle+AppEngine project based on these guidelines.
Sample project code is on Github.
We see this stacktrace when running the command ./gradlew appengineRun:
java.lang.ClassNotFoundException: com.google.appengine.api.ThreadManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_80]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_80]
at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_80]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_80]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_80]
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:198) ~[appengine-local-runtime.jar:na]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_80]
at java.lang.Class.forName0(Native Method) ~[na:1.7.0_80]
at java.lang.Class.forName(Class.java:195) ~[na:1.7.0_80]
at com.netflix.hystrix.util.PlatformSpecific.getAppEngineThreadFactory(PlatformSpecific.java:64) ~[hystrix-core-1.5.5.jar:1.5.5]
at com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.<init>(HystrixMetricsPoller.java:86) ~[hystrix-metrics-event-stream-1.5.5.jar:1.5.5]
at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixMetricsPollerConfiguration.start(HystrixCircuitBreakerConfiguration.java:135) ~[spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
What are we missing to be getting this error during application startup?
Is this related to Hystrix code trying to ascertain if it is running in an AppEngine environment? Ref: Netflix Hystrix Pull Request 1066 (due to few reputation points on SO, I can't post more than two links).
Thank you.

Tomcat 6 customized Realm

I'm trying to write my own Realm to authenticate my users.
I have written a class extending org.apache.catalina.realm.RealmBase, compiled to a .jar file and put it in the /lib library.
Then I added this to server.xml:
<Realm className="wstest.tomcat.security.MyRealm"
resourceName="myrealm"/>
Tomcat doesn't seem to "see" my new jar...
When I start Tomcat I get:
ERROR main org.apache.commons.digester.Digester - Begin event threw exception
java.lang.ClassNotFoundException: wstest.tomcat.security.MyRealm
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
at org.apache.catalina.startup.Catalina.load(Catalina.java:526)
at org.apache.catalina.startup.Catalina.load(Catalina.java:560)
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 org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Which /lib folder have you used? The one in your WebProject or the one in tomcat?
I'm a tomcat greenhorn myself but as far as I know you should place your JAR in the latter one.
server.xml is loaded before the webapps. Therefore tomcat needs to find your Realm implementation class before it gets to load your application JAR files. Place the JAR in tomcat/lib and that should fix the problem.
You also need to be aware of one gotcha: don't log anything in the Realm constructor. The containerLog field is not set in there so you'll get a nasty NPE. loadInternal() sets the containerLog.

Resources