我在构建项目的jenkins上有一个构建工作,在完成后,它在远程服务器上打开一个ssh shell脚本并传输文件,然后停止并启动一个守护进程.
当我从RHEL服务器上的命令行停止并启动守护程序时,它执行得很好.当作业在jenkins中执行时,没有错误.
守护进程停止正常,它开始很好.但是在开始后不久,守护进程突然死亡.
sudo service daemonName stop
# transfer files.
sudo service daemonName start
Run Code Online (Sandbox Code Playgroud)
我确信这个问题并不存在
有谁知道Jenkins执行ssh shell脚本的方式有什么特别之处,这会导致守护程序启动不完全?
我有一个dao单元测试,声明如下:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext.xml"})
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@Transactional
public class RegisterDaoTest extends AbstractTransactionalJUnit4SpringContextTests {
ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:/spring/applicationContext.xml");
private IRegisterDao registerDao = applicationContext.getBean(IRegisterDao.class);
Run Code Online (Sandbox Code Playgroud)
当我运行单元测试时,所有通过,我可以看到在单元测试执行之间重新创建数据库.
我的测试数据库定义如下:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:test;sql.syntax_ora=true;create=true"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<jdbc:initialize-database data-source="dataSource" ignore-failures="DROPS">
<jdbc:script location="file:Artifacts/Hsql Version Scripts/install/droptables.sql" separator=";"/>
<jdbc:script location="file:Artifacts/Hsql Version Scripts/install/install.sql" separator="/;"/>
</jdbc:initialize-database>
Run Code Online (Sandbox Code Playgroud)
但是,当我将测试更改为使用@Autowired(定义如下)时,它不会执行init db脚本.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring/applicationContext.xml"})
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@Transactional
public class RegisterDaoTest extends AbstractTransactionalJUnit4SpringContextTests {
/* …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的项目设置为根据环境使用不同的虚拟主机名.
我知道我可以在每个目录中使用单独的jboss-web.xml文件创建目录.但我最近将这个项目移到了maven,并希望利用这些配置文件.我已经设置了数据库,因此可以使用过滤器通过配置文件对它们进行不同的配置.
的jboss-web.xml中:
<jboss-web>
<context-root>/</context-root>
<virtual-host>${jbossweb.virtualhost}</virtual-host>
</jboss-web>
Run Code Online (Sandbox Code Playgroud)
特定于环境的属性文件具有以下条目:
jbossweb.virtualhost=hostname.domain.com
Run Code Online (Sandbox Code Playgroud)
pom文件构建部分具有此定义
<filters>
<filter>src/main/filters/filter-${env}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
只是为了衡量,配置文件部分具有以下配置:
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
我甚至不确定我想做的事情是否可行.当我尝试它时,Jboss-web.xml在虚拟主机位置具有变量名称而不是值.
我吠叫错了树吗?
谢谢,
埃里克
我正在使用aspectJ写一个非弹簧aop方面,我正在写一个之前的建议.
在我以前的建议中,假设我想打开一个文件.所以我这样执行它:
public before(): mypointcut() {
File file = new File("myfile");
file.getCanonicalPath();
}
Run Code Online (Sandbox Code Playgroud)
但IntelliJ抱怨IOException是一个未处理的异常.如何编写之前的建议,以便它可以捕获并重新抛出异常或允许未处理的异常?
我正在尝试传递由roo为实体类自动生成的测试.当我对hsql运行测试时,它们都通过了.但是当我对Oracle运行测试时,我得到以下结果:
引起:org.apache.commons.dbcp.SQLNestedException:无法为连接URL'jdbc:localhost:1521:xe'创建类'oracle.jdbc.driver.OracleDriver'的JDBC驱动程序
我有一个oracle db local,我知道连接有效.
ojdbc14.jar文件位于JBoss 4.2.3/server/all目录的lib目录中(我们正在部署到的目录)
这是数据源bean和实体管理器工厂定义
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName" value="${database.driverClassName}"/>
<property name="url" value="${database.url}"/>
<property name="username" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="true"/>
<property name="testWhileIdle" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1800000"/>
<property name="numTestsPerEvictionRun" value="3"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
</bean><!-- Development specific configuration comes here. -->
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
<property name="persistenceUnitName" value="${hibernate.persistenceunit}"/>
<property name="dataSource" ref="dataSource"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
这是pom依赖关系定义:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
<classifier/>
</dependency>
Run Code Online (Sandbox Code Playgroud)
persistenceunit变量解析为persistenceUnitDev
这是持久性单元org.hibernate.ejb.HibernatePersistence的hibernate定义
最后我的属性文件定义了数据连接:
database.password=password
database.url=jdbc\:localhost\:1521\:xe
database.username=username
database.driverClassName=oracle.jdbc.driver.OracleDriver
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么它告诉我它无法获得合适的驱动程序.
提前致谢
我正在尝试使用IntelliJ将爆炸性战争部署到JBoss 4.2.3.用5.0.1做这个似乎没什么问题.
但是当我将服务器切换到4.2.3时,IntelliJ告诉我爆炸战争的扩展是无效的,这没什么意义,因为这是一场爆炸性的战争.它似乎期待.war文件扩展名.
似乎JBoss 4.2.3只能采用压缩的war文件,尽管我还没有找到证明它的文档.
有没有办法配置JBoss 4.2.3接受爆炸战争?