entity bean不能够在jboss中部署

问题描述

我使用eclipse学习实体bean的开发,按照书上一步一步的来的,没有错误,可是就是不能实现部署,想请教一下什么原因?1.persistence.xml[code=XM]<?xmlversion="1.0"encoding="UTF-8"?><persistence><persistence-unitname="myentity"><jta-data-source>java:/MySqlDS</jta-data-source><properties><propertyname="hibernate.hbm2ddl.auto"value="update"/></properties></persistence-unit></persistence>[/code]2.mysql-ds.xml[code=XM]<?xmlversion="1.0"encoding="UTF-8"standalone="no"?><datasources><local-tx-datasource><jndi-name>MySqlDS</jndi-name><connection-url>jdbc:mysql://localhost:3306/seamdemo</connection-url><driver-class>com.mysql.jdbc.Driver</driver-class><user-name>root</user-name><password>root</password><exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name><metadata><type-mapping>mySQL</type-mapping></metadata></local-tx-datasource></datasources>[/code]3.POJO(Student.class)[code=Jav]packageedu.ujs.entity;//Generated2011-2-2011:59:47byHibernateTools3.4.0.CR1importjava.io.Serializable;importjavax.persistence.Column;importjavax.persistence.Entity;importjavax.persistence.GeneratedValue;importstaticjavax.persistence.GenerationType.IDENTITY;importjavax.persistence.Id;importjavax.persistence.Table;/***Studentgeneratedbyhbm2java*/@Entity@Table(name="student",catalog="seamdemo")publicclassStudentimplementsSerializable{privateIntegerstudentId;privateStringstudentName;privateShortstudentAge;publicStudent(){}publicStudent(StringstudentName){this.studentName=studentName;}publicStudent(StringstudentName,ShortstudentAge){this.studentName=studentName;this.studentAge=studentAge;}@Id@GeneratedValue(strategy=IDENTITY)@Column(name="studentId",unique=true,nullable=false)publicIntegergetStudentId(){returnthis.studentId;}publicvoidsetStudentId(IntegerstudentId){this.studentId=studentId;}@Column(name="studentName",nullable=false,length=25)publicStringgetStudentName(){returnthis.studentName;}publicvoidsetStudentName(StringstudentName){this.studentName=studentName;}@Column(name="studentAge")publicShortgetStudentAge(){returnthis.studentAge;}publicvoidsetStudentAge(ShortstudentAge){this.studentAge=studentAge;}}[/code]4.实体bean的interface[code=Jav]packageedu.ujs.entity;publicinterfaceIStudentHome{publicabstractvoidpersist(StudenttransientInstance);publicabstractvoidremove(StudentpersistentInstance);publicabstractStudentmerge(StudentdetachedInstance);publicabstractStudentfindById(Integerid);}[/code]5.实体bean的class[code=Jav]packageedu.ujs.entity;//Generated2011-2-2011:59:48byHibernateTools3.4.0.CR1importjavax.ejb.Remote;importjavax.ejb.Stateless;importjavax.persistence.EntityManager;importjavax.persistence.PersistenceContext;importorg.apache.commons.logging.Log;importorg.apache.commons.logging.LogFactory;/***HomeobjectfordomainmodelclassStudent.*@seeedu.ujs.entity.Student*@authorHibernateTools*/@Stateless@Remote({IStudentHome.class})publicclassStudentHomeimplementsIStudentHome{privatestaticfinalLoglog=LogFactory.getLog(StudentHome.class);@PersistenceContextprivateEntityManagerentityManager;/*(non-Javadoc)*@seeedu.ujs.entity.IStudentHome#persist(edu.ujs.entity.Student)*/publicvoidpersist(StudenttransientInstance){log.debug("persistingStudentinstance");try{entityManager.persist(transientInstance);log.debug("persistsuccessful");}catch(RuntimeExceptionre){log.error("persistfailed",re);throwre;}}/*(non-Javadoc)*@seeedu.ujs.entity.IStudentHome#remove(edu.ujs.entity.Student)*/publicvoidremove(StudentpersistentInstance){log.debug("removingStudentinstance");try{entityManager.remove(persistentInstance);log.debug("removesuccessful");}catch(RuntimeExceptionre){log.error("removefailed",re);throwre;}}/*(non-Javadoc)*@seeedu.ujs.entity.IStudentHome#merge(edu.ujs.entity.Student)*/publicStudentmerge(StudentdetachedInstance){log.debug("mergingStudentinstance");try{Studentresult=entityManager.merge(detachedInstance);log.debug("mergesuccessful");returnresult;}catch(RuntimeExceptionre){log.error("mergefailed",re);throwre;}}/*(non-Javadoc)*@seeedu.ujs.entity.IStudentHome#findById(java.lang.Integer)*/publicStudentfindById(Integerid){log.debug("gettingStudentinstancewithid:"+id);try{Studentinstance=entityManager.find(Student.class,id);log.debug("getsuccessful");returninstance;}catch(RuntimeExceptionre){log.error("getfailed",re);throwre;}}}[/code]1,2应该是没有什么问题的,3,4,5我检查了好几遍,不知道问题出在哪里?

解决方案

解决方案二:
解决办法:原来我测试的时候,eclipse是可以自动部署的,不知道现在为什么不可以了,所以解决的办法就是手工部署,

时间: 2024-09-19 20:42:10

entity bean不能够在jboss中部署的相关文章

可以在web服务器jboss中部署两个项目吗?

问题描述 可以在web服务器jboss中部署两个项目吗? 如题,我有两个项目都要部署到jboss中,如果可以一个jboss中可以部署两个项目,那么怎么让这两个项目分别运行呢 解决方案 有没有大神知道 ,在线等 挺急的 解决方案二: 将web项目部署到liunx服务器上服务器部署java web项目 解决方案三: An existing resource has been found at location D:jobjboss-4.2.3.GAjboss-4.2.3.GAserverdefaul

Jboss Ejb3.0 Entity Bean

   Order.java package org.jboss.tutorial.entity.bean;   import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratorType; import javax.persistence.Id; import javax.persi

服务器-jboss 项目 部署 发布,基础问题?

问题描述 jboss 项目 部署 发布,基础问题? 本人有一台阿里云服务器,安装了 jboss-4.2.3.GA,要 部署发布一个 web 项目,服务器启动了,但是,项目 访问不了,小弟是菜鸟,求大神赐教,感激不尽-- 项目 目录 位置 如下图: oss服务器"> 服务器已经启动,http://localhost:8080/ 可以进入服务器主页 问题1:我要访问,我的项目 yaoxiao2Test,应该怎么配置? 问题2:我在网上百度了很久,没有找到 合适的学习资料或者例子,各位大侠,能否

eclipse + JBoss 5 + EJB3开发指南(7):实现Entity Bean的一对一(one-to-one)映射

本文为原创,如需转载,请注明作者和出处,谢谢! 上一篇:eclipse + JBoss 5 + EJB3开发指南(6):编写第一个实体Bean程序     一对一映射是很常用的.在一般情况下,一个主表通过外键和从表形成一对一的关系.在EJB3中使用@OneToOne注释来映射.一对一关系除了使用外键进行关联外,也可以采用共享主键的方式连接两个表.先看看如下两个表的结构: 图1  t_customers 图2  t_referees     t_customers和t_referees表形成了一对

eclipse + JBoss 5 + EJB3开发指南(9):实现Entity Bean的多对多(many-to-many)映射

本文为原创,如需转载,请注明作者和出处,谢谢! 上一篇:eclipse + JBoss 5 + EJB3开发指南(8):实现Entity Bean的一对多(one-to-many)映射     在EJB3中需要使用@ManyToMany对封装多对多关系的字段或getter方法进行注释.先看看下面的表: 图1  t_addresses表       t_addresses表和t_customers表是多对多的关系.需要使用一个关联表来描述这种关系,关联表的结构如下图所示. 图2  t_custom

JBoss中使用EJB有状态bean钝化时间设置

JBoss中使用EJB有状态bean钝化时间设置: 修改 standardjboss.xml 文件 <container-configuration> <container-name>Standard Stateful SessionBean</container-name> <call-logging>false</call-logging> <invoker-proxy-binding-name>stateful-rmi-invo

java项目在tomcat中部署正常,在jboss上部署报错

问题描述 java项目在tomcat中部署正常,在jboss上部署报错 解决方案 项目部署到Tomcat报错java项目怎样部署到tomcat中如何在tomcat 部署java 项目

jbuilder jboss-如何在jbuilder中部署jboss

问题描述 如何在jbuilder中部署jboss 如题 ! 请哪位大神给个详细点的文档 3q 然后我就不知道说啥了 不能简简单单提个问题么 还非得30个 字符

Jboss中如何在不同应用间共享类和资源

Jboss中不同应用之间如何共享类和资源:通常如果希望在Jboss不同应用之间共享类和资源,我们应将类和资源放在jboss/server/default/lib/下面,这样所有的应用可以共享资源: Jboss中如果类和和资源放在不同的war包中,却想在不同的应用间何共享WAR包中WEB-INF/classes和WEB-INF/lib中的资源,能否做到哪? 可以通过jbossweb-tomcat-55.sar/META-INF/jboss-service.xml配置文件中配置属性UseJBossW