maven + jetty + spring 3.2
My jetty infomation:
2013-03-08 20:16:23.541:INFO:oejs.Server:main: jetty-9.0.0.RC2
2013-03-08 20:16:26.590:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
[DEBUG][2013-03-08 20:16:35,801]->org.eclipse.jetty.util.log [Logging to org.slf4j.impl.Log4jLoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog]
2013-03-08 20:16:35.848:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
2013-03-08 20:16:36.743:INFO:/:main: Initializing Spring FrameworkServlet 'app-servlet'
Jetty can't find the transaction manager but I have already configured it in my spring application-context(app-servlet.xml):
<!-- 使用注解方式管理事务 -->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 配置事务管理 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
And it says "No Spring WebApplicationInitializer types detected on classpath", I have also configured "app-servlet.xml" in web.xml:
<!-- spring mvc的dispatcherServlet负责转发请求 -->
<servlet>
<servlet-name>app-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<!-- spring context文件 -->
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:/spring/**/app-*.xml
</param-value>
</init-param>
<!-- 服务启动的时候第一个将此servlet初始化加载,非零的时候,数字越小,优先级越高 -->
<load-on-startup>1</load-on-startup>
</servlet>
My pom.xml:
<!-- jetty -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.0.RC2</version>
</plugin>
Why did jetty warn me like that? How can I eliminate these abnormal infomation?
Thank for answer these two questions.
As already noted, the message from jetty about "No transaction manager" is purely informational and can be ignored (you're using a transaction manager that is only known to spring).
As for the other message "No Spring WebApplicationInitializer types detected on classpath" that seems to be a purely informational message from Spring - if you've got a servlet 3.0 webapp and you're using spring 3.2 then the SpringServletContainerInitializer class will be called when your webapp starts up, and it looks for implementations of Spring's WebApplicationInitializer interface on the classpath. Presumably you don't have any, as I've tested jetty-9.0.0.RC2 and jetty-9.0.0 final with spring 3.2 and any such initializers are properly discovered.
regards
Jan
The informational message about Transaction Managers ...
2013-03-08 20:16:26.590:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
Occurs because you do not have a XA Transaction Manager declared in JNDI.
Typical configuration for this is in the /WEB-INF/jetty-env.xml or on a server side using a Deployment Context Descriptor.
As for the other error message from Spring, that's a bit more messy to solve.
Related
It`s my first project with CXF and Web Services,using Tomcat as a servlet container and my first question in StackOverflow too,so be patient with me....;-)
I'm using :
Tomcat 9 (standalone and integrated with Eclipse).
CXF (3.2.0)
JDK 1.8
Windows 7
**The problem:**WS-SecurityPolicy not enabled/ not working in the server side.
WS-SecurityPolicy is implemented in the wsdl file of the web service and the policy seems working fine,because in the client side the SOAP output message body is signed.
The problem I'm stuck is in the server side,none of the policies are applied in response.
The first issue I had was with the SOAP header "must understand=1",the server does not recognize the security headers and throws an exception.
My suspect was that the web service is not applying the policy,then to avoid the exception of the header I put a handler that does nothing whith it.
Now the server response the SOAP message but in clear form (unsigned, without the BinarySecurityTolen and other stuff),my suspect was true,the policy is not working.
I think the porblem is a misconfiguration of CXF files...
The cxf bean configuration of the web service is loaded during Tomcat's startup.
INFO: Creating Service {http://ole/wsTransaccion}WsTransaccionService from WSDL: wsdl/wsTransaccion.wsdl
....
....
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/cxf-wsTransaccion.xml]
The cxf-wsTransaccion.xml file contains:
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<bean id="myPasswordCallback"
class="implementacion.ServerKeystorePasswordCallback" />
<jaxws:endpoint xmlns:tns="http://ole/wsTransaccion" id="wsTransaccion"
implementor="implementacion.WsTransaccionImpl"
wsdlLocation="wsdl/wsTransaccion,wsdl" endpointName="tns:WsTransaccionPort"
serviceName="tns:WsTransaccionService" address="/WsTransaccionPort">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:properties>
<entry key="security.callback-handler">
<ref bean="myPasswordCallback"/>
</entry>
<entry key="security.encryption.properties" value="keystore.properties"/>
<entry key="security.signature.properties" value="keystore.properties"/>
<entry key="ws-security.encryption.username" value="useReqSigCert"/>
</jaxws:properties>
</jaxws:endpoint>
I think the problem coluld be in the location of the file keystore.properties, although no exception is thrown (like a java.io.FileNotFoundException) if not exists..
All examples I saw were Maven's projects ,but this is NOT A MAVEN project so I haven't the folder "resources" where properties files and keystore are placed.
I don't know the right place of keystore.properties, i think must be in the classpath ,then i put it in a package named resources with the keystore together.
The content of keystore.properties:
>org.apache.wss4j.crypto.provider=org.apache.ws.security.components.crypto.Merlin
>org.apache.wss4j.crypto.merlin.keystore.file=server.p12
>org.apache.wss4j.crypto.merlin.keystore.type=PKCS12
>org.apache.wss4j.crypto.merlin.keystore.alias=server
>org.apache.wss4j.crypto.merlin.keystore.password=xxxxxx<br/>
Other possibility is that org.apache.wss4j.crypto.merlin.keystore.file=server.p12 is not in the right place too, although is in the same place like keystore.properties
Any suggestion would be very appreciated.
Thanks very much!!!.
The problem was here:
Tomcat console:
"WARNING: Resource classpath:./resources/policyBinding.xml was not found in the classloaders."Although policyBinding.xml is in the classpath is not properly loaded due to the following annotation in the interface of the web service:
#Policy(uri = "./resources policyBinding.xml",placement=Policy.Placement.DEFAULT)
Thank you to Alfredo (WS-Security Policy node not being generated in Apache CXF with Spring and custom context file
) i figured it out the right syntax:
#Policy(uri = "classpath:policyBinding.xml",placement=Policy.Placement.DEFAULT)
We have an ear application, that contains some WS endpoints. I have to deploy to the target server but I have to override the WSDL soap-address tag. The solution we use our local testbed is following this instruction: https://stackoverflow.com/a/23491951 That works perfectly. (server is wildfly 8.2)
However we cannot use this solution anymore on production server ("just because").
I found, that there is a jboss-webservices.xml, that should override the wsdl's <soap-address> tag without changing the standalone.xml / domain.xml's webservices subsystem settings.
But it is not working for me. My jboss-webservices.xml:
<?xml version="1.1" encoding="UTF-8"?>
<webservices version="1.2"
xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_webservices_1_0.xsd">
<property>
<name>wsdl.soapAddress.rewrite.modify-wsdl-address</name>
<value>true</value>
</property>
<property>
<name>wsdl.soapAddress.rewrite.wsdl-host</name>
<value>somedomain.com</value>
</property>
</webservices>
These instructions are followed:
https://docs.jboss.org/author/display/JBWS/Published+WSDL+customization
https://docs.jboss.org/author/display/JBWS/Advanced+User+Guide
I place jboss-webservices.xml both two places referred by the documentation:
META-INF/jboss-webservices.xml for EJB webservice deployments
WEB-INF/jboss-webservices.xml for POJO webservice deployments and EJB webservice endpoints bundled in war archives
Non of them works.
The related log snippet:
11:50:43,502 INFO [org.jboss.ws.cxf.metadata] (MSC service thread 1-2) JBWS024061: Adding service endpoint metadata: id=ABCServicePortType
address=http://localhost:8180/abc-web/ABCServicePortType
implementor=example.service.v1.impl.ABCServicePortTypeImpl
serviceName={http://example.com/ns/mod/ws/ABCService/v1}ABCService
portName={http://example.com/ns/mod/ws/ABCService/v1}ABCServicePortTypeImplPort
annotationWsdlLocation=null
wsdlLocationOverride=null
mtomEnabled=false
My questions: May I miss something? Is there any other way to override soap-address?
Thanks in advance.
The properties that you provided in jboss-webservices.xml works but with a higher version of WildFly than you are using in your server (since WildFly 9). See webservices section of release notes for WildFly 9:
http://wildfly.org/news/2015/07/02/WildFly9-Final-Released/
It looks that before WildFly 9 release standalone.xml is the only one place to customize WSDL generation.
I'm trying to deploy our EGL-based webservice project on Websphere Application Server Liberty Profile V8.5.
The webservices are calling EGL-Generated cobol programs that are located on another server.
Also, we need a JDBC connection to the database located on the iSeries (Power7)
I have added this coding in server.xml:
<dataSource id="db2iToolbox" jndiName="jdbc/db2iToolbox">
<jdbcDriver libraryRef="DB2iToolboxLib"/>
<properties.db2.i.toolbox databaseName="databaseforEGL" serverName="iseriesserver"/>
</dataSource>
<library id="DB2iToolboxLib">
<fileset dir="C:\jars" includes="jt400.jar"/>
</library>
This is the error thrown when the call-statement gets executed:
EGL0010E An external dependency is missing. The following exception occurred.
Exception: java.lang.NoClassDefFoundError:
com.ibm.as400.access.ErrorCompletingRequestException
EGL0002I The error occurred in LoginLib processing the login function.
I'm assuming the jt400.jar doesn't get loaded.
Also tried the default fileset dir:
<fileset dir="/QIBM/ProdData/Http/Public/jt400/lib" />
source:
http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/twlp_dep_configuring_ds.html
The application needs to be configured to use a common library reference so it has visibility to the same class:
<application ...>
<classloader commonLibraryRef="DB2iToolbackLib"/>
</application>
I cant get my Webservice published, it should be simple:
I create the app in the IIS,
place it as a 4.0 Classic .Net
I publish it from .Net Solution within VS2012 Right click and publish
on the Webservice project.
The files are placed and it should show by itself on the browser on the URL of the server specified.
But I stumbled upon the following problems:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
So I've looked for It and found this two options:
Option 1:
http://www.banmanpro.com/support2/Requested_Content_Appears_to_be_Script.asp
This one says I should go to Integrated, instead of Classic App Pool. but it's like if I changed a problem for another because now it says:
HTTP Error 500.21 - Internal Server Error
Handler "WebServiceHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
When I go to the web config see what is this error talking about I see no handler tag!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings />
<connectionStrings />
<system.web>
<compilation targetFramework="4.0" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
</system.web>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
</configuration>
Should I add one? If so, how?
Option 2:
Script not served by static file handler on IIS7.5
Basically it says I shoud do a aspnet_regiis -i, but when I try
going to %windir%\Microsoft.NET\Framework\v4.0.30319
Even when the folder exists, There is no aspnet_regiis!!
I've only found the aspnet_regiis on the 2.0 Fwk =(
Is that normal?
The handler tag wasn't the answer, however, both options drove me to look for the missing aspnet_regiis of fwk 4.
There was no aspnet_regiis because the full fwk 4.0 wasn't actually installed on a first place.
I had installed on the server the Framework 4 Client Profile and the debugger, which isn't the full version. From now on, whenever I think I have fwk 4 installed, I'll check twice.
After installing it, on Framework 4.0 Classic Pipeline Mode (instead of Integrated) made it work just fine.
But Attention!
After installing the framework, IIS will change the default pipeline to 4.0, that means, if you had ongoing a web(site/service) on 2.0 it will automatically stop working. (It happened to me)
I want to use spring web-scoped beans in web-service written on AXIS2 framework.
How to configure it?
Axis2 and Spring documentation disagree with each other.
Axis2 documentation says:
For the purpose of this example, we'll configure Spring via a WAR file's web.xml. Let's add a context-param and a listener:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
Spring documentation says:
When using a Servlet 2.4+ web container, with requests processed outside of Spring's DispatcherServlet (e.g. when using JSF or Struts), you need to add the following javax.servlet.ServletRequestListener to the declarations in your web application's 'web.xml' file.
<web-app>
...
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
...
</web-app>
When I use Axis2-recommended ContextLoaderListener with Spring web-scoped beans I got on deploy
java.lang.IllegalStateException: No thread-bound request found: Are
you referring to request attributes outside of an actual web request,
or processing a request outside of the originally receiving thread? If
you are actually operating within a web request and still receive this
message, your code is probably running outside of
DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current
request.
When I use Spring-recommeded RequestContextListener I got running Web-service with fault on requests:
<faultstring>The SERVICE_OBJECT_SUPPLIER parameter is not specified.</faultstring>
In other words: how to configure AXIS2 with Spring and RequestContextListener?
No such functionality in AXIS2. See request https://issues.apache.org/jira/browse/AXIS2-5467 "Extend Spring support to accept web-scoped beans" for detail.