过去的场景
- 使用Tomcat并以调试模式启动并使用Eclipse进行远程调试.
- 在此调试/远程端口中定义端口并与eclipse连接.
- 用于调试其他主机/服务器中的服务器
今天的场景
现在,我正在使用 Jetty而且我也尝试过这样做,但是没有成功,有人可以帮助我吗?
我没有使用Maven,也不想从Eclipse中启动Jetty.
环境:
Windows XP
Java V. 5
Jetty V. 6.1.15
链接:
http:// docs.codehaus.org/display/JETTY/Debugging
这对我没有帮助!
HTTP:// docs.codehaus.org/display/JETTY/Debugging+Jetty+with+Eclipse
HTTP:// neelzone.wordpress.com/2007/06/18/jetty-and-eclipse-integration
这些是启动内部的Eclipse
我在REST项目中使用Jersey,我需要使用正则表达式.
挖掘它很简单,如:
@Path("/resources")
public class MyResource {
@GET
@Path("{subResources:.*}")
public String get(@PathParam("subResources") String subResources) {...}
}
Run Code Online (Sandbox Code Playgroud)
但是,这样做,只有当我传递1个参数时,该方法才会获取请求,例如:
GET:.../resources/firstSubResource
如果我使用多于1个参数,则该方法无法获取请求,例如:
GET:.../resources/firstSubResource/seccondSubResource/thirdSubResource
如果我的@Path包含变量或文本值,我只能使用正则表达式,例如:
@Path("{SubResource1}/{subResources:.*}")
Run Code Online (Sandbox Code Playgroud)
要么
@Path("/hardCodeString/{subResources:.*}")
Run Code Online (Sandbox Code Playgroud)
今天我可以运行这个变量的解决方案,但对于我的观点来说并不是oK.
我的web.xml
(...)
<servlet>
<servlet-name>Jersey Spring Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.myproject.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Spring Web Application</servlet-name>
<url-pattern>/1.0/*</url-pattern>
</servlet-mapping>
(...)
Run Code Online (Sandbox Code Playgroud)
题
问候
我的环境
类似帖子
链接
我的问题
我的想法/研究
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="URL" value="${database.url}" />
<property name="user" value="${database.username}" />
<property name="password" value="${database.passwd}" />
<property name="connectionCachingEnabled" value="true"/>
<property name="sessionTimeZone" value="GMT-3"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
求助区:)
提前感谢任何帮助/提示/建议/知识分享
解:
我的解决方案基于此帖子收集的提示!谢谢大家!
(...)
@Override
public Connection getConnection() {
Connection conn = null;
Statement statement = null;
try {
conn = super.getConnection();
statement = conn.createStatement();
statement.execute("SET time_zone = \'" + timezone+"\'");
} …Run Code Online (Sandbox Code Playgroud) 我习惯使用Jetty作为我的web容器.
我在安装步骤中所做的是获取原始tar球并清除其中的一些目录和文件.
我想在这里提出的是:
你曾经常常从Jetty中移除什么用于生产/分期环境?
我在默认的jetty包上改变了什么:
问题:
相关文章:
让我详细解释一下我的问题,请不要停止阅读... =)
我有JPA实体,其中一些属性注释@Transient.
我应该在equals/hashCode/toString方法中使用这些属性吗?
我的第一个想法是不,但我不知道为什么.
我正在尝试在查询中设置参数,例如:
select * from Cars where Cars.color NOT IN (:color_params)
Run Code Online (Sandbox Code Playgroud)
当我在我的JavaClass中添加参数时,就像:
...
query.setParameter("color_params", "RED,BLUE");
...
Run Code Online (Sandbox Code Playgroud)
这不起作用,只使用一个参数.
我已经尝试过"'RED','BLUE'"
并且没有努力.
如果我把我的参数放在查询中,例如:
select * from Cars where Cars.color NOT IN ('RED','BLUE')
Run Code Online (Sandbox Code Playgroud)
我做错了什么!?
提前致谢
我试图从我的报告中删除一些包并遇到麻烦.
有人可以给我一些帮助吗?
我在我的蚂蚁过程中使用EMMA .
<!-- Generate the emma report both in xml and html -->
<emma>
<report
sourcepath="${build.report.src}"
metrics="class:${coverage.classes.min},method:${coverage.methods.min}">
<fileset dir="${build.report.junit.data.dir}">
<include name="*.emma"/>
</fileset>
<html outfile="${build.report.reports}/emma/raw.html" depth="method"/>
<xml outfile="${build.report.tmp}/emma.xml" depth="method"/>
</report>
</emma>
我试过用:
<filter excludes="com.my.package.*"/>
但没有成功:(
我正在尝试在我的项目中添加一个数据库/模式/ persistenceUnit,我收到错误:
No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 2
我谷歌/ api分配,无法找到为什么春天抱怨我的配置.
这是我的applicationContext.xml的一部分
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="transactionManager" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="${show.hibernate.sql}" />
<property name="generateDdl" value="false" />
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect" />
</bean>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${database.driver}" />
<property name="url" ...
<property name="testOnBorrow" value="true" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="entityManagerFactoryREST" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSourceREST" /> …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用maven,我需要在非互联网访问机器上运行构建.
当我测试我的项目构建时,一切正常,但是当我在未来的时刻运行构建时,maven会尝试更新mvn-plugins,而这个sh t*正在破坏我的构建.
我的配置文件:来自mvn的settings.xml.
<profile>
<id>blaProfile</id>
<repositories>
<repository>
<id>blaRepo</id>
<url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>blaRepo</id>
<url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfiles>
<activeProfile>blaProfile</activeProfile>
</activeProfiles>
Run Code Online (Sandbox Code Playgroud)
我用我的maven跑了params:
mvn -npu -bla.3rdParty.home="$(THE_CORRECT_PATH)" package
Run Code Online (Sandbox Code Playgroud)
我看到maven尝试更新一些mvn-plugins一段时间,但选项:
-npu,--no-plugin-updates Suppress upToDate check for any relevant
Run Code Online (Sandbox Code Playgroud)
应该适用于此更新.
那等待一些帮助!
提前致谢!
<usePluginRegistry>true</usePluginRegistry>
Run Code Online (Sandbox Code Playgroud)
在我的settings.xml中,有了这个,我将在$ {user.home} /.m2中有一个plugin-registry.xml,我可以配置并强制使用maven插件版本.
但它不起作用!:(
在我的课写toString()方法时,我总是用ToStringBuilder从org.apache.commons
当我扩展其他课程时,我会使用appendSuper()我的appends
问题:
这样做有什么不同之处:
appendSuper(super.toString())
Run Code Online (Sandbox Code Playgroud)
代替
append(super.toString())
Run Code Online (Sandbox Code Playgroud)
一种虚拟问题.
干杯
我看到存在多种方法来映射具有JPA 的复合键.
但在我的情况下有点不同:
我有一个只有2列的表:
mysql> desc mytable; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | name | varchar(80) | NO | PRI | | | | tag | varchar(80) | NO | PRI | | | +--------+-------------+------+-----+---------+-------+
我的观点是:我是否需要创建一个新的(主键类)类来映射我的复合键?
我正在努力寻找最简单的方法.
有人可以帮我吗?
提前致谢!
我正在尝试这种方法:http://www.java.net/print/236710
我正在使用一个网络项目:
- Java
- Jetty
- Fitnesse 工具
- 等等。
我很难模拟/生成 SocketTimeoutException,更多信息如下:
我们如何测试:
是一个 TDD 项目,所以我们有一堆 UT。对于“真实”测试,我们使用上面提到的工具。(健身)
“问题”:
我必须模拟服务器中可能发生的许多问题。为此,我编写了一个简单的 servlet 来模拟我的 WebServer。
但是对于这个用例,我需要在我的模拟器中模拟一个 SocketTimeoutException。我想在模拟器中休眠,但我认为这可能会导致客户端请求超时。
提前致谢