我想在JBoss上部署我的war存档,但是我收到了这个错误:
11:26:08,539 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."lab4-war.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."lab4-war.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "lab4-war.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_65]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'pro.alexfly.lab4.dao.UserDAO' for binding pro.alexfly.lab4.controller.AdminPanelController/userDAO
at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:90)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:215)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:184)
at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:152)
at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:145)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
我尝试谷歌它并在互联网上的相同错误解决方案上修复它,但我无法解决它。我越来越多地收到这个错误。
我的DAO界面:
/**
* @Author is flystyle
* Created on 05.06.16.
*/
public interface IRequestDAO {
Integer createRequest(final Request source);
List<Request> list(final Date date);
List<Request> list();
List<Request> list(final Station begin, final Station end);
Request getRequestById (final int id);
List<Request> getRequestsByUserId (final int userId);
void removeRequestById(final int id);
void removeRequestByUser(final User user);
@Deprecated
void removeAllRequests();
}
我的UserDAO课程:
@Stateless // look I have this annootation!
public class UserDAO implements IUserDAO {
private SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
public User verifyEnter(String name, String pass) {
Session session = sessionFactory.openSession();
Transaction tr = null;
tr = session.beginTransaction();
String sql = "SELECT * FROM rails_user WHERE user_name = :an AND user_pass = :ap";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(User.class);
query.setParameter("an", name);
query.setParameter("ap", pass);
User res = (User) query.uniqueResult();
tr.commit();
session.close();
return res;
}
public Admin adminEnter(String name, String pass) {
Session session = sessionFactory.openSession();
Transaction tr = null;
tr = session.beginTransaction();
String sql = "SELECT * FROM rails_admin WHERE admin_name = :an AND admin_pass = :ap";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(Admin.class);
query.setParameter("an", name);
query.setParameter("ap", pass);
Admin res = (Admin) query.uniqueResult();
tr.commit();
session.close();
return res;
}
public Integer register(String name, String surname, String pass) {
Session session = sessionFactory.openSession();
Transaction transaction = null;
transaction = session.beginTransaction();
User user = new User();
user.setName(name);
user.setSurname(surname);
user.setPass(pass);
Integer id = (Integer) session.save(user);
transaction.commit();
session.close();
return id;
}
public List getAllUsers() {
Session session = sessionFactory.openSession();
Transaction tr = null;
tr = session.beginTransaction();
String sql = "SELECT * FROM rails_user";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(User.class);
List res = query.list();
tr.commit();
session.close();
return res;
}
public User getUserById(int id) {
Session session = sessionFactory.openSession();
Transaction tr = null;
tr = session.beginTransaction();
String sql = "SELECT * FROM rails_user WHERE user_id = :id";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(User.class);
query.setParameter("id", id);
User res = (User) query.uniqueResult();
tr.commit();
session.close();
return res;
}
public void banUser(int id) {
Session session = sessionFactory.openSession();
SQLQuery q = session.createSQLQuery("DELETE FROM rails_user WHERE request_id = :id");
q.addEntity(User.class);
q.setParameter("id", id);
q.executeUpdate();
}
public boolean verifyAdminEnter(String name, String pass) {
Session session = sessionFactory.openSession();
Transaction tr = null;
tr = session.beginTransaction();
String sql = "SELECT * FROM rails_admin WHERE admin_name = :an AND admin_pass = :ap";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(Admin.class);
query.setParameter("an", name);
query.setParameter("ap", pass);
Admin res = (Admin) query.uniqueResult();
tr.commit();
session.close();
if (res.getName().equals(name) && res.getPass().equals(pass))
return true;
return false;
}
}
我的管理控制器类:
@ManagedBean(name = "rails_admin_panel")
@SessionScoped
public class AdminPanelController implements AdminAction{
private List<User> allUsers;
private List<Request> allRequests;
@EJB
private UserDAO userDAO = new UserDAO();
@EJB
private RequestDAO requestDAO = new RequestDAO();
public void viewAllUsers() {
allUsers = userDAO.getAllUsers();
}
public void viewAllRequests() {
allRequests = requestDAO.list();
}
public void deleteRequest(int id) {
requestDAO.removeRequestById(id);
}
public void deleteUser(int id) {
userDAO.banUser(id);
}
public List<Request> getAllRequests() {
return allRequests;
}
public List<User> getAllUsers() {
return allUsers;
}
}
你能帮助我吗?
P.S。 War Packaging
答案 0 :(得分:3)
在启动期间,应用服务器无法找到接口pro.alexfly.lab4.dao.UserDAO
,因为您没有。解决它:
IUserDAO
:@EJB private UserDAO userDAO = new UserDAO();
@Local
注释。