erreur dans WEB-INF/web.xml, listener element
je suis en train de développer une application web.
maintenant, il m'affiche l'erreur ci dessous dans le web.xml concernant l'element <listener>
quelqu'un peut m'aider pour résoudre ce probleme!! et merci
Deploying D:\stage PFE\wildfly-10.1.0.Final\standalone\deployments\WebApplication.war
"{
\"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\\\"WebApplication.war\\\".PARSE\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"WebApplication.war\\\".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment \\\"WebApplication.war\\\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYUT0027: Failed to parse XML descriptor \\\"/D:/stage PFE/wildfly-10.1.0.Final/standalone/deployments/WebApplication.war/WEB-INF/web.xml\\\" at [110,9]
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[110,9]
Message: Unexpected element '{http://xmlns.jcp.org/xml/ns/javaee}listener' encountered\"},
\"WFLYCTL0412: Required services that are not installed:\" => [\"jboss.deployment.unit.\\\"WebApplication.war\\\".PARSE\"],
\"WFLYCTL0180: Services with missing/unavailable dependencies\" => undefined
}"
web.xml:
Code:
1 2 3 4
|
<listener>
<listener-class>test.Test</listener-class>
</listener> |
Test.java:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
public class Test implements javax.servlet.ServletContextListener{
ImageStorage storage;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
ByteArrayOutputStream transfer(File file) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
InputStream targetStream = new FileInputStream(file);
FileUtils.transfer(targetStream, baos);
} catch (IOException e) {
throw new RuntimeException(e);
}
return baos;
}
public void upload() throws NamingException {
Image image;
File path = new File("...");
for (File file : path.listFiles()) {
ByteArrayOutputStream baos = transfer(file);
byte[] content = baos.toByteArray();
DicomBean ejbDicom = (DicomBean) new InitialContext().lookup("java:comp/env/dicomBean");
ImageCache ejbCache = (ImageCache) new InitialContext().lookup("java:comp/env/imageCache");
Decoder ejbDecoder = (Decoder) new InitialContext().lookup("java:comp/env/decoder");
image = ejbDicom.writeImage(file.getName(), content);
storage.store(image.getSopInstanceUID(), content);
ejbCache.put(image.getSopInstanceUID(), content);
ejbDecoder.decode(image.getSopInstanceUID());
System.out.println("image uploaded");
}
}
public void beepForAnHour() {
final Runnable beeper = new Runnable() {
public void run() {
try {
upload();
} catch (NamingException ex) {
}
}
};
final ScheduledFuture<?> beeperHandle
= scheduler.scheduleAtFixedRate(beeper, 0, 5, MINUTES);
}
public void contextInitialized(ServletContextEvent sce) {
Test t = new Test();
t.beepForAnHour();
}
public void contextDestroyed(ServletContextEvent sce) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} |