I'm using Inout and Out parameters in the ServiceEndPointInterface(SEI).
Here is the method signature.
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.WebParam.Mode;
import javax.jws.Oneway;
import javax.xml.rpc.holders.*;
#WebMethod
#Oneway
public #WebResult void TestDomainCls( #WebParam (mode=Mode.INOUT) IntegerWrapperHolder inpuInt );
And I have implemented this method in the EJBBean. And I have exposed this EJBBean as a webservice using annotation.
While deploying this EAR in JBOSS 5.,it's throwing the error like
Caused by: java.lang.IllegalStateException:
Cannot synchronize to any of these methods:
public abstract java.lang.String MURCOMP.MURCOMP_SEI.serv_20_search1(java.lang.String,javax.xml.rpc.holders.StringHolder)
OperationMetaData:
qname={http://MURCOMP/}serv_20_search1
javaName=serv_20_search1
style=rpc/literal
oneWay=false
soapAction=
ParameterMetaData:
xmlName=arg0
partName=arg0
xmlType={http://www.w3.org/2001/XMLSchema}string
javaType=java.lang.String
mode=IN
inHeader=false
index=0
ParameterMetaData:
xmlName=arg1
partName=arg1
xmlType={http://www.w3.org/2001/XMLSchema}anyType
javaType=java.lang.Object
mode=OUT
inHeader=false
index=1
ReturnMetaData:
xmlName=return
partName=return
xmlType={http://www.w3.org/2001/XMLSchema}string
javaType=java.lang.String
mode=OUT
inHeader=false
index=-1
at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:559)
at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:543)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitialize(EndpointMetaData.java:533)
at org.jboss.ws.metadata.umdm.ServiceMetaData.eagerInitialize(ServiceMetaData.java:433)
at org.jboss.ws.metadata.umdm.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:194)
at org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect.start(EagerInitializeDeploymentAspect.java:48)
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129)
at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:76)
at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60)
at org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB.internalDeploy(WebServiceDeployerEJB.java:113)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
... 30 more
17:40:12,483 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
This error is coming only if I'm using inout or out parameters in my method.
Can anyone suggest me.,where I'm going wrong or Is there anything missing with respect to INOUT and OUT parameters in Web Services
enter code here
I have got the solution.,I have used javax.xml.ws.Holder instead of the javax.xml.rpc.holders.
The code is as follows
#WebMethod
public #WebResult String testINout(#WebParam Holder holder);
But I didnt got the actual solution, why if I use javax.xml.rpc.holders such exception has occured. Anyway the alternate way I found to work on..
Related
I'm trying to implement a custom endpoint in a Spring Boot application.
Goal is to use routes as: from("...").process("...").to("my:...");
Now, I have 3 classes: a DefaultConsumer, a DefaultEndpoint, a DefaultComponent:
package com.my.endpoint;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.support.DefaultEndpoint;
public class MyEndpoint extends DefaultEndpoint {
public MyEndpoint(String uri, MyComponent myComponent) {
}
...
}
package com.my.endpoint;
import org.apache.camel.Endpoint;
import org.apache.camel.Processor;
import org.apache.camel.support.DefaultConsumer;
public class MyConsumer extends DefaultConsumer {
public MyConsumer(Endpoint endpoint, Processor processor) {
super(endpoint, processor);
}
}
package com.my.endpoint;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
import java.util.Map;
#Component("my")
public class MyComponent extends DefaultComponent {
public MyComponent(CamelContext camelContext) {
super(camelContext);
}
...
}
Now: how can I register?
In a Spring configuration class, I have:
#Override
public void configure() throws Exception {
camelContext.addComponent("my", new MyComponent(camelContext));
But is not working:
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: my, please check your classpath contains the needed Camel component jar.
So, I added the META-INF file in services/org/apache/camel/component/my:
class=com.my.endpoint.MyComponent
But also this, is not working.
There is no complete tutorial on how to implement this.
Any help?
Note: I'm trying to implement an Endpoint because I need to integrate my systems using my data types. I tried using Transformer but failed because of this: Set a custom DataType in Apache Camel Processor
Before, I tried using data type converter, but failed because of this (marked duplicate because people are too lazy to really understand questions): Enforce type conversion on Rest consumer in Apache Camel
I've FULLY read "Apache Camel In Action, Second Edition" but, at the moment, I can't continue with my project because of?
This is because custom component must be annotated by #UriEndpoint annotation.
Another way to solve this problem: Set EndpointUri via Constructor or by implementing createEndpointUri() in MyEndpoint.
So easiest way might be changing your constructor to:
public MyEndpoint(String uri, MyComponent myComponent) {
super(uri, myComponent);
}
Currently, if I access to non-defined path on my play framework application, default "Action Not Found page" appears.
I tried to make custom "Action Not Found page" in order not to show system information on browser.
I checked the page.
https://www.playframework.com/documentation/2.4.x/JavaErrorHandling
And I implemented the following code.
package controllers;
import play.Logger;
import play.http.HttpErrorHandler;
import play.mvc.*;
import play.mvc.Http.*;
import play.libs.F.*;
import views.html.*;
public class ErrorHandler implements HttpErrorHandler {
public Promise<Result> onClientError(RequestHeader request, int statusCode, String message) {
Logger.debug("onClientError");
return Promise.<Result> pure(
Results.badRequest(error.render())
);
}
public Promise<Result> onServerError(RequestHeader request, Throwable exception) {
Logger.debug("onServerError");
return Promise.<Result> pure(
Results.internalServerError("A server error occurred: " + exception.getMessage())
);
}
}
However error.scala.html isn't shown and default "Action Not Found page" appears.
Logger.debug also wasn't called.
I found same question for Scala, but there isn't any answer.
How to handle "Action not found" with Dependency Injection Play framework 2.4
Could you give me any advice?
I solved this problem by myself!
I noticed that I should add ErrorHandler.java to default package or add to another package and write its class path to application.conf like this.
play.http.errorHandler = "com.example.ErrorHandler"
Thank you for your support!
I am using play 2.2.1 and trying to implement Page for 404 requests.
For that I have created a errorPage.scala.html in my views and created a Global class inside MyProject->app->controller
Global.java (Source)
import play.*;
import play.mvc.*;
import play.mvc.Http.*;
import play.libs.F.*;
import static play.mvc.Results.*;
public class Global extends GlobalSettings {
public Promise<SimpleResult> onHandlerNotFound(RequestHeader request) {
return Promise.<SimpleResult>pure(notFound(
views.html.errorPage.render(request.uri())
));
}
}
But Its not working.When I am entering the wrong url it shows action not found page and display my routes file in browser.
Is there anything I am missing?
I have been trying other stack threds also but din't get any solution.
Thanks
Your Global class needs to be at the root package, i.e. within app and not wihtin the controller package. The link you posted documents that in the second sentence:
Defining a Global object in your project allows you to handle global
settings for your application. This object must be defined in the root package.
I am getting following error in jsp page for file upload code:
The method parseRequest(RequestContext) in the type FileUploadBase is not applicable for the arguments (HttpServletRequest)
error in the code:
List<FileItem> items = uploadHandler.parseRequest(request);
The parseRequest(RequestContext ctx) expects RequestContext instance as argument but the argument passed is instance of HttpServletRequest
Use ServletRequestContext to create a RequestContext instance as follows.
List<FileItem> items
= uploadHandler.parseRequest(new ServletRequestContext(request));
I had same problem, then found my imports were wrong: the last one of them was using fileupload from sun, not from commons.fileupload. After I changed them all to commons.fileupload, the error disappeared:
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.servlet.ServletRequestContext;
great answers above, but if you are upgrading to tomcat10 which naming change from javax to jakarta, commons-fileupload as of version 1.4 has not change the naming yet, but you can change to the custom class in tomcat10 instead! (LUCKY ME)
org.apache.commons.fileupload.ProgressListener to org.apache.tomcat.util.http.fileupload.ProgressListener
org.apache.commons.fileupload.servlet.ServletFileUpload to org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload
org.apache.commons.fileupload.disk.DiskFileItemFactory to org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory
org.apache.commons.fileupload.FileItem to org.apache.tomcat.util.http.fileupload.FileItem
I am having issues with parsing the xml response got from the service at http://wiki.dbpedia.org/Lookup
My code for the main is the one up here, toghether with annotated beans that build up the xml.
I'd like to 'debug' what's going on in the JAXBContext, so that I can see what I messed up in the annotated beans. The only thing I found it is possible is to register an EventHandler like this:
unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
that prints errors like these:
uri http://lookup.dbpedia.org/api/search.asmx/KeywordSearch?QueryString=galway&MaxHits=5
DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://lookup.dbpedia.org/", local:"Result"). Expected elements are <{}Result>
Location: line 3
It seems there is an unexpected element Result, but I can't manage to fix it.
Can someone guide me in understanding the JAXB errors more in depth? I really can't figure out what the errors really mean (as I already have set up namespace = "http://wiki.dbpedia.org/Lookup" in the ArrayOfResult class).
You have the namespace information specified on ArrayOfResult but not on Result:
package it.cybion.dbpedia.textsearch.rest.response;
import java.net.URI;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(name = "Result", namespace="http://lookup.dbpedia.org/")
#XmlAccessorType(XmlAccessType.FIELD)
public class Result {
}