我正在看一个关于"使用JSF的动态web应用程序"的教程,尽管我有与导师相同的代码,但还是有问题。
我想我有几个问题。最大的问题是,我的JSF示例不能工作,如果更改代码,我总是必须重新启动eclipse。完整发布不工作
控制台输出23:18:14,562 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
23:18:14,695 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
23:18:14,747 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting
23:18:15,417 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 10) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
23:18:15,418 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 8) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
23:18:15,435 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0015: Re-attempting failed deployment JSF_Contacts.war
23:18:15,440 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found JSF_Contacts.war in deployment directory. To trigger deployment create a file called JSF_Contacts.war.dodeploy
23:18:15,455 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
23:18:15,466 INFO [org.xnio] (MSC service thread 1-4) XNIO version 3.3.1.Final
23:18:15,472 INFO [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.3.1.Final
23:18:15,501 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
23:18:15,501 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
23:18:15,502 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
23:18:15,505 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
23:18:15,512 INFO [org.jboss.as.security] (MSC service thread 1-3) WFLYSEC0001: Current PicketBox version=4.9.2.Final
23:18:15,511 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
23:18:15,514 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
23:18:15,547 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
23:18:15,547 INFO [org.jboss.as.connector] (MSC service thread 1-7) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.4.Final)
23:18:15,551 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0003: Undertow 1.2.9.Final starting
23:18:15,564 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
23:18:15,565 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting
23:18:15,571 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
23:18:15,571 INFO [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service
23:18:15,570 INFO [org.jboss.as.mail.extension] (MSC service thread 1-3) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
23:18:15,697 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path C:wildfly-9.0.1.Final/welcome-content
23:18:15,731 INFO [org.jboss.remoting] (MSC service thread 1-4) JBoss Remoting version 4.0.9.Final
23:18:15,762 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0012: Started server default-server.
23:18:15,768 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0018: Host default-host starting
23:18:15,913 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
23:18:16,034 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: Started FileSystemDeploymentService for directory C:wildfly-9.0.1.Finalstandalonedeployments
23:18:16,036 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "JSF_Contacts.war" (runtime-name: "JSF_Contacts.war")
23:18:16,190 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
23:18:16,211 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
23:18:16,223 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.serverManagement.controller.management.http: org.jboss.msc.service.StartException in service jboss.serverManagement.controller.management.http: WFLYSRV0083: Failed to start the http-interface service
at org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:269)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.net.BindException: Address already in use: bind
at org.jboss.as.domain.http.server.ManagementHttpServer.start(ManagementHttpServer.java:160)
at org.jboss.as.server.mgmt.UndertowHttpManagementService.start(UndertowHttpManagementService.java:235)
... 5 more
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:437)
at sun.nio.ch.Net.bind(Net.java:429)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:182)
at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243)
at org.jboss.as.domain.http.server.ManagementHttpServer.start(ManagementHttpServer.java:147)
... 6 more
23:18:16,339 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) WFLYWELD0003: Processing weld deployment JSF_Contacts.war
23:18:16,385 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.1.3.Final
23:18:16,520 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0006: Starting Services for CDI deployment: JSF_Contacts.war
23:18:16,540 INFO [org.jboss.weld.Version] (MSC service thread 1-8) WELD-000900: 2.2.14 (Final)
23:18:16,561 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0009: Starting weld service for deployment JSF_Contacts.war
23:18:17,198 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.unit."JSF_Contacts.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."JSF_Contacts.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type SalutationHandler with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private training.data.ContactData.salutationHandler
at training.data.ContactData.salutationHandler(ContactData.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more
23:18:17,201 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("core-service" => "management"),
("management-interface" => "http-interface")
]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.serverManagement.controller.management.http" => "org.jboss.msc.service.StartException in service jboss.serverManagement.controller.management.http: WFLYSRV0083: Failed to start the http-interface service
Caused by: java.lang.RuntimeException: java.net.BindException: Address already in use: bind
Caused by: java.net.BindException: Address already in use: bind"}}
23:18:17,202 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "JSF_Contacts.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."JSF_Contacts.war".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit."JSF_Contacts.war".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type SalutationHandler with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private training.data.ContactData.salutationHandler
at training.data.ContactData.salutationHandler(ContactData.java:0)
"}}
23:18:17,224 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "JSF_Contacts.war" (runtime-name : "JSF_Contacts.war")
23:18:17,225 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."JSF_Contacts.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."JSF_Contacts.war".WeldStartService: Failed to start service
service jboss.serverManagement.controller.management.http: org.jboss.msc.service.StartException in service jboss.serverManagement.controller.management.http: WFLYSRV0083: Failed to start the http-interface service
23:18:17,299 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0063: Http management interface is not enabled
23:18:17,300 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0054: Admin console is not enabled
23:18:17,300 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started (with errors) in 2915ms - Started 274 of 478 services (21 services failed or missing dependencies, 221 services are lazy, passive or on-demand)
23:18:17,319 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0010: Stopping weld service for deployment JSF_Contacts.war
23:18:17,336 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment JSF_Contacts.war (runtime-name: JSF_Contacts.war) in 18ms
23:18:17,367 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "JSF_Contacts.war" (runtime-name: "JSF_Contacts.war")
23:18:17,368 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.deployment.unit."JSF_Contacts.war".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator, service jboss.deployment.unit."JSF_Contacts.war".CdiValidatorFactoryService]
service jboss.deployment.unit."JSF_Contacts.war".WeldStartService (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator, service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService, service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacetTag".WeldInstantiator, service jboss.deployment.unit."JSF_Contacts.war".CdiValidatorFactoryService]
service jboss.deployment.unit."JSF_Contacts.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."com.sun.faces.config.ConfigureListener".START]
service jboss.deployment.unit."JSF_Contacts.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService, service jboss.deployment.unit."JSF_Contacts.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./JSF_Contacts]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacesServlet".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacesServlet".START]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacesServlet".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacesServlet".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacesServlet".START]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".START]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".START]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldTerminalListener".CREATE (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]
service jboss.deployment.unit."JSF_Contacts.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.deployment.unit."JSF_Contacts.war".jndiDependencyService (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START, service jboss.deployment.unit."JSF_Contacts.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START, service jboss.deployment.unit."JSF_Contacts.war".component."javax.faces.webapp.FacetTag".START, service jboss.deployment.unit."JSF_Contacts.war".component."org.jboss.weld.servlet.WeldInitialListener".START, WFLYCTL0208: ... and 3 more ]
service jboss.server.global-request-controller.control-point."JSF_Contacts.war".undertow (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.undertow.deployment.default-server.default-host./JSF_Contacts (missing) dependents: [service jboss.deployment.unit."JSF_Contacts.war".deploymentCompleteService]
service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.codec (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.session (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./JSF_Contacts.UndertowDeploymentInfoService]
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."JSF_Contacts.war".WeldStartService
service jboss.serverManagement.controller.management.http: org.jboss.msc.service.StartException in service jboss.serverManagement.controller.management.http: WFLYSRV0083: Failed to start the http-interface service
23:18:22,242 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found JSF_Contacts.war in deployment directory. To trigger deployment create a file called JSF_Contacts.war.dodeploy
ContactData.java
package training.data;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
@SuppressWarnings("serial")
@Named
@SessionScoped
public class ContactData implements Serializable {
private String firstName;
private String lastName;
private String email;
private String phone;
private String message;
private String salutation;
@Inject
private SalutationHandler salutationHandler;
@PostConstruct
private void initialize() {
salutation = salutationHandler.getSalutations().get(0);
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getSalutation() {
return salutation;
}
public void setSalutation(String salutation) {
this.salutation = salutation;
}
}
ContactsController.java
package training.data;
import javax.enterprise.context.Dependent;
import javax.inject.Named;
@Named
@Dependent
public class ContactsController {
public String showData() {
return "data";
}
public String inputData() {
return "index";
}
}
index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE-edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="css/bootstrap.css" />
<link rel="stylesheet" href="css/bootstrap-theme.css" />
</h:head>
<body>
<div class="container">
<div class="jumbotron">
<h1>Kontakt</h1>
<div>Bitte füllen Sie das Formular vollständig aus!</div>
</div>
<h:form>
<div class="form-group">
<h:outputLabel value="Andrede" for="salutation" />
<h:selecOneMenu value="#{contactData.salutation}" id="salutation"
styleClass="form-control">
<f:selectItems value="#salutationHandler.salutations" />
</h:selecOneMenu>
</div>
<div class="form-group">
<h:outputLabel value="Ihr Nachname" for="lastName" />
<h:inputText value="#{contactData.lastName}" id="lastName"
styleClass="form-control" />
</div>
<div class="form-group">
<label>Ihr Vorname</label>
<h:inputText value="#{contactData.firstName}"
styleClass="form-control" />
</div>
<div class="form-group">
<label>Ihre E-Mail</label>
<h:inputText value="#{contactData.email}" styleClass="form-control" />
</div>
<div class="form-group">
<label>Phone</label>
<h:inputText value="#{contactData.phone}" styleClass="form-control" />
</div>
<div class="form-group">
<label>Ihre Nachricht</label>
<h:inputTextarea value="#{contactData.message}" rows="7"
styleClass="form-control" />
</div>
<div class="row">
<div class="col-lg-12">
<h:commandButton action="#{contactsController.showData()}"
value="Absenden" styleClass="btn btn-success" />
</div>
</div>
</h:form>
</div>
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<标题>编辑解决方案
原因是导入错误。我必须导入
javax.ejb.Singleton;
不是javax.inject.Singleton;
标题>仔细阅读堆栈跟踪…特别是第一个跟踪和由消息引起的。您将看到:java.net.BindException: Address already in use
.
这是什么意思?这意味着在启动过程中,jboss尝试启动一个服务,这个服务需要使用一个端口,但不幸的是,在你的计算机上,这个端口已经被一些进程使用了。
根据你的评论(即"需要重新启动eclipse"),看起来这个进程可能是jboss的先前实例。看看当您停止JBoss时发生了什么……那里一定有什么问题,因为它不能正常停止(即仍然有一些正在运行,所需的端口没有释放)
JBOSS正在尝试使用您PC上已经在使用的端口。检查你的日志:" 由:java.net.BindException引起的: 地址已经在使用:bind "
检查JBOSS正在使用的端口,然后您可以检查该端口是否正在用于任何其他应用程序,它可以是JBOSS的另一个实例,但也可以是任何其他应用程序。
通常JBOSS使用8080 HTTP,但有更多的端口用于JBOSS需要的其他协议和管理,使用netstat命令你可以检查其他应用程序正在使用这些端口,例如(对于8080端口)你可以使用命令:
netstat -aon | findstr:8080
如果你想做一个快速的测试,你可以把这个参数传递给JBOSS " -Djboss.socket.binding。port-offset=2000 "这将增加JBOSS使用的所有端口到2000(或任何其他值),然后,例如,如果你的应用程序运行在"localhost:8080/your-context"现在将是"localhost:10080/your-context"