这是一个shell脚本:
echo Starting Jarvis Program D.
ALICE_HOME=.
SERVLET_LIB=lib/servlet.jar
ALICE_LIB=lib/aliceserver.jar
JS_LIB=lib/js.jar
# Set SQL_LIB to the location of your database driver.
SQL_LIB=lib/mysql_comp.jar
# These are for Jetty; you will want to change these if you are using a different http server.
HTTP_SERVER_LIBS=lib/org.mortbay.jetty.jar
PROGRAMD_CLASSPATH=$SERVLET_LIB:$ALICE_LIB:$JS_LIB:$SQL_LIB:$HTTP_SERVER_LIBS
java -classpath $PROGRAMD_CLASSPATH -Xms64m -Xmx128m org.alicebot.server.net.AliceServer $1
Run Code Online (Sandbox Code Playgroud)
在最后一行:$ 1是什么意思?
我正在使用Maven 3.0.3和Jetty插件.我收到以下错误:
java.io.FileNotFoundException:无法打开ServletContext资源[/WEB-INF/applicationContext.xml
我不明白,因为文件存在于target/mywar/WEB-INF/applicationContext.xml.我把这个文件称为web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4">
<display-name>/jx-production-1.0-SNAPSHOT</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>Any ideas what I'm missing? Here is my Jetty plugin definition in my pom.xml …
<profile>
<id>jetty</id>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.2.2.v20101205</version>
<configuration>
<webAppConfig>
<contextPath>/all-new-jx</contextPath>
<descriptor>target/jx-1.0-SNAPSHOT/WEB-INF/web.xml</descriptor>
</webAppConfig>
<jettyConfig>config/jetty7/jetty.xml</jettyConfig>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextHandlers>
<contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
<contextPath>/all-new-jx-web</contextPath>
<resourceBase>${project.basedir}/target/web</resourceBase>
<handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
</contextHandler>
</contextHandlers>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<version>7.2.2.v20101205</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
这是我得到的漫长而令人讨厌的错误:
2011-08-04 14:08:56.677:WARN ::上下文启动失败omjpJettyWebAppContext {/ all-new-jx,file:/ Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/src/main/webapp /},file:/ …
我在网上发现了类似的问题,但没有一个发布的解决方案似乎有效.
我试图在jetty下运行我的Web应用程序而不是总是在tomcat中构建和运行来测试,因为我们的构建需要18分钟.:(
这是一个drools项目,我在Eclipse Indigo SR2下运行.我试图在Jetty 6.1.26和Spring Framework 2.5.6下运行.
我已经在https://community.jboss.org/wiki/RulesTomcat的vm args部分中使用以下系统parms创建了调试配置:
-Djava.naming.factory.initial = org.mortbay.naming.InitialContextFactory -Ddrools.compiler = JANINO
这是我得到的许多类似错误之一:
2012-06-15 09:19:16.579:WARN::Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'strategyFactory' defined in ServletContext resource [/WEB-INF/conf/spring/beans.xml]: Cannot resolve reference to bean 'court' while setting bean property 'court'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'court' defined in ServletContext resource [/WEB-INF/conf/spring/beans.xml]: Cannot resolve reference to bean 'instanceConfig' while setting bean property 'config'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name …Run Code Online (Sandbox Code Playgroud) 如何重新启动grails应用程序,而不是通过执行ctrl z并再次运行它来关闭它.
当我这样做时,它说
Error Server failed to start for port 8080: Address already in use
Run Code Online (Sandbox Code Playgroud) 什么是方法调用来确定运行jetty servlet的url和端口是什么?这样我就可以在屏幕上打印它,并在客户端中使用它来连接:
url = new URL("trying to figure this out");
Run Code Online (Sandbox Code Playgroud)
我在本地运行客户端和服务器,在eclipse中,这是一个学校项目.
相关代码:
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
public class ServerMain {
public static void main(String[] args){
Server server = new Server();
ServletContextHandler context =
new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("Servlet");
context.setResourceBase("etc/docroot");
server.setHandler(context);
context.addServlet(new ServletHolder(new MyServer()), "/game");
DefaultServlet staticFileServlet = new DefaultServlet();
context.addServlet(new ServletHolder(staticFileServlet), "/*");
System.out.println("context: " + context.getContextPath());
//System.out.println("One valid Port = "
+ context.getServer().getConnectors()[0].getPort());
try {
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我使用Java中的Restlet API为iPhone/iPad设备开发了WebService .
我们的服务器是Linux CentOS,2GB RAM,14GB磁盘空间.
我正在使用Apache Tomcat 6.0.35和MySQL 5.1数据库.
例如,这些用户可能有许多并发用户说100000.
所以我的问题是Apache Tomcat和MySQL是它的最佳组合,或者我应该更改像Jetty或Glassfish或任何其他Web服务器和MySQL或其他数据库的组合?
但我担心组合的表现.
所以请指导我.
提前致谢.
Jetty身份验证体系结构使用以下4个接口:
org.eclipse.jetty.server.UserIdentity
org.eclipse.jetty.security.LoginService
org.eclipse.jetty.security.IdentityService
java.security.Principal
Run Code Online (Sandbox Code Playgroud)
有人可以解释这4个接口如何在认证流程中互相交互.
浏览代码似乎不是很有帮助,因为有很多极端情况.我对主要流程感兴趣.
我在/etc/init.d/jetty中有语法
#!/usr/bin/env bash
...
java -jar start.jar jetty.port=80 1<&- &
Run Code Online (Sandbox Code Playgroud)
你能解释一下命令末尾的重定向吗?
(顺便说一下,我的Jetty服务器在大约一天内停止响应URL请求.我可以看到它仍在执行WAR文件,因为它有一个每5分钟运行一次的作业,但是Web服务器没有响应URL请求到目前为止我可以告诉你使用Chrome开发者工具.所以我试图看看Jetty的日志)
我想处理一个第三方对我的系统执行的HTTPs请求。请求包含一个JSON对象
我尝试使用骆驼的码头组件,但是当第三方执行请求时,骆驼抛出以下异常:
org.apache.camel.RuntimeCamelException: Cannot read request parameters due Invalid parameter, expected to be a pair but was {"id":"321","rec":"533","status":"ok"}
Run Code Online (Sandbox Code Playgroud)
在蓝图中,Jetty端点定义为:
<camel:endpoint id="getRequestEndpoint" uri="jetty:{{webServiceProtocol}}://{{jettyIp}}:{{jettyPort}}/getRequest?sslContextParametersRef=sslContextParameters"/>
Run Code Online (Sandbox Code Playgroud)
我是否缺少某些东西或走在完全错误的道路上?
在更新pom.xml文件后,我试图将Jetty服务器和Servlet从9.2.2版本更新到9.3.8版本,但遇到找不到ServletContextHandler和ServletHolder之类的错误!
这是我的pom.xml
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.3.8.v20160314</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>9.3.8.v20160314</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这是我的JettyServer类
public static void start() throws Exception
{
Server server = new Server(Configuration.getInstance().getPortServer());
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
ServletHolder h = new ServletHolder(new HttpServletDispatcher());
h.setInitParameter("javax.ws.rs.Application", "de.jettyserver.Services");
context.addServlet(h, "/*");
server.setHandler(context);
server.start();
server.join();
LOGGER.debug("JettyServer started");
}
Run Code Online (Sandbox Code Playgroud)
和错误
[ERROR] /C:/..../jettyserver/JettyServer.java:[4,33] package org.eclipse.jetty.servlet does not exist
[ERROR]/C:/../jettyserver/JettyServer.java:[5,33] package org.eclipse.jetty.servlet does not exist
[ERROR] /C:/../jettyserver/JettyServer.java:[27,17] cannot find symbol symbol: class ServletContextHandler location: class de.tuberlin.snet.sonic.jettyserver.JettyServer
[ERROR] /C:/../jettyserver/JettyServer.java:[27,53] cannot find symbol symbol: class ServletContextHandler …Run Code Online (Sandbox Code Playgroud)