Tôi có một tệp EAR chứa hai WAR, war1.war và war2.war. tập tin application.xml của tôi trông như thế này:Làm thế nào để bạn triển khai một WAR bên trong một EAR làm ngữ cảnh gốc (/) trong Glassfish?
<?xml version="1.0" encoding="UTF-8"?>
<application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>MyEAR</display-name>
<module>
<web>
<web-uri>war1.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<module>
<web>
<web-uri>war2.war</web-uri>
<context-root>/war2location</context-root>
</web>
</module>
</application>
Điều này dẫn đến war2.war là có sẵn trên http://localhost:8080/war2location, đó là chính xác, nhưng war1.war là trên http://localhost:8080// - lưu ý hai dấu gạch chéo.
Tôi đang làm gì sai?
Lưu ý rằng tệp SUN-web.xml của WARs bị bỏ qua khi có trong EAR.
Thật không may. http: // localhost: 8080/cho srceen chào mừng mặc định của Glassfish. Một context-root trống sử dụng tên WAR và a. chỉ đơn giản là không hoạt động. :( –