0 Replies Latest reply: Apr 21, 2010 7:51 PM by Umit Gezer RSS

Problem with @XmlJavaTypeAdapter

Umit Gezer Newbie

Hi All,

 

I'm coding a set of web services and having some problems when using @XmlJavaTypeAdapter.

Here is the exception I get when I try to deploy to JBoss 5.1 and jbossmetro 3.2.2.

 

{quote}

09:09:30,571 INFO  [server] Dynamically creating request wrapper Class au.com.finsyn.acuritywebservices.services.member.jaxws.GetMemberDetails
09:09:30,571 INFO  [server] Dynamically creating response wrapper bean Class au.com.finsyn.acuritywebservices.services.member.jaxws.GetMemberDetailsResponse
09:09:30,602 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/AcurityWebServices.war/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/AcurityWebServices.war/

 

        at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
        at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.ws.WebServiceException: Failed to build METRO runtime model
        at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:134)
        at org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer.internalDeploy(WSDeploymentAspectDeployer.java:107)
        at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
        ... 24 more
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: value class au.com.finsyn.acuritywebservices.utils.MapAdapter
        at com.sun.xml.ws.model.WrapperBeanGenerator.createResponseWrapperBean(WrapperBeanGenerator.java:280)
        at com.sun.xml.ws.model.RuntimeModeler.getResponseWrapperClass(RuntimeModeler.java:304)
        at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:699)
        at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:623)
        at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:412)
        at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:251)
        at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:323)
        at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:189)
        at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
        at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parseAdapters(DeploymentDescriptorParserExt.java:295)
        at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parse(DeploymentDescriptorParserExt.java:171)
        at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:110)
        ... 27 more
Caused by: java.lang.IllegalArgumentException: value class au.com.finsyn.acuritywebservices.utils.MapAdapter
        at com.sun.xml.ws.org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:893)
        at com.sun.xml.ws.org.objectweb.asm.AnnotationWriter.visit(AnnotationWriter.java:185)
        at com.sun.xml.ws.model.WrapperBeanGenerator.createBeanImage(WrapperBeanGenerator.java:122)
        at com.sun.xml.ws.model.WrapperBeanGenerator.createResponseWrapperBean(WrapperBeanGenerator.java:276)
        ... 38 more
09:09:30,946 WARN  [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

 

*** DEPLOYMENTS IN ERROR: Name -> Error

 

vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/AcurityWebServices.war/ -> org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/AcurityWebServices.war/

 


DEPLOYMENTS IN ERROR:
  Deployment "vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/AcurityWebServices.war/" is in error due to the following reason(s): java.lang.IllegalArgumentException: value class au.com.finsyn.acuritywebservices.utils.MapAdapter

 

        at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
        at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)

 

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

{quote}

 

And below are some code snippets:

 

{code}

@WebService()
public class Member

{

    @WebMethod(operationName = "getMemberDetails")
    @XmlJavaTypeAdapter(MapAdapter.class)
    public Map<String, String> getMemberDetails(@WebParam(name = "fundCode") String MDz_Fund,
            @WebParam(name = "memberCode") String MDz_Member)
            throws AcurityWebServiceException
    {
        ...
    }

}

 

public class MapAdapter extends XmlAdapter<MapElement[], Map<String, String>>
{

 

    @Override
    public MapElement[] marshal(Map<String, String> map) throws Exception
    {
        MapElement[] mapElements = new MapElement[map.size()];

 

        int i = 0;
        for (Map.Entry<String, String> entry : map.entrySet())
        {
            mapElements[i++] = new MapElement(entry.getKey(), entry.getValue());
        }

 

        return mapElements;
    }

 

    @Override
    public Map<String, String> unmarshal(MapElement[] elementsList) throws Exception
    {
        Map<String, String> map = new HashMap<String, String>();
        for (MapElement mapelement : elementsList)
        {
            map.put(mapelement.key, mapelement.value);
        }
        return map;
    }

 

    public static class MapElement
    {

 

        @XmlElement
        public String key;
        @XmlElement
        public String value;

 

        private MapElement()
        {
        } //Required by JAXB

 

        public MapElement(String key, String value)
        {
            this.key = key;
            this.value = value;
        }
    }
}

{code}

 

 

So, what am I doing wrong? The above code works fine in glassfish. But not JBoss.

Can anyone help?