- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的设置...
<小时/>Apache Maven 3.0.4 (r1232337; 2012-01-17 08:44:56+0000)
Maven home: D:\duper\apache-maven-3.0.4
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: D:\duper\jdk1.8.0_20\jre
...
<小时/>
我们的第三方合作伙伴发布了我们需要调用的 SOAP Web 服务。
按照 spring.io 的“ Consuming a SOAP web service ”指导,我使用 spring-ws 构建了一个 Web 服务客户端。 Maven 成功构建客户端。意思是,如果我只运行 clean install
,maven 就会成功完成构建...
mvn clean install..
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:31.938s
...
<小时/>
但是,当我尝试通过 spring-boot 运行编译成功的 WS 客户端时,它崩溃了...
<小时/>mvn -e -X spring-boot:run
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 54.026s
...
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) on project recruiterTest: An exception occured while running. null: InvocationTargetException: JAXB marshalling exception
[ERROR] - with linked exception:
[ERROR] [com.sun.istack.SAXException2: unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation]
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) on project recruiterTest: An exception occured while running. null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while running. null
at org.springframework.boot.maven.RunMojo$IsolatedThreadGroup.rethrowUncaughtException(RunMojo.java:387)
at org.springframework.boot.maven.RunMojo.runWithMavenJvm(RunMojo.java:214)
at org.springframework.boot.maven.RunMojo.run(RunMojo.java:187)
at org.springframework.boot.maven.RunMojo.execute(RunMojo.java:144)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.reflect.InvocationTargetException
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:483)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.oxm.MarshallingFailureException: JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation]
at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:913)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:689)
at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:81)
at org.springframework.ws.client.core.WebServiceTemplate$2.doWithMessage(WebServiceTemplate.java:399)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:590)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
at deduper.RecruiterWSClient.getEmployee(RecruiterWSClient.java:19)
at deduper.App.main(App.java:19)
... 6 more
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:326)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:685)
... 14 more
Caused by: com.sun.istack.SAXException2: unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation
at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:252)
at com.sun.xml.bind.v2.runtime.LeafBeanInfoImpl.serializeRoot(LeafBeanInfoImpl.java:141)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:498)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
... 16 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
...
<小时/>
...这是主应用程序的源代码...
<小时/>package deduper;
import recruiter.svc.hr.*;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
public class App {
public static void main( String [] args ) {
ApplicationContext ctx = SpringApplication.run(RecruiterWSConfiguration.class, args);
RecruiterWSClient recrWSClient = ctx.getBean(RecruiterWSClient.class);
/* NOTE TO SO — we don't have access to the original source code for recruiter.svc.hr.Employee */
/* WS consumers would only see the JAXB-marshalled implementation – in their own jvm */
Employee emp = recrWSClient.getEmployee( 6345789 );
System.out.println( "[emp id = " + emp.getId( ) + " : job title = " + emp.getJobTitle( ) + " : emp name = " + emp.getEmployeeName( ) + "]" );
}
}
<小时/>
...以及一些 spring 配置的来源...
<小时/>package deduper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@Configuration
public class RecruiterWSConfiguration {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("recruiter.svc.hr");
return marshaller;
}
@Bean
public RecruiterWSClient recrWSClient (Jaxb2Marshaller marshaller) {
RecruiterWSClient client = new RecruiterWSClient();
client.setDefaultUri("http://recruitment.biz:7001/technology/EmployeeSvc?WSDL");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
<小时/>
...等等...
<小时/>package deduper;
import recruiter.svc.hr.Employee;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
public class RecruiterWSClient extends WebServiceGatewaySupport{
public RecruiterWSClient( ) { }
public Employee getEmployee( int id ) {
/* NOTE TO SO — we don't have access to the original source code for recruiter.svc.hr.Employee */
/* WS consumers would only see the JAXB-marshalled implementation – in their own jvm */
return (Employee)getWebServiceTemplate().marshalSendAndReceive( id, new SoapActionCallback( "getEmployee()") );
}
}
<小时/>
...这是 pom...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>deduper</groupId>
<artifactId>RecruiterWSTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>RecruiterWSTest Spring-WS Application</name>
<url>http://www.springframework.org/spring-ws</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
</dependencies>
<build>
<finalName>RecruiterWSTest</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::wsdl[] -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>recruiter.svc.hr</generatePackage>
<schemas>
<schema>
<url>http://recruitment.biz:7001/technology/EmployeeSvc?WSDL</url>
</schema>
</schemas>
<debug>true</debug>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
</project>
<小时/>
...哦是的。架构...
<小时/><?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. -->
<xs:schema xmlns:tns="http://recruiter/svc/hr/api/ws" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://recruiter/svc/hr/api/ws">
<xs:element name="employee" type="tns:employee"/>
<xs:element name="getEmployee" type="tns:getEmployee"/>
<xs:element name="getEmployeeResponse" type="tns:getEmployeeResponse"/>
<xs:complexType name="getEmployee">
<xs:sequence>
<xs:element name="empId" type="xs:int" form="qualified"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getEmployeeResponse">
<xs:sequence>
<xs:element name="Employee" type="tns:employee" form="qualified" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="employee">
<xs:sequence>
<xs:element name="employeeName" type="xs:string" minOccurs="0"/>
<xs:element name="jobTitle" type="xs:string" minOccurs="0"/>
<xs:element name="id" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<小时/>
...和 wsdl...
<小时/><?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://recruiter/svc/hr/api/ws" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://recruiter/svc/hr/api/ws" name="EmployeeSvc">
<types>
<xsd:schema>
<xsd:import namespace="http://recruiter/svc/hr/api/ws" schemaLocation="http://recruitment.biz:7001/technology/EmployeeSvc?xsd=1"/>
</xsd:schema>
</types>
<message name="getEmployee">
<part name="parameters" element="tns:getEmployee"/>
</message>
<message name="getEmployeeResponse">
<part name="parameters" element="tns:getEmployeeResponse"/>
</message>
<portType name="EmployeeService">
<operation name="getEmployee">
<input message="tns:getEmployee"/>
<output message="tns:getEmployeeResponse"/>
</operation>
</portType>
<binding name="EmployeeServicePortBinding" type="tns:EmployeeService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getEmployee">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="EmployeeSvc">
<port name="EmployeeServicePort" binding="tns:EmployeeServicePortBinding">
<soap:address location="http://recruitment.biz:7001/technology/EmployeeSvc"/>
</port>
</service>
</definitions>
<小时/>
我已经尝试了以下SO线程建议的一些事情[但没有成功]...
谢啦!对能够编码 JDK 提供的类型的期望是否过高?我的意思是……真的吗?
提前致谢。
最佳答案
Eureka !
我终于想到我需要将deduper.App和deduper.RecruiterWSClient更改为此...
<小时/>package deduper;
import recruiter.svc.hr.*;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
public class App {
public static void main( String [] args ) {
ApplicationContext ctx = SpringApplication.run( RecruiterWSConfiguration.class, args );
RecruiterWSClient recrWSClient = ctx.getBean( RecruiterWSClient.class );
GetEmployee empReq = new ObjectFactory( ).createGetEmployee( );
empReq.setId( 6345789 );
GetEmployeeResponse empResp = recrWSClient.getEmployee( empReq );
Employee emp = empResp.getEmployee( );
System.out.println( "[emp id = " + emp.getId( ) + " : job title = " + emp.getJobTitle( ) + " : emp name = " + emp.getEmployeeName( ) + "]" );
}
}
<小时/>
...再一次...
<小时/>package deduper;
import recruiter.svc.hr.*;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
public class RecruiterWSClient extends WebServiceGatewaySupport{
public RecruiterWSClient( ) { }
public GetEmployeeResponse getEmployee( GetEmployee empReq ) {
return (GetEmployeeResponse)getWebServiceTemplate( ).marshalSendAndReceive( empReq );
}
}
<小时/>
...等中提琴!通过上述更改,它就像一个好员工应该做的那样:)
关于java - 无法将类型 "java.lang.Integer"编码(marshal)为元素,因为它缺少 @XmlRootElement 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31226400/
我正在尝试编写一个相当多态的库。我遇到了一种更容易表现出来却很难说出来的情况。它看起来有点像这样: {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE
谁能解释一下这个表达式是如何工作的? type = type || 'any'; 这是否意味着如果类型未定义则使用“任意”? 最佳答案 如果 type 为“falsy”(即 false,或 undef
我有一个界面,在IAnimal.fs中, namespace Kingdom type IAnimal = abstract member Eat : Food -> unit 以及另一个成功
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: What is the difference between (type)value and type(va
在 C# 中,default(Nullable) 之间有区别吗? (或 default(long?) )和 default(long) ? Long只是一个例子,它可以是任何其他struct类型。 最
假设我有一个案例类: case class Foo(num: Int, str: String, bool: Boolean) 现在我还有一个简单的包装器: sealed trait Wrapper[
这个问题在这里已经有了答案: Create C# delegate type with ref parameter at runtime (1 个回答) 关闭 2 年前。 为了即时创建委托(dele
我正在尝试获取图像的 dct。一开始我遇到了错误 The function/feature is not implemented (Odd-size DCT's are not implemented
我正在尝试使用 AFNetworking 的 AFPropertyListRequestOperation,但是当我尝试下载它时,出现错误 预期的内容类型{( “应用程序/x-plist” )}, 得
我在下面收到错误。我知道这段代码的意思,但我不知道界面应该是什么样子: Element implicitly has an 'any' type because index expression is
我尝试将 SignalType 从 ReactiveCocoa 扩展为自定义 ErrorType,代码如下所示 enum MyError: ErrorType { // .. cases }
我无法在任何其他问题中找到答案。假设我有一个抽象父类(super class) Abstract0,它有两个子类 Concrete1 和 Concrete1。我希望能够在 Abstract0 中定义类
我想知道为什么这个索引没有用在 RANGE 类型中,而是用在 INDEX 中: 索引: CREATE INDEX myindex ON orders(order_date); 查询: EXPLAIN
我正在使用 RxJava,现在我尝试通过提供 lambda 来订阅可观察对象: observableProvider.stringForKey(CURRENT_DELETED_ID) .sub
我已经尝试了几乎所有解决问题的方法,其中包括。为 提供类型使用app.use(express.static('public'))还有更多,但我似乎无法为此找到解决方案。 index.js : imp
以下哪个 CSS 选择器更快? input[type="submit"] { /* styles */ } 或 [type="submit"] { /* styles */ } 只是好
我不知道这个设置有什么问题,我在 IDEA 中获得了所有注释(@Controller、@Repository、@Service),它在行号左侧显示 bean,然后转到该 bean。 这是错误: 14-
我听从了建议 registering java function as a callback in C function并且可以使用“简单”类型(例如整数和字符串)进行回调,例如: jstring j
有一些 java 类,加载到 Oracle 数据库(版本 11g)和 pl/sql 函数包装器: create or replace function getDataFromJava( in_uLis
我已经从 David Walsh 的 css 动画回调中获取代码并将其修改为 TypeScript。但是,我收到一个错误,我不知道为什么: interface IBrowserPrefix { [
我是一名优秀的程序员,十分优秀!