Я пытаюсь настроить конфигурацию Glassfish + Spring. Здесь Вы можете найти соответствующую часть моего П:Джерси + неудача развертывания Spring на Glassfish: проблема с CDI
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>${jersey.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1100-jdbc41</version>
<scope>test</scope>
</dependency>
У меня есть проблема со следующей зависимостью:
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<!--<scope>provided</scope>-->
</dependency>
Когда я указать эту зависимость, как это предусмотрено развертывание в порядке .. но контекст SPring ISN инициализирован. Если я закомментировать provided
элемент, то иногда развертывание в порядке, и приложение работает нормально, но иногда deplyment потерпит неудачу, и я буду получать следующие WELD-001408 исключение:
[2014-12-16T10:21:07.618+0100] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=34 _ThreadName=admin-listener(3)] [timeMillis: 1418721667618] [levelValue: 1000] [[
Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [IterableProvider<DefaultTopicDistributionErrorService>] with qualifiers [@Default] at injection point [[BackedAnnotatedField] @Inject private org.glassfish.hk2.internal.DefaultTopicDistributionService.errorHandlers]
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [IterableProvider<DefaultTopicDistributionErrorService>] with qualifiers [@Default] at injection point [[BackedAnnotatedField] @Inject private org.glassfish.hk2.internal.DefaultTopicDistributionService.errorHandlers]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
... 36 more
]]
Я видел много вопросов относительно этого, но я до сих пор не понимаю, как правильно идти ... Я хочу, чтобы REST API был построен с использованием Джерси с преимуществами Spring CDI (в идеале нет конфигурации xml spring).
Что я должен изменить в своем ПОМ, чтобы заставить его работать?
спасибо.
Да, я видел этот ответ в другом потоке. Обновление сервера не является вариантом. Я тестировал локально, хотя, похоже, это исправляет проблему. Наверное, сейчас я попробую обходное решение ... – Mat