我正在尝试使用Spring,Maven和Jetty进行集成测试.在集成测试开始使用Maven Jetty插件和运行爆炸的预集成测试目标之前,我有一台Jetty服务器开始运行我的应用程序.这适用于使用net.sourceforge.jwebunit.junit.WebTestCase进行测试.
我现在需要做的是在为集成测试启动时将"额外"bean加载到应用程序中.如果我的测试类和资源可以以某种方式与应用程序一起部署,这将很容易.有人知道一个简单的方法吗?
我希望能够"模拟"一些东西(例如发送电子邮件)和编写集成测试,这些测试不能简单地通过"前端"完成.
我尝试使用CXF,Jetty和Spring创建简单的Web服务.我创建服务接口
@WebService
public interface AnonymousService {
@WebMethod
public String getVersion();
}
Run Code Online (Sandbox Code Playgroud)
及其实施
@Service("anonymousService")
@WebService(
serviceName = "AnonymousService",
targetNamespace = "http://ws.test/",
endpointInterface = "test.ws.AnonymousService"
)
public class AnonymousServiceImpl {
public String getVersion() {
return "Version";
}
}
Run Code Online (Sandbox Code Playgroud)
下一步我添加到Spring上下文配置文件端点声明
<jaxws:endpoint id="anonymousServiceEndpoint"
implementor="#anonymousService" address="/anonymous" />
Run Code Online (Sandbox Code Playgroud)
并配置Jetty bean
<bean id="server" class="org.mortbay.jetty.Server" destroy-method="stop">
<property name="connectors">
<list>
<bean id="connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
<property name="port" value="${server.port}" />
</bean>
</list>
</property>
<property name="handlers">
<list>
<ref bean="workflowContext" />
</list>
</property>
</bean>
<bean name="workflowContext" class="org.mortbay.jetty.servlet.Context">
<property name="contextPath" value="/" />
<property name="servletHandler">
<bean …Run Code Online (Sandbox Code Playgroud) 在新的Jetty版本中,WebSocket实现分为几个子接口:
http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/websocket/WebSocket.html
为什么这样做是个好主意?
什么是这种分离的好用例?
我正在使用Jetty 9运行SolR.它工作正常.
我有以下配置:1个Web服务器(IIS),1个solr Server(Jetty).
为了优化带宽使用,我想在这两个服务器之间启用GZIP压缩.
我试着把它添加到jetty/etc/webdefault.xml:
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,application/json,image/svg+xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
2013-06-19 11:16:19.534:WARN:oejuc.AbstractLifeCycle:main: FAILED GzipFilter: javax.servlet.UnavailableException: org.eclipse.jetty.servlets.GzipFilter
javax.servlet.UnavailableException: org.eclipse.jetty.servlets.GzipFilter
at org.eclipse.jetty.servlet.Holder.doStart(Holder.java:108)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:91)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:743)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:279)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1312)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:722)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:490)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:274)
at org.eclipse.jetty.util.component.ContainerLifeCycle.addBean(ContainerLifeCycle.java:193)
at org.eclipse.jetty.util.component.ContainerLifeCycle.updateBeans(ContainerLifeCycle.java:713)
at org.eclipse.jetty.server.handler.HandlerCollection.setHandlers(HandlerCollection.java:89)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.setHandlers(ContextHandlerCollection.java:165)
at org.eclipse.jetty.server.handler.HandlerCollection.addHandler(HandlerCollection.java:155)
at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:41)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:495)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:175)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:600)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:528)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
at …Run Code Online (Sandbox Code Playgroud) 是否有任何简单的教程在Ubuntu上安装带有jetty的geoserver?谢谢.
我正在尝试配置jetty以在Apache Karaf OSGI容器中使用SSL.http有效,但https不起作用.可能是什么问题呢?
我的配置详情如下:
等/的jetty.xml
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host">
<Property name="jetty.host" />
</Set>
<Set name="port">
<Property name="jetty.port" default="8282" />
</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="KeyStore">/opt/keystore</Set>
<Set name="KeyStorePassword">password</Set>
<Set name="KeyManagerPassword">password</Set>
<Set name="TrustStore">/opt/keystore</Set>
<Set name="TrustStorePassword">password</Set>
</New>
</Arg>
<Set name="port">8443</Set>
<Set name="maxIdleTime">30000</Set>
</New>
</Arg>
Run Code Online (Sandbox Code Playgroud)
在/etc/org.ops4j.pax.web.cfg文件中输入
org.ops4j.pax.web.config.file=${karaf.home}/etc/jetty.xml
Run Code Online (Sandbox Code Playgroud) 我有一个在嵌入式jetty服务器上运行的应用程序.我已经定义了上下文路径:
ServletContextHandler context =...
context.setContextPath("/dev");
Run Code Online (Sandbox Code Playgroud)
我可以正确访问我的应用程序http://application.com:8080/dev
当我使用HttpServletResponse的sendRedirect函数时:
resp.sendRedirect("/login");
Run Code Online (Sandbox Code Playgroud)
形成的URL未使用应用程序上下文.它返回http://application.com:8080/login的insetad http://application.com:8080/dev/login
我如何解决这条道路?
这是一个非常基本的问题,但我似乎无法在任何地方找到它.有没有办法对百日咳模板进行更改,以便在进行更改后,简单的浏览器刷新将反映我的更改?
我目前正在使用jetty,并想知道这种行为是否可以复制到express + jade的行为方式.
非常感谢.
我已经根据其他解决方案进行了几处更改,但没有一个能够解决我的问题。尝试运行应用程序时出现以下错误。
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: No provider for SMTP. Failed messages: javax.mail.NoSuchProviderException: No provider for SMTP; message exceptions (1) are: Failed message 1: javax.mail.NoSuchProviderException: No provider for SMTP
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:150)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Ubuntu 16.04中安装Solr 7.0和CKAN 2.7.2。但是,出现以下错误:
从Solr管理员网站:
ckan:org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:无法为核心ckan加载conf:无法加载架构/var/solr/data/ckan/conf/schema.xml:自Solr 7开始不支持在架构中设置defaultSearchField
在启动数据库时从CKAN安装:
Solr响应错误(HTTP 404):[原因:未找到错误404]
所以我想知道CKAN是否可以支持最新版本的Solr。当前,CKAN 2.7.2可以通过Jetty8支持Solr 4.6。