我正在使用JUnit进行广泛测试,有时候 - 在调试我的代码时 - 我想(临时)只运行@Test我的一个@RunWith(Arquillian.class)测试类.目前我正在添加一个@Ignore到所有其他测试,并想知道是否@IgnoreOther存在类似的东西.
是否有更好的解决方案忽略所有其他测试?
我在Eclipse IDE中使用JSF 2.0.当我尝试实现JSP和Servlet时,我收到以下错误:
java.lang.LinkageError: loader constraint violation: when resolving interface
method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()
Ljavax/el/ExpressionFactory;" the class loader (instance of
org/apache/jasper/servlet/JasperLoader) of the current class,
org/apache/jsp/exCrop_jsp, and the class loader (instance of
org/apache/catalina/loader/StandardClassLoader) for resolved class,
javax/servlet/jsp/JspApplicationContext, have different
Class objects for the type javax/el/ExpressionFactory used in the signature
at org.apache.jsp.exCrop_jsp._jspInit(exCrop_jsp.java:31)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:181)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Run Code Online (Sandbox Code Playgroud)
这是怎么造成的,我该如何解决?
我想使用(Primefaces与TwitterBootstrap).目前DropDown菜单如果p:dataTable存在,则它不起作用.我已经想通了,如果我有以下顺序,它正在工作(没有任何Primefaces组件)h:head:
<h:head>
<h:outputScript library="js" name="bootstrap.js"/>
<h:outputScript library="primefaces" name="jquery/jquery.js"/>
...
</h:head>
Run Code Online (Sandbox Code Playgroud)
如果我交换排序(首先是jquery.js,而不是bootstrap.js),DropDown菜单就会被破坏.我的问题是,在渲染的HTML输出中使用PrimeFaces组件时,PrimeFaces使用的脚本(jquery.js和primefaces.js)总是在手动输入之前h:head.
<script src="/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces"></script>
<script src="/javax.faces.resource/primefaces.js.jsf?ln=primefaces"></script>
<script src="/javax.faces.resource/bootstrap.js.jsf?ln=js"></script>
Run Code Online (Sandbox Code Playgroud)
如何导入bootstrap.js之前jquery.js?
我有一些wsimport生成的JAXB类
wsimport -d src/main/java -keep -extension
-p my.package
http://www.OpenLigaDB.de/Webservices/Sportsdata.asmx?WSDL
Run Code Online (Sandbox Code Playgroud)
我将演示这个类的问题(我自己只添加了@XmlRootElement):
package my.package;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Sport", propOrder = {"sportsID","sportsName"})
@XmlRootElement(name = "sport") //Added by myself
public class Sport
{
protected int sportsID;
protected String sportsName;
public int getSportsID() {return sportsID;}
public void setSportsID(int value) {this.sportsID = value;}
public String getSportsName() {return sportsName;}
public void setSportsName(String value) {this.sportsName = value;}
}
Run Code Online (Sandbox Code Playgroud)
直接实例化和编组工作正常(例1)
Sport sport = new Sport();
sport.setSportsID(1);
sport.setSportsName("test");
JAXBContext jc …Run Code Online (Sandbox Code Playgroud) 我想设置<consumer-window-size/>为0.这似乎是另一个问题(具有多个消费者的JMS队列)的答案,并在本文的第17.1.1节中进行了描述.我使用JNDI检索连接工厂.我hornetq-jms.xml看起来像这样:
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<connection-factory name="ConnectionFactory">
<connectors>
<connector-ref connector-name="netty-connector"/>
</connectors>
<entries>
<entry name="ConnectionFactory"/>
</entries>
<consumer-window-size>0</consumer-window-size>
</connection-factory>
<queue name="my.qeue">
<entry name="/queue/test"/>
</queue>
</configuration>
Run Code Online (Sandbox Code Playgroud)
该部分<connection-factory/>是从上面的链接复制和粘贴,但我收到错误:
DEPLOYMENTS IN ERROR:
Deployment "org.hornetq:module=JMS,name="ConnectionFactory",
type=ConnectionFactory" is in error due to the following reason(s):
HornetQException[errorCode=104 message=There is no connector with
name 'netty-connector' deployed.]
Run Code Online (Sandbox Code Playgroud)
这可能与JBoss-6相关,因为在其他环境中这似乎有效:用HornetQ强制消息顺序
我在设置现有maven项目的新计算机上遇到了严重问题.Eclipse抱怨丢失的工件数十次:
Missing artifact junit:junit:jar:4.8.2:test
Missing artifact org.slf4j:slf4j-log4j12:jar:1.5.5:compile
Missing artifact org.slf4j:slf4j-api:jar:1.5.5:compile
Missing artifact log4j:log4j:jar:1.2.14:compile
...
Run Code Online (Sandbox Code Playgroud)
下载本地存储库的文件时遇到以下消息(执行mvn compile:
Downloading: http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
Downloading: http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
....
[ERROR] ... Failed to read artifact descriptor for trove:trove:jar:2.1.1:
Could not transfer artifact trove:trove:pom:2.1.1 from/to jboss
(http://repository.jboss.org/maven2): Access denied to:
http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
Run Code Online (Sandbox Code Playgroud)
我按照http://community.jboss.org/wiki/MavenSettings的说明操作并使用公共存储库:
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>>
</repository>
Run Code Online (Sandbox Code Playgroud)
我项目中负责任的依赖是
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>6.0.0.Final</version>
<type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
似乎问题与https://issues.jboss.org/browse/JBBUILD-682有关,但由于存储库URL不太可能得到修复,我正在寻找解决方法!我没有在其他计算机上遇到此问题,但如果maven存储库被删除并将重建,则会发生此问题.
我想创建两个具有反向关系的接口.
public interface Item <D extends Description,
C extends Category<D,Item<D,C>>> {
public C getCategory();
public void setCategory(C category);}
Run Code Online (Sandbox Code Playgroud)
我不确定表达式C extends Category<D,Item<D,C>>是否正确,但至少没有编译器错误.
public interface Category<D extends Description, I extends Item> {
public List<I> getItems();
public void setItems(List<I> items);}
Run Code Online (Sandbox Code Playgroud)
I extends Item发出警告Item is a raw type. References to Item<D,C> should be parametrized.我试过了
I extends Item<D,Category<D,I>>
Run Code Online (Sandbox Code Playgroud)
但这会导致错误Bound mismatch: The type Category<D,I> is not a valid substitute for the bounded parameter <C extends Category<D,Item<D,C>>> of the type Item<D,C> …
我有一个带@Lob注释的简单EntityBean .如果我删除这个注释,我在JBossAS 6.0.0.Final和MySQL5上没有错误.但是如果我用它注释@Lob(因为mt在我的情况下包含大约100到5000个字符),如果我坚持实体,我在测试环境中会出错.
@Lob:mt映射到VARCHAR@Lob:mt映射到LONGTEXT(这是我想要的,但是我得到了错误)这是我的实体:
@Entity
@Table(name = "Description")
public class Description implements Serializable
{
public static final long serialVersionUID=1;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;
@Lob
private String mt;
} // ... getter/setter
Run Code Online (Sandbox Code Playgroud)
错误在这里:
...
Caused by: org.hibernate.exception.GenericJDBCException: could not insert
[my.Description]
...
Caused by: java.sql.SQLException: Connection is not associated with a managed
connection.org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6@3e4dd
...
Run Code Online (Sandbox Code Playgroud)
我真的不知道为什么我会得到这个(可重现的)错误.环境似乎没问题,许多其他测试都通过了,它甚至可以在没有@Lob注释的情况下工作.
这个问题与JPA有关:如何将String保存到数据库字段中,键入MYSQL Text,其中@Lob …
我必须将复合组件迁移到自定义组件.此示例相当简化,但演示了问题:我的component(my:test)的子节点需要在另一个组件中呈现.my:testC作为一个我不想使用的例子,复合材料看起来像这样
<composite:implementation>
<p:panel>
<composite:insertChildren/>
</p:panel>
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
显然,(我希望至少我这个假设是正确的),我不能简单地呈现p:panel在encodeBegin.
@FacesComponent("test")
public class Test extends UIPanel
{
@Override
public void encodeBegin(FacesContext context) throws IOException
{
// ??
}
@Override
public void encodeEnd(FacesContext context) throws IOException
{
// ??
}
}
Run Code Online (Sandbox Code Playgroud)
我希望以my:test这样的方式使用:
<my:test>
<h:outputText value="some Text"/>
</my:test>
Run Code Online (Sandbox Code Playgroud)
输出应该与使用相同my:testC:在PrimeFaces面板中呈现的一些文本.如何编码p:panelJava类的用法?
在本教程之后,我设法使用JSF2获得了Googles AppEngine的工作原型.现在我对ViewScoped ManagedBean有一些奇怪的行为:
@ManagedBean @ViewScoped
public class TestBean implements Serializable
{
private String text; //getter/setter
private List<String> texts; //getter
@PostConstruct public void init()
{
texts = new ArrayList<String>();
texts.add("Test");
text = new String();
}
public void save(ActionEvent ae)
{
texts.add(text);
text = new String();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的.xhtml页面:
<h:body id="body">
<f:view contentType="text/html">
<h:form id="frm">
<p:panel>
<h:panelGrid columns="2" id="grid">
<p:inputText value="#{testBean.text}"/>
<p:commandButton value="Add" update=":frm:op @parent"
actionListener="#{testBean.save}" />
</h:panelGrid>
</p:panel>
<p:outputPanel id="op">
<p:dataTable var="v" value="#{testBean.texts}">
<p:column><h:outputText value="#{v}" /></p:column>
</p:dataTable>
</p:outputPanel>
</h:form> …Run Code Online (Sandbox Code Playgroud)