Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy war with multiple jax-rs applications in EmbeddedPayara 4.1.152.1 #355

Closed
gudmojo opened this issue Jun 26, 2015 · 3 comments

Comments

@gudmojo
Copy link

gudmojo commented Jun 26, 2015

I have an application with two jax-rs applications. When I try to deploy the war to EmbeddedPayara, it fails with the following output:

10:32:02 SEVERE javax.enterprise.web - Error adding HttpProbes. NetworkListener https-listeners GrizzlyProxy is NULL 
10:32:02 INFO org.jboss.weld.Version - WELD-000900: SNAPSHOT 
10:32:03 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
10:32:03 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
10:32:03 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
10:32:04 WARNING org.glassfish.jersey.internal.Errors - The following warnings have been detected: WARNING: HK2 failure has been detected in a code that does not run in an active Jersey Error scope.
WARNING: Unknown HK2 failure detected:
MultiException stack 1 of 1
org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.RequestScoped

When I use embedded glassfish 4.1 it works though.

Here is the minimal code to reproduce, I have also created a full running project demonstrating the problem: https://dl.dropboxusercontent.com/u/451474/embedded-payara-multiple-jaxrs.tar.gz

@ApplicationPath("application1")
public class Application1 extends Application {
    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new HashSet<>();
        resources.add(Resource1.class);
        return resources;
    }
}

@ApplicationPath("application2")
public class Application2 extends Application {
    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new HashSet<>();
        resources.add(Resource2.class);
        return resources;
    }
}

@Path("resource1")
@Stateless
public class Resource1 {
    @GET
    public String get() {
        return "Great";
    }
}

@Path("resource2")
@Stateless
public class Resource2 {
    @GET
    public String get() {
        return "Awesome";
    }
}
@khasunuma
Copy link

beans.xml into your application project may have mistakes. Only for my environment (Eclipse 4.5 JEE/Win32_x64), its schema is not found, e.g. "http://java.sun.com/xml/ns/javaee/beans_2_0.xsd". If possible, please rewrite the beans.xml to following and try again;

<?xml version="1.0" encoding="UTF-8"?>
<beans bean-discovery-mode="annotated" 
       xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd ">

</beans>

On my environment, it works well.

@khasunuma
Copy link

Additional information; Payara 4.1.152.1 contains Jersey 2.17 as the implementation of JAX-RS. But GlassFish 4.1 (GA; Build 13) contains older version, Jersey 2.10.4. There are some improvements and many bug fixes including CDI integration between Jersey 2.10.4 and 2.17.

@smillidge
Copy link
Contributor

As @khasunuma says this is fixed by correcting the schema in the beans.xml

Running is.gudmundur1.app.TestIT
Configuring TestNG with: TestNG652Configurator
EmbeddedGlassfish: EmbeddedGlassfish.initialize()
EmbeddedGlassfish: Init glassfish
EmbeddedGlassfish: Found .war
EmbeddedGlassfish: EmbeddedGlassfish.initializeGlassfish()
Found populator: org.glassfish.kernel.embedded.EmbeddedDomainXml
12:52:41 INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.1.2.Final 
EmbeddedGlassfish: Starting embedded glassfish on http port 8007
12:52:42 WARNING javax.enterprise.resource.resourceadapter - jmsra.upgrade_check_failed 
EmbeddedGlassfish: Deploying war
12:52:45 SEVERE javax.enterprise.web - Error adding HttpProbes. NetworkListener https-listeners GrizzlyProxy is NULL 
12:52:45 INFO org.jboss.weld.Version - WELD-000900: SNAPSHOT 
12:52:45 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
12:52:45 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
12:52:45 WARN org.jboss.weld.Event - WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. 
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.334 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Pandrex247 added a commit to Pandrex247/Payara that referenced this issue May 4, 2021
…8" (payara#355)

* Revert "Merge pull request payara#349 from Pandrex247/Revert-FISH-1178"

This reverts commit 537efb1, reversing
changes made to 0ece1d5.

* Resource URL instantiation needs to be privileged action because otherwise it fails the TCK

Co-authored-by: lprimak <lenny@flowlogix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants