Exception when connecting to Azure EventHub - azure-eventhub

I have created an Azure Event Hub and am getting an exception when the following line of code is executed.
ConnectionStringBuilder connStr = new ConnectionStringBuilder(namespaceName, eventHubName, sasKeyName, sasKey);
I get the following exception.
Exception in thread "main" java.lang.NoClassDefFoundError: java/time/Duration
at com.microsoft.azure.servicebus.MessagingFactory.<clinit>(MessagingFactory.java:29)
at com.microsoft.azure.servicebus.ConnectionStringBuilder.<init>(ConnectionStringBuilder.java:92)
at camelTest.Send.main(Send.java:22)
Caused by: java.lang.ClassNotFoundException: java.time.Duration
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
Would somebody be able to tell me what I am doing wrong

EventHubs Java Client needs - jdk 1.8.
I believe you are trying to run with jdk 1.7 - which might compile - but while running it - it will run into a lot of NoClassDefFound errors.

Related

PowerMockEasyMock: Failed to transform class with name

I am using PowerMockEasyMock 1.5.5 along with EasyMock 3.2. I wanted to mock a new object created within a method that requires #PrepareForTest. But whenever I do this, I get this exception :
java.lang.IllegalStateException: Failed to transform class with name
com.amazon.awsaccounts.notificationlistenerservice.proxies.MyClassTest. Reason: sorry, cannot edit NEW followed by no DUP
at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:247)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:177)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:68)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:138)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:218)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
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 org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: javassist.CannotCompileException: sorry, cannot edit NEW followed by no DUP
at javassist.expr.NewExpr.canReplace(NewExpr.java:150)
at javassist.expr.NewExpr.replace(NewExpr.java:170)
at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:427)
at javassist.expr.ExprEditor.loopBody(ExprEditor.java:198)
at javassist.expr.ExprEditor.doit(ExprEditor.java:90)
at javassist.CtClassType.instrument(CtClassType.java:1224)
at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:74)
at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:243)
... 28 more
I have even tried to do this with PowerMockMockito 1.6.x but still got the same problem. I have read the posts in Stackoverflow but non got me the solution. I researched online about this and understood that there is a problem with older version of Javassist that is a dependency in PowerMockMockito as well as PowerMockEasyMock. I added Javassist 3.20.x in my version set but still getting the same error. Anybody has an idea as to what would be the correct configuration?

How to locate the root cause when lock occurs

I'm using EJB Container(Glassfish 4.0) to run my web application, it will use a thread from thread pool to handle each request from client.After running for a period of time, many threads seem to be blocked.I got following information using jstack:
"default-http(6)" daemon prio=10 tid=0x00007f2c9c009000 nid=0x6cb9 waiting on condition [0x00007f2fd53fb000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00007f4740824750> (a java.util.concurrent.locks.ReentrantReadWriteLock$FairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
at com.sun.ejb.containers.CMCSingletonContainer._getContext(CMCSingletonContainer.java:141)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2516)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1906)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy475.openAccount(Unknown Source)
at com.creditcloud.boc.local.__EJB31_Generated__BocClient__Intf____Bean__.openAccount(Unknown Source)
at com.creditcloud.boc.BocServiceBean.openAccount(BocServiceBean.java:242)
at sun.reflect.GeneratedMethodAccessor1053.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4667)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4655)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:205)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:79)
at com.sun.proxy.$Proxy470.openAccount(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1052.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:143)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:173)
at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528)
at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199)
at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549)
at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:119)
at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.invoke(ClientDelegateImpl.java:272)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:198)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150)
at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:226)
at com.creditcloud.boc.api.__BocService_Remote_DynamicStub.openAccount(com/creditcloud/boc/api/__BocService_Remote_DynamicStub.java)
at com.creditcloud.boc.api._BocService_Wrapper.openAccount(com/creditcloud/boc/api/_BocService_Wrapper.java)
at com.creditcloud.creditmarket.local.BocBridge.openAccount(BocBridge.java:140)
at com.creditcloud.creditmarket.local.BocBridge.openAccount(BocBridge.java:185)
at sun.reflect.GeneratedMethodAccessor789.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4695)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4667)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4655)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy641.openAccount(Unknown Source)
at com.creditcloud.creditmarket.local.__EJB31_Generated__BocBridge__Intf____Bean__.openAccount(Unknown Source)
at com.creditcloud.creditmarket.resources.api.v2.BocApiResource.openAccount(BocApiResource.java:75)
at sun.reflect.GeneratedMethodAccessor788.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:323)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:525)
at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:473)
at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:410)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:744)
I have checked my LocalBean, didn't find synchronized or Lock in it.Is there any approach to find out the root cause?
I don't know the inner details of the Glassfish EJB container implementation, but some conclusions seem obvious. You have a Singleton bean ( com.sun.ejb.containers.CMCSingletonContainer). This means that only one instance of the bean is created for the lifetime of the application.
You probably haven't configured Bean Managed Concurrency or any other concurrency related annotations on the bean methods. This implies that the conatiner uses the default concurrency strategy: Container Managed Concurrency, where every method has an implicit Write Lock, effetctivley serializing every method invocation on your bean.
You might be better of using Bean Managed Concurrency, or proper concurrency annotations on your bean methods, but that of course depends on the inherent concurrency support of your logic.
All this is quite well defined in the EJB specification.

Getting ClassNotFoundException: org.eclipse.jetty.server.Server

I'm using the class "org.eclipse.jetty.server.Server" in XML file to intialize it with various parameters(Please note this is an OSGi environment). However my bundle which is using the class "org.eclipse.jetty.server.Server" is not starting and throwing the following exception:
java.lang.ClassNotFoundException: org.eclipse.jetty.server.Server
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:129)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:92)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.nodeClass(XmlConfiguration.java:349)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:327)
I've made sure that the jetty server bundle is up and running and also I've made sure that I've given proper version in the "Imported-Packages" section of my manifest file. Please help.
If you want to use Jetty in the way that
Jetty is initialized based on XML configuration
It is used within an OSGi environment
I recommend that you should use jetty-osgi-boot bundle. You can find more information about its usage in the documentation of Jetty.
In case you want to develop a custom solution based on jetty-xml, you should check how jetty-boot does it.
Some tips:
The configuration is read from the XML file in the end of ServerInstanceWrapper.configure() function.
That is called from DefaultJettyAtJettyHomeHelper.startJettyAtJettyHome(...)
There you will find the trick that the Thread Context Classloader is overridden until the Server is configured from the XML.
ClassLoader contextCl = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(JettyBootstrapActivator.class.getClassLoader());
...
Server server = ServerInstanceWrapper.configure(null, configURLs, properties);
...
return server;
}
...
finally
{
Thread.currentThread().setContextClassLoader(contextCl);
}
Please note that the links and example is from Jetty 9.2.9 as the code is a bit nicer there, but you can find the same or similar logic in the jetty-osgi-boot of your Jetty version.
It is not a good thing to play around with the Thread Context ClassLoader, but sometimes it is necessary, when code is called that use TCL. The best would be if the XMLConfiguration class of Jetty accepted a ClassLoader as a parameter.

webservice WSDL import error

I need help creating a webservice. Basically the company whom im trying to connect with has provided me with a wsdl and xsd files. But when I try to create the web service using the rad webservice widget I get the error below. please help. If you think I need to explain more just ask me dont down vote please! HELP!
ERROR:
Errors occurred during wsimport.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.jdk6.jws22.command.WsImportCommand.execute(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.command.WsImportCommand.execute(Unknown Source)
at com.ibm.ast.ws.jaxws.creation.command.WsimportNonUIThreadCommand$RunCmdInNonUIThread.run(Unknown Source)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(Unknown Source)
Caused by: java.lang.InternalError: unresolved reference
at com.ibm.jtc.jax.xml.xsom.impl.parser.DelayedRef._get(Unknown Source)
at com.ibm.jtc.jax.xml.xsom.impl.parser.DelayedRef$Type.getType(Unknown Source)
at com.ibm.jtc.jax.xml.xsom.impl.ElementDecl.getType(Unknown Source)
at com.ibm.jtc.jax.xml.xsom.impl.ElementDecl.updateSubstitutabilityMap(Unknown Source)
at com.ibm.jtc.jax.xml.xsom.impl.parser.ParserContext.getResult(Unknown Source)
at com.ibm.jtc.jax.xml.xsom.parser.XSOMParser.getResult(Unknown Source)
at com.ibm.jtc.jax.tools.xjc.ModelLoader.createXSOM(Unknown Source)
at com.ibm.jtc.jax.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(Unknown Source)
at com.ibm.jtc.jax.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(Unknown Source)
at com.ibm.jtc.jax.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(Unknown Source)
at com.ibm.jtc.jax.tools.ws.wscompile.WsimportTool.run(Unknown Source)
at com.ibm.ast.ws.jaxws.emitter.jdk6.jws22.command.WsimportToolWrapper.run(Unknown Source)
... 8 more
Have you tried using Java JAX-WS api for webservice skeleton generation insteed of IBM solution you are using right now? There is even ant task for such generations, and as far as i know i works quite well (I have used such solutions in my previous workplace). Here you have
Oracles documentation describing how to use WSIMPORT tools
or blog post showing simple usage of WSIMPORT
For your needs, I'd look at using Maven (since you're using vanilla JAX-WS) with Metro: http://www.jroller.com/gmazza/entry/web_service_tutorial. Try to stay out of the IDE when creating the JAX-WS artifacts, you'll find most of the headaches are with the IDE rather than the wsimport tool.

Implementing Webservice client on websphere 8.0

I have a wsdl file, the clients files were generated and implemented in weblogic(6 years back).
Now, we are trying to implement in WAS 8.0, i generated the JAX-WS client classes and also developed the client. (we deleted all weblogic related jars)
But, i am receiving the following exception when running it,
[8/14/13 17:55:58:368 EDT] 0000001a DispatchActio E org.apache.struts.actions.DispatchAction dispatchMethod Dispatch[/scrflidverification] to method 'init' returned an exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:160)
at dcf.ess.nextgen.ssp.presentation.struts.action.base.BaseLookupDispatchAction.execute(BaseLookupDispatchAction.java:68)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at dcf.ess.nextgen.ssp.presentation.struts.RequestProcessor.process(RequestProcessor.java:198)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at dcf.ess.nextgen.ssp.frameworks.presentation.SessionFilter.doFilter(SessionFilter.java:46)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at dcf.ess.nextgen.ssp.frameworks.presentation.CrossScriptingFilter.doFilter(CrossScriptingFilter.java:28)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:883)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
Caused by: java.lang.NoClassDefFoundError: com.ibm.ws.wstx.handler.WSATGenerator (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:145)
at com.ibm.ws.wstx.WSTXClientTCMImpl.handleInbound(WSTXClientTCMImpl.java:100)
at com.ibm.ws.wstx.WSTXClientTCMImpl.cleanupContext(WSTXClientTCMImpl.java:81)
at org.apache.axis2.util.ThreadContextMigratorUtil.performContextCleanup(ThreadContextMigratorUtil.java:191)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.postExecute(AxisInvocationController.java:654)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:586)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:127)
at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:93)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:373)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:171)
at $Proxy100.invokeIdentityService(Unknown Source)
at dcf.ess.nextgen.ssp.applyforbenefits.idverification.IdVerificationServiceImpl.verifyIdentity(IdVerificationServiceImpl.java:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy43.verifyIdentity(Unknown Source)
at dcf.ess.nextgen.ssp.presentation.struts.action.IdVerificationAction.init(IdVerificationAction.java:114)
... 43 more
The (initialization failure) means that some prior error has occurred that is causing this class to not be loaded. Is there any additional Caused by: that you have not included? If not, I recommend looking elsewhere through your logs for a stack trace that includes WSATGenerator.<clinit>, which should have the original exception. If you can't find anything, then I recommend opening a PMR with IBM.