Eclipse "Create Web Service" Showing Weird Error - java

EDIT 2:
I probably should have mentioned this earlier, but I'm getting a warning after I set up the Web Service (but before it is actually made, where the error occurs). Here is the warning:
The service class
"net.rim.Indy.WebService.Functions_JSONP"
does not comply to one or more
requirements of the JAX-RPC 1.1
specification, and may not deploy or
function correctly.
And the juice:
The service class
"net.rim.Indy.WebService.Functions_JSONP"
does not comply to one or more
requirements of the JAX-RPC 1.1
specification, and may not deploy or
function correctly. The field or
property "cause" on the value type
"atg.taglib.json.util.JSONException"
used via the service class
"net.rim.Indy.WebService.Functions_JSONP"
has a data type,
"java.lang.Throwable", that is not
supported by the JAX-RPC 1.1
specification. Instances of the type
may not serialize or deserialize
correctly. Loss of data or complete
failure of the Web service may result.
If this is fixed, I have a feeling the Web Service will start working, because it is identical to another one I have except for the JSON functionality. Something needs to be changed so that my web service is fully supported by the JAX specs.
EDIT:
I'm now getting around the issue where it is automatically choosing the wrong project for me. I followed File->New->Web Service. My settings are as follows:
Web service type: Bottom up
Service implementation: net.aaa.bbb.WebService.Functions_JSONP
Server runtime: Tomcat v6
Web service runtime: Apache Axis
Service project: ABC
Client type: Java Proxy
I check off "Publish the Web service" and hit Next. Then on the next page I hit Next again to generate Functions_JSONP.wsdl and get the following error:
IWAB0398E Error in generating WSDL from Java: java.lang.ClassNotFoundException: net.aaa.bbb.WebService.Functions_JSONP
Here is the full stack trace:
IWAB0398E Error in generating WSDL from Java: java.lang.ClassNotFoundException: net.aaa.bbb.WebService.Functions_JSONP
java.lang.ClassNotFoundException: net.aaa.bbb.WebService.Functions_JSONP
at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:204)
at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
at org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:2079)
at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:188)
at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.executeAntTask(Java2WSDLCommand.java:180)
at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.execute(Java2WSDLCommand.java:95)
at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation$BottomUpWSModifyOperation.execute(BUCodeGenOperation.java:122)
at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation.execute(BUCodeGenOperation.java:86)
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)
at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)
at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1008)
at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)
at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)
at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.getNextPage(WizardPageManager.java:154)
at org.eclipse.wst.command.internal.env.ui.widgets.SimpleWizardPage.getNextPage(SimpleWizardPage.java:136)
at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:887)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:426)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:254)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
What could be the issue?
Thanks!

From your message it looks like a serialization problem. You seem to be exposing a throwable class as part of the public api and this is in violation with JAX-RPC. (Please check your exception classes for instances of throwable. Remove them and you should be fine).
Note: Example of occurrence. If your exception has this, then its a violation.
private Throwable throwable;
public Throwable getThrowable() {
return throwable;
}

Related

Can there be a operation with same name in two different SOAP endpoints?

I need to consume a SOAP webservice with two endpoints
Employee
Customer
Both the endpoints have same function "getAddress" which returns list of Strings.
In order to consume the web service, I have used "wsimport" tool to generate the stubs
and apache cxf library, I get an exception
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at com.sun.proxy.$Proxy39.getAddress(Unknown Source)
at com.testwebservice.Main.main(Main.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.apache.cxf.binding.soap.SoapFault: Fault occurred while processing.
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1656)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1521)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1429)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:659)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:532)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
when ever I tried to use the "Employee.getAddress" method
But before, I would like to clarify whether two end points can have a same function name with same return type ?
Could not find any information in the documentation.
about your second question:
you cant have a same function name. actually you cant even have overloading. Because WSDL does not support method overloading(not OOPs). WCF generates WSDL which specifies the location of the service and the operation or methods the service exposes.
please provide more information about your service(Like WSDL file) so we can help you with details.

MarshalException: Failed to communicate due to unread block data [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am getting this exception in my java program.Can anyone have idea on it?
MarshalException: Failed to communicate due to unread block data
java.rmi.MarshalException: Failed to communicate.
Problem during marshalling/unmarshalling; nested exception is:
java.lang.IllegalStateException: unread block data
com.naresh.product.common.exception.ApplicationException:
java.rmi.MarshalException: Failed to communicate.
Problem during marshalling/unmarshalling; nested exception is:
java.lang.IllegalStateException: unread block data
at com.naresh.product.client.library.util.ServerDelegate.search(Unknown Source)
at com.naresh.product.client.Product.workflow.form4.ProductForm4DashboardView.refreshDashboard(Unknown Source)
at com.naresh.product.client.Product.workflow.form4.ProductForm4DashboardView.access$3(Unknown Source)
at com.naresh.product.client.Product.workflow.form4.ProductForm4DashboardView$7.run(Unknown Source)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at com.naresh.product.client.Product.workflow.form4.ProductForm4DashboardView.refreshDashboard(Unknown Source)
at com.naresh.product.client.Product.workflow.form4.ProductForm4DashboardView$5.widgetSelected(Unknown Source)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.naresh.product.client.app.Application.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
java.lang.IllegalStateException: unread block data
at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:122)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:646)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:183)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy1.search(Unknown Source)
... 34 more
Caused by: java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2376)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1360)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)
at org.jboss.invocation.unified.marshall.InvocationUnMarshaller.read(InvocationUnMarshaller.java:59)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:957)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:586)
... 45 more
Why this exception is comming. Do you guys have any idea to solve it?
From java.io.ObjectInputStream.BlockDataInputStream Javadoc :
boolean java.io.ObjectInputStream.BlockDataInputStream.setBlockDataMode(boolean newmode) throws IOException
Sets block data mode to the given mode (true == on, false == off) and
returns the previous mode value. If the new mode is the same as the
old mode, no action is taken. Throws IllegalStateException if block
data mode is being switched from on to off while unconsumed block data
is still present in the stream.
But in your stacktrace, the problem takes its origin from org.jboss.remoting.transport.socket.MicroSocketClientInvoker which processes deserialization on some objects.
So, you can imagine that it is hard to guess the cause of this error with just a stacktrace.
With a little luck, you could have a precise answer.
But if it is not the case, I propose you some tracks :
to update or downgrade the version of the jboss lib if possible. Maybe, it is a bug.
to run your server with breakpoints to discover the root of the problem.
to ask your question to JBoss support

GWT throws URIError repeatedly

Test case:
1.Open valid application url, for example
http://127.0.0.1:8888/rest/hosted/index?gwt.codesvr=127.0.0.1:9997#xxx:yyy
2.Change url to have some UTF-8 encoded characters, for example,
http://127.0.0.1:8888/rest/hosted/index?gwt.codesvr=127.0.0.1:9997#xxx:%u0041
As you see, it contains invalid character %u0041.
After that, GWT is throwing infinite exceptions with stacktrace
com.google.gwt.core.client.JavaScriptException: (URIError) #com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(10822), JavaScript object(10823), JavaScript object(11420)]): The URI to be decoded is not a valid encoding
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:356)
at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:662)
Why it throws repeated exceptions and how can I avoid it?
EDIT
Unfortunately I cannot show code since it seems to me that it is GWT's internal stuff. I don't code it, when I change URL in URL bar and press enter, GWT reacts all by itself. It is not feasible option, but it fails penetration tests.
EDIT 2
It appears it happens only in IE 11
GWT version - 2.6.1

Error while initializing metro webservice client

Since few weeks we have some trouble with our external test environment (which is not operated by us). Our webapplication is connected to a soap webservice.
We are using:
metro 2.1.1 for the webservice client
java-1.5.0-ibm-1.5.0.12.4 is installed on the test environment.
tomcat version: 5.5.27
The first time trying to initialize the client on this environment, we are getting the following exception (only on this environment):
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
at javax.xml.ws.Service.<init>(Service.java:57)
at com.xxx.xxx.xxx.xxxy.client.MyServiceRequestProvider_Service.<init>(MyServiceRequestProvider_Service.java:50)
at com.xxx.xxx.client.MyServiceRequester.<init>(MyServiceRequester.java:63)
at com.xxx.xxx.action.CheckAction.execute(CheckAction.java:120)
at com.xxx.xxx.webservice.validators.ApplicationValidatorImpl.validateCheck(ApplicationValidatorImpl.java:403)
at com.xxx.xxx.webservice.validators.ApplicationValidatorImpl$$EnhancerByGuice$$55e5e7ad.CGLIB$validateCheck$6(<generated>)
at com.xxx.xxx.webservice.validators.ApplicationValidatorImpl$$EnhancerByGuice$$55e5e7ad$$FastClassByGuice$$380e5720.invoke(<generated>)
at com.google.inject.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:187)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.ValidationErrorInterceptor.invoke(ValidationErrorInterceptor.java:21)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.PersistenzInterceptor.invoke(PersistenzInterceptor.java:35)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:45)
at com.xxx.xxx.webservice.validators.ApplicationValidatorImpl$$EnhancerByGuice$$55e5e7ad.validateCheck(<generated>)
at com.xxx.xxx.webservice.endpoint.xxxWS.order(xxxWS.java:99)
at com.xxx.xxx.webservice.endpoint.xxxWS$$EnhancerByGuice$$3bd5ffaf.CGLIB$order$1(<generated>)
at com.xxx.xxx.webservice.endpoint.xxxWS$$EnhancerByGuice$$3bd5ffaf$$FastClassByGuice$$806bc0a0.invoke(<generated>)
at com.google.inject.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:187)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.RsvAgeManipulatorInterceptor.invoke(RsvAgeManipulatorInterceptor.java:95)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.ValueConverterInterceptor.invoke(ValueConverterInterceptor.java:101)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.DataValidationInterceptor.invoke(DataValidationInterceptor.java:31)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.UserValidationInterceptor.invoke(UserValidationInterceptor.java:36)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.xxx.xxx.webservice.guice.interceptor.SessionInitializerInterceptor.invoke(SessionInitializerInterceptor.java:65)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
at com.google.inject.InterceptorStackCallback.intercept(InterceptorStackCallback.java:45)
at com.xxx.xxx.webservice.endpoint.xxxWS$$EnhancerByGuice$$3bd5ffaf.order(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:250)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:150)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:261)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:100)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:207)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:775)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:704)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:897)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.SecurityException: java.util.ServiceLoader - protected system package 'java.util'
at java.lang.ClassLoader.checkClassName(ClassLoader.java:213)
at java.lang.ClassLoader.defineClass(ClassLoader.java:255)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:600)
at java.net.URLClassLoader.access$400(URLClassLoader.java:124)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1055)
at java.security.AccessController.doPrivileged(AccessController.java:274)
at java.net.URLClassLoader.findClass(URLClassLoader.java:492)
at java.lang.ClassLoader.loadClass(ClassLoader.java:640)
at java.lang.ClassLoader.loadClass(ClassLoader.java:632)
at java.lang.ClassLoader.loadClass(ClassLoader.java:606)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1346)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:130)
at javax.xml.ws.spi.Provider.<clinit>(Provider.java:55)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
... 68 more
Further attempts to initialize this client results in:
2012-09-26 11:34:56,016 ERROR [TP-Processor7] com.xxx.xxx.client.MyServiceRequester#<init>(65): Error initialising MyServiceRequestProvider_Service
java.lang.NoClassDefFoundError: javax.xml.ws.spi.Provider (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at javax.xml.ws.Service.<init>(Service.java:57)
...
It seems that there are some security issues within the metro Provider class.
I think the following snipped of the class javax.xml.ws.spi.Provider of metro is the source of the failure:
static {
Method tLoadMethod = null;
Method tIteratorMethod = null;
try {
Class<?> clazz = Class.forName("java.util.ServiceLoader");
tLoadMethod = clazz.getMethod("load", Class.class);
tIteratorMethod = clazz.getMethod("iterator");
} catch(ClassNotFoundException ce) {
// Running on Java SE 5
} catch(NoSuchMethodException ne) {
// Shouldn't happen
}
loadMethod = tLoadMethod;
iteratorMethod = tIteratorMethod;
}
It seems that instead of throwing an ClassNotFoundException the Classloader throws an SecurityException, which is not catched by the
static initializer.
What can be the cause of this behaviour (some policy settings?) and how can we prevent this. The application is running on our local test environment, and was running on the external environment too. The external provider denies any changes of the environment.
Is this behaviour IBM-JDK specific ?
EDIT:
I found the following in the JDK 5.0 API class java.security.SecureClassLoader :
SecurityException - if an attempt is made to add this class to a
package that contains classes that were signed by a different set of
certificates than this class, or if the class name begins with
"java.".
But souldn't this happen to all Metro clients running on tomcat ?
EDIT:
Thanks a lot for the advice! There is actually the path of a JDK 1.6 rt.jar in the classpath. And therefore the ServiceLoader class is found but not allowed to load within the Provider.
Thanks to Sean,
There actually was the path of a JDK 1.6 rt.jar in the classpath. And therefore the ServiceLoader class is found but not allowed to load within the Provider.

Unable to execute a function using reflection

i am developing a eclipse plugin . In this plugin i am using reflection to execute a function in a class present in another project which is a hibernate project.Whenever the invoke is used i.e
mymethod.invoke(myobj);
it is giving this exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at packagesearch.DummyExecution.execution(DummyExecution.java:154)
at packagesearch.HelloWorldAction.run(HelloWorldAction.java:48)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.NoClassDefFoundError: org.dom4j.DocumentException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at test.Example.demo1(Example.java:38)
... 36 more
Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException
at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:345)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 40 more
what is the exact problem . i have used loader to load the class.Help
It means exactly what it says, it couldn't find the class org.dom4j.DocumentException. Most likely, your classpath is incorrect.
I wonder if this has anything to do with Hibernate using proxy objects to represent the persistent entities. So in essence, if you checked the class type for an entity x, you may get something like x_javassist_1334 because Hibernate wraps your object to add some persistence specific functionality. I would do a simple check and print out the classname for the object you're invoking the method on before proceeding any further.

Categories