Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Java [игнор отключен] [закрыт для гостей] / Получить ресурсы / 1 сообщений из 1, страница 1 из 1
24.05.2017, 11:41
    #39458727
-=Koba=-
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Получить ресурсы
Почему не удается получить ресурсы в EJB модуле
WildFly 10

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
<jboss-deployment-structure>
	<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
	<deployment>
		<dependencies>
			<module name="by.lib" meta-inf="export" export="true"/>
		</dependencies>
		<exclude-subsystems>
			<subsystem name="logging"/>
		</exclude-subsystems>
	</deployment>
...
	<sub-deployment name="printer-1.0-SNAPSHOT.jar">
	</sub-deployment>
</jboss-deployment-structure>




Код: java
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.
@Stateless(name = "IReportData", mappedName = "ejb/ReportData")
public class ReportData implements IReportData {
...
            InputStream is1 = ReportData.class.getClassLoader().getResourceAsStream("report.properties");
            InputStream is2 = ReportResources.getInstance().getReportName("report.properties");
	    InputStream is3 = ReportResources.getInstance().getReportName("aaa.txt");
            ClassLoader classLoader = ReportData.class.getClassLoader();
            ResourceBundle resourceBundle = ResourceBundle.getBundle("report.properties", new Locale("ru", "RU"), classLoader);
...
}

public class ReportResources {
    private static ReportResources instance;

    public static ReportResources getInstance() {
        if (instance == null) {
            instance = new ReportResources();
        }
        return instance;
    }

    public InputStream getReportName(String fileName) {
        return ReportResources.class.getClassLoader().getResourceAsStream(fileName);
    }

}



Все InputStream = null ? без getClassLoader тоже пробовал
...
Рейтинг: 0 / 0
Форумы / Java [игнор отключен] [закрыт для гостей] / Получить ресурсы / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]