我按照http://maven.apache.org/maven-1.x/start/install.html上的文档安装了Maven 1
安装成功,然后我输入"maven site",如文档中所示maven.apache.org/maven-1.x/start/quick-start.html
我收到错误"警告:没有找到pom文件,假设默认设置!"
根据我的理解,maven 1没有pom文件.为什么它提示我没有找到pom文件?
谢谢
我有一个maven gwt项目,我正在使用ClientBundle在项目中打包我的图像资源.我想把图像/src/main/resources放在maven中,而不是src/main/java/com/mycompany/myproject/client像gwt想要的那样.
有什么办法可以实现吗?
谢谢你,萨米
我正在尝试理解maven-release-plugin(版本2.0,CVS).在释放准备工作很好.但我不明白为什么发布 - 执行不起作用?我已经测试了部署功能,我可以将工件部署到远程仓库,没有任何例外.
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.4
[INFO] check that the following section of the pom.xml is present and correct:
[INFO] <distributionManagement>
[INFO] <!-- use the following if you're not using a snapshot version. -->
[INFO] <repository>
[INFO] <id>repo</id>
[INFO] <name>Repository Name</name>
[INFO] <url>scp://host/path/to/repo</url>
[INFO] </repository>
[INFO] <!-- use the following if you ARE using a snapshot version. -->
[INFO] <snapshotRepository>
[INFO] <id>repo</id>
[INFO] <name>Repository Name</name>
[INFO] …Run Code Online (Sandbox Code Playgroud) 我有这个代码
@Column(updatable=false)
@Enumerated(EnumType.STRING)
private ExamType examType;
Run Code Online (Sandbox Code Playgroud)
但是,当我通过合并更新它时,我仍然可以更改该值.为什么?
取自这里:http://docs.jboss.org/hibernate/stable/core/reference/en/html/persistent-classes.html#persistent-classes-equalshashcode
我倾向于使用List自Criteria返回List,所以它使我的代码更清洁,因为我不必进行转换.
我这样做......
@OneToMany(cascade= {CascadeType.PERSIST, CascadeType.REMOVE}, mappedBy="parent")
@Column(name="PARENT_ID")
public List<Menu> getChildMenus() {
return childMenus;
}
Run Code Online (Sandbox Code Playgroud)
如果我在Set那里使用,在我的DAO的某个地方我将必须将返回的结果转换Criteria为Set第一个.
我不知道用List我们正在做的方式可能会产生什么影响.
我有一个使用JPA的hibernate项目.
我的persistence.xml内容如下:
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="Demo-PU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>java:/DemoDS</non-jta-data-source>
<class>com.demo.framework.entity.ReportDefinitionEntity</class>
<properties>
<!-- Database connection -->
<property name="hibernate.connection.url" value="jdbc:mysql://192.168.9.110:3306/demoDB" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<!-- Hibernate dialect -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<!-- Output goodies
-->
<property name="hibernate.query.jpaql_strict_compliance" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="false" />
<!-- Cache
-->
<property name="hibernate.jdbc.batch_versioned_data" value="true" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
</properties>
</persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)
现在当我使用eclipse运行它时我没有问题,但是当我在Jboss中部署它时,我得到以下错误:
错误[AbstractKernelController]安装到Start时出错:name = persistence.unit:unitName =#Demo-PU state =创建java.lang.ClassCastException:org.hibernate.ejb.HibernatePersistence无法强制转换为javax.persistence.spi.PersistenceProvider …
许多J2EE开发人员都知道EJB2强制他们编写"无用的"Home接口.此外,应用程序服务器之间的部署XML也不同.
所以我不知道为什么EJB2多年来一直是J2EE规范的一部分?有任何非技术性的利益吗?
这converter是从我的JSF调用的.我已在里面注册了faces-config.xml
public class ProjectConverter implements Converter{
@EJB
DocumentSBean sBean;
@ManagedProperty(value="#{logging}")
private Logging log;
public ProjectConverter(){
}
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
if(value.trim().equals("")){
return null;
}
return sBean.getProjectById(value);
}
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if(value == null){
return null;
}
return String.valueOf(((Project) value).getId());
}
}
Run Code Online (Sandbox Code Playgroud)
我遇到了java.lang.NullPointerException,当我进入时getAsObject(),主要原因是因为我的会话Bean sBean为空.我不知道如何解决这个问题,我需要访问我的Session bean,以便我可以从我的数据库中查询
我正在写一个上传和下载功能,我尝试用这两种方法写入或读取同一个文件夹,我遇到了一些问题getResourceAsStream.(该软件在glassfish上运行)
上传:方法上传到这个文件夹:/home/phamtn8/glassfishv3/glassfish/domains/domain1/applications/Documents/Documents-war_war/drawings/Liandro.jpg- >工作很棒
下载:stream =the above path
input = this.getClass().getResourceAsStream(stream); //返回null
包含这些上载和下载方法的类文件的位置位于:
/home/phamtn8/glassfishv3/glassfish/domains/domain1/applications/Documents/Documents-war_war/WEB-INF/classes/org/xdrawing/web.如果我把jpg文件放在这里,getResourceAsStream工作.
注意:this.getClass.getName()退货org.xdrawing.web.FileName
请帮忙 !!!
我刚刚开始将我的Web应用程序项目打包为WAR文件,并且遇到了Tomcat与Jetty的配置与JBoss vs Websphere等之间的差异.
我应该尝试配置一些超级智能的一体化WAR文件,还是应该创建不同的Maven配置文件来为每个应用服务器创建不同的WAR?
我不认为我应该为每个应用服务器WAR创建一个单独的Maven模块,我应该吗?
我在EJB3中有JPA的新问题我的堆栈跟踪是:
Caused by: javax.persistence.NonUniqueResultException: More than one result was returned from Query.getSingleResult()
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.throwNonUniqueResultException(EJBQueryImpl.java:1207)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:722)
at com.DAO.CartDAO.checkUserID(CartDAO.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.co
Run Code Online (Sandbox Code Playgroud)
我创建一个命令按钮用于添加项目到购物车,我写一个方法将项目添加到数据库中的购物车,我检查是否userid和itemid!= null,项目数量将添加到1,这意味着当我有用户ID 1将itemid 1添加到购物车中,我的方法将检查它是否存在,项目数量将在购物车表中添加1项目数量,我可以用一个项目做,但如果我将更多项目二添加到购物车,这意味着我添加itemid是2进入购物车表,然后我将更多数量的itemid 1添加到db中它抛出异常多个结果...我知道它不能同时有两个实例,但我不知道如何解决它?请帮我
我的addTocart方法
public void addtoCart(Items item){
this.items = item;
if(cartDAO.checkUserID(getMemberLoginController().getUser().getUserid()) != null &&
cartDAO.checkItemid(items.getItemid()) != null){
cart = cartDAO.checkUserID(getMemberLoginController().getUser().getUserid());
int …Run Code Online (Sandbox Code Playgroud) 是否有可能用nhibernate创建一个anoynmous计数?
以下查询引发异常"No column*".我当然可以添加一个列名,但我不愿意,因为如果我这样做,我将不得不查找95个表的列名...
NHibernate.Criterion.DetachedCriteria dcIsUniqueDomainname = NHibernate.Criterion.DetachedCriteria.For<nhDBapi.Tables.clsDomains>()
.SetProjection(
NHibernate.Criterion.Projections.Count("*")
)
.Add(NHibernate.Criterion.Property.ForName("DomainID").Eq(strDomainID))
.Add(NHibernate.Criterion.Property.ForName("DomainName").Eq(strDomainName)
);
Run Code Online (Sandbox Code Playgroud)