[OPENPTK-330] Limit use of WebApplicationException Created: 14/Mar/12  Updated: 08/May/12  Resolved: 24/Mar/12

Status: Closed
Project: openptk
Component/s: Server
Affects Version/s: 2.0, 2.1
Fix Version/s: 2.1

Type: Improvement Priority: Major
Reporter: Scott Fehrman Assignee: Scott Fehrman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: jax-rs, jersey, server

 Description   

Enhance the Resource code to handle exceptions with appropriate HTTP 400/500 Response instead of throwing WebApplicationException, where possible.



 Comments   
Comment by Scott Fehrman [ 24/Mar/12 ]

Implemented solution. The use of WebApplicationException is limited to the constructor method for Resource.java. All other "run time" exceptions (EngineException) are caught and an Internal Server Error (500) is sent back to the client.

Comment by Terry Sigle [ 08/May/12 ]

Confirmed with a code review of the org.openptk.jaxrs.Resource.java and child classes to confirm that the WebApplicationException is being thrown properly and/or an INTERNAL_SERVER_ERROR is being used properly.





[JERSEY-2243] Using Sse with Jersey in OSGi Created: 22/Nov/13  Updated: 25/Nov/13  Resolved: 25/Nov/13

Status: Resolved
Project: jersey
Component/s: media, osgi
Affects Version/s: 2.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: lifedj Assignee: Michal Gajdos
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7, Eclipse Kepler


Tags: JAX-RS, Jersey, OSGi, SSe

 Description   

I'm trying to implement a simple Java Sse server using Jersey on OSGi.
I've followed the example described in the Jersey official guide:

https://jersey.java.net/documentation/latest/sse.html#d0e8183

but when I try to call the server, it says: "MessageBodyWriter not found for media type=text/event-stream, type=class org.glassfish.jersey.media.sse.OutboundEvent, genericType=class org.glassfish.jersey.media.sse.OutboundEvent."

I've found some other similar issues in which all say to register SSE feature, but in OSGi there is not a main in which I can register it, and, moreover, the SseFeature doesn't provide any service!
How can i register the sse feature? Or: what can I do to fix the problem?

PS. To work in OSGi, Jersey need the connector:
https://github.com/hstaudacher/osgi-jax-rs-connector

Here I will paste the code you should need to help me!

MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RestServerSSE
Bundle-SymbolicName: it.prova.sse
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.ws.rs;version="2.0.0",
 javax.ws.rs.core;version="2.0.0",
 javax.ws.rs.ext;version="2.0.0",
 org.glassfish.jersey.media.sse;version="2.0.0",
 org.glassfish.jersey.message;version="2.0.0",
 org.glassfish.jersey.server;version="2.0.0",
 org.osgi.framework;version="1.7.0"
Service-Component: OSGI-INF/component.xml

component.xml

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="it.prova.sse">
   <implementation class="it.prova.sse.Server"/>
   <service>
      <provide interface="it.prova.sse.Server"/>
   </service>
</scr:component>

Server.java

package it.polito.server.rest.sse;
import java.io.IOException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.glassfish.jersey.media.sse.EventOutput;
import org.glassfish.jersey.media.sse.OutboundEvent;
import org.glassfish.jersey.media.sse.SseFeature;
import org.glassfish.jersey.server.ResourceConfig;

@Path("/sse")
public class Server
{
public Server()
{
    final ResourceConfig resourceConfig = new ResourceConfig(Server.class,SseFeature.class);
}
	
  @GET
    @Produces(SseFeature.SERVER_SENT_EVENTS)
      public EventOutput getServerSentEvents() {
		
        final EventOutput eventOutput = new EventOutput();
        new Thread(new Runnable() {
          @Override
            public void run() {
               try {
               for (int i = 0; i < 10; i++) {
               // ... code that waits 1 second
               final OutboundEvent.Builder eventBuilder
               = new OutboundEvent.Builder();
               eventBuilder.name("message-to-client");
                  eventBuilder.data(String.class,
                      "Hello world " + i + "!");
                      final OutboundEvent event = eventBuilder.build();
                      eventOutput.write(event);
                  }
               } catch (IOException e) {
                  throw new RuntimeException(
                      "Error when writing the event.", e);
               } finally {
                  try {
                      eventOutput.close();
                  } catch (IOException ioClose) {
                      throw new RuntimeException(
                          "Error when closing the event output.", ioClose);
                  }
              }
           }
        }).start();
        return eventOutput;
    }
}


 Comments   
Comment by Michal Gajdos [ 25/Nov/13 ]

This is not a bug. You're configuring wrong ResourceConfig. You should configure the one that is used during deployment time and not the one that you create in a resource (please consult documentation to osgi connector how to do that).





[JERSEY-2158] Jersey ignores @ApplicationPath annotation Created: 20/Oct/13  Updated: 23/Oct/13  Resolved: 23/Oct/13

Status: Resolved
Project: jersey
Component/s: containers
Affects Version/s: 2.3.1
Fix Version/s: 2.4

Type: Bug Priority: Critical
Reporter: abhi0123 Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS X 10.8.5, Apple Java 1.6.0_51, Jersey 2.3.1, Maven Jetty Plugin 8.1.13.v20130916, Servlet 2.5


Tags: ApplicationPath, jax-rs, jersey-server, web-xml

 Description   

I've 2 Application classes annotated with @ApplicationPath, both configured in web.xml as shown below. Jersey ignores the @ApplicationPath annotations for some reason. Using those paths in the request URL throws 404.
I believe the problem should be apparent from the code snippets; however, if you still need deployable code, I can provide that.

RestfulAdage.java
@ApplicationPath("/resourcesA")
public class RestfulAdage extends Application {
	@Override
	public Set<Class<?>> getClasses() {
		Set<Class<?>> set = new HashSet<Class<?>>();
		set.add(Adages.class);
		return set;
	}
}
RestfulPrediction.java
@ApplicationPath("/resourcesP")
public class RestfulPrediction extends Application {
	@Override
	public Set<Class<?>> getClasses() {
		Set<Class<?>> set = new HashSet<Class<?>>();
		set.add(PredictionsRS.class);
		return set;
	}
}
 
<web-app 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/web-app_2_5.xsd"
	version="2.5">
	<display-name>Java Web Services: Up and Running, 2e, chapter 2,
		practice code</display-name>

	<servlet>
		<servlet-name>JerseyWebApplication</servlet-name>
		<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
		<init-param>
			<param-name>jersey.config.server.provider.packages</param-name>
			<param-value>adages;predictions3</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>JerseyWebApplication</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
</web-app>


 Comments   
Comment by Marek Potociar [ 23/Oct/13 ]

You cannot have 2 applications deployed on a same servlet. You need separate servlets for both apps. Closing as invalid.





[JERSEY-1883] @PostConstruct method called twice on @Singleton Created: 10/May/13  Updated: 12/Feb/15  Resolved: 12/Feb/15

Status: Resolved
Project: jersey
Component/s: containers
Affects Version/s: 2.0-rc2
Fix Version/s: 2.17

Type: Bug Priority: Major
Reporter: agksmehx Assignee: Jakub Podlesak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 3 hours
Time Spent: 2 hours
Original Estimate: 3 hours
Environment:

Glassfish 4.0-b87, Oracle JDK 7 64-bit, Eclipse Kepler m6, Linux Fedora 18 64-bit


Attachments: File 1883.diff    
Tags: ejb-container, jax-rs, jersey-server

 Description   

Originally reported as: https://java.net/jira/browse/GLASSFISH-20505

I am running a simple .war file under Glassfish 4.0-b87 that was created in Eclipse Kepler M6 using M2E as a simple project with Dynamic Web Module facet added, using Oracle Java 7 JDK/JVM.

There is essentially a single class for which I expect the @PostConstruct void post_construct () method to be called exactly once. But it is called twice, first when the app is deployed, and one more time on the first and only the first HTTP request.

Here is the class (the log output follows). It should print "hello world" only once but in the log it can be seen twice.

package com.example.main;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.LocalBean;
import javax.ejb.PostActivate;
import javax.ejb.PrePassivate;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.inject.spi.PassivationCapable;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Application;

@Singleton
@Startup
@LocalBean
@ApplicationPath("/rest")
@Path("/life")
public class Life extends Application implements PassivationCapable {

@PostConstruct
public void post_construct () { System.out.println("hello world!"); }

@PreDestroy
public void pre_destroy () { System.out.println("so long and thanks for the fish!"); }

@PrePassivate
public void pre_passivate () { System.out.println("taking a break"); }

@PostActivate
public void post_activate () { System.out.println("back from break"); }

@Override
public String getId () { return "life"; }

@GET
public String greet () { return "hi"; }
}

The log output is as follows with a dashed line separating the part before the first HTTP call and the part after the HTTP call:

[2013-05-09T19:42:26.660-1000] [glassfish 4.0] [INFO] [NCLS-DEPLOYMENT-00027] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546660] [levelValue: 800] [[
Selecting file /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/singleton.war for autodeployment]]

[2013-05-09T19:42:26.692-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546692] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.702-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546702] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.706-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546706] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.709-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546709] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.749-1000] [glassfish 4.0] [INFO] [ejb.portable_jndi_names] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546749] [levelValue: 800] [[
EJB5181:Portable JNDI names for EJB Life: [java:global/singleton/Life, java:global/singleton/Life!com.example.main.Life]]]

[2013-05-09T19:42:26.959-1000] [glassfish 4.0] [WARNING] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546959] [levelValue: 900] [[
WELD-001473 javax.enterprise.inject.spi.Bean implementation org.glassfish.jms.injection.JMSCDIExtension$LocalBean@cbcbf4a declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.]]

[2013-05-09T19:42:26.970-1000] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=59 _ThreadName=Thread-3] [timeMillis: 1368164546970] [levelValue: 800] [[
hello world!]]

[2013-05-09T19:42:26.982-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546982] [levelValue: 800] [[
Registering the Jersey servlet application, named com.example.main.Life, at the servlet mapping /rest/*, with the Application class of the same name.]]

[2013-05-09T19:42:26.988-1000] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546988] [levelValue: 800] [[
Loading application [singleton] at [/singleton]]]

[2013-05-09T19:42:27.003-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164547003] [levelValue: 800] [[
singleton was successfully deployed in 332 milliseconds.]]

[2013-05-09T19:42:27.006-1000] [glassfish 4.0] [INFO] [NCLS-DEPLOYMENT-00035] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164547006] [levelValue: 800] [[
[AutoDeploy] Successfully autodeployed : /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/singleton.war.]]

----------------------------- AFTER FIRST HTTP CALL -----------------------------

[2013-05-09T19:42:44.940-1000] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=21 _ThreadName=Thread-3] [timeMillis: 1368164564940] [levelValue: 800] [[
hello world!]]

[2013-05-09T19:42:44.940-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.server.ApplicationHandler] [tid: _ThreadID=21 _ThreadName=http-listener-1(4)] [timeMillis: 1368164564940] [levelValue: 800] [[
Initiating Jersey application, version Jersey: 2.0-rc2 2013-04-23 12:04:25...]]

[2013-05-09T19:42:44.956-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.gf.ejb.EjbComponentProvider] [tid: _ThreadID=21 _ThreadName=http-listener-1(4)] [timeMillis: 1368164564956] [levelValue: 800] [[
The Jersey EJB interceptor is bound. JAX-RS EJB integration support is enabled.]]


 Comments   
Comment by agksmehx [ 10/May/13 ]

Note Jersey in stack trace for creating second singleton. I got a stack trace of the second singleton creation by making it throw an error if a static boolean was found initialized to true

java.lang.Error: second singleton
at com.example.Life.post_construct(Life.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1010)
at org.jvnet.hk2.internal.Utilities.justPostConstruct(Utilities.java:735)
at org.jvnet.hk2.internal.ServiceLocatorImpl.postConstruct(ServiceLocatorImpl.java:818)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:864)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:855)
at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:293)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:272)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Comment by agksmehx [ 10/May/13 ]

Essentially the @Singleton annotation is not playing well the @ApplicationPath + "extends Application" part. When I created a separate class for @ApplicationPath + "extends Application" and left the @Singleton + @Path together, things seemed fine (although I don't know whether Jersey would create more singletons under load).

What does the standard say about putting @Application, @Singleton, @Path all on the same class?

Comment by Marek Potociar [ 18/Jul/13 ]

Assigning to Jakub - is this still valid issue?

Comment by Libor Kramolis [ 21/Jan/14 ]

Issue is still valid and it also 'works' with common javax.inject.Singleton. No need to use EJB to reproduce the bug.

Comment by Libor Kramolis [ 04/Feb/14 ]

Reproducible test case diff attached.





[JERSEY-1160] Initialize SecurityContext for client-authenticated SSL connection Created: 16/May/12  Updated: 21/Aug/12  Resolved: 21/Aug/12

Status: Resolved
Project: jersey
Component/s: containers
Affects Version/s: 1.12
Fix Version/s: 2.0-m07

Type: Improvement Priority: Major
Reporter: CLarrieu Assignee: Pavel Bucek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JERSEY-1282 SecurityContext injection does not work Resolved
Tags: container, grizzly, jax-rs, jersey, jersey-grizzly2, security, ssl

 Description   

Please modify GrizzlyContainer to initialize the ContainerRequest's SecurityContext with client identity from the SSL layer if available before handing it off to the WebApplication.

I am using jersey-grizzly2 to implement a RESTful interface for my service. Having configured the Grizzly layer to require client authentication, I find there's no straight-forward (or even round-about) way to access that information at the Jersey level.

Here's an example solution implemented in GrizzlyContainer._service():

            final ContainerRequest cRequest = new ContainerRequest(_application,
                    request.getMethod().getMethodString(), baseUri, requestUri,
                    getHeaders(request), request.getInputStream());
            
// === begin new code ===
            SSLEngine ssl = SSLUtils.getSSLEngine(request.getContext().getConnection());
            if (ssl != null) {
            	try {
            		final Principal p = ssl.getSession().getPeerPrincipal();
            		cRequest.setSecurityContext(new SecurityContext() {
            			@Override
            			public Principal getUserPrincipal() {
            				return p;
            			}
            			@Override
            			public boolean isUserInRole(String role) {
            				return false;
            			}
            			@Override
            			public boolean isSecure() {
            				return true;
            			}
            			@Override
            			public String getAuthenticationScheme() {
            				return SecurityContext.CLIENT_CERT_AUTH;
            			}
            		});
            	} 
            	catch(SSLPeerUnverifiedException ex) {
            		// no client certs
            	}
            }
// === end new code ===
 
            _application.handleRequest(cRequest, new Writer(response));


 Comments   
Comment by Pavel Bucek [ 02/Jul/12 ]

there should be a workaround (not tested):

you should be able to inject (into @Context annotated method param for example) Grizzly request and basically do what you are doing in proposed patch.

Comment by CLarrieu [ 02/Jul/12 ]

I developed a work-around that depends upon a single thread of execution from Grizzly filter chain up through the jersey level. Here's how I describe it in my code:

/**

  • This is part of a nasty hack that is needed to propagate the SSL-provided client
  • identity up from the Grizzly layer to the Jersey level.
  • The client identity is extracted from the Grizzly Request object and stored in a thread-local
  • variable for retrieval when filter() is run after the Jersey ContainerRequest has been
  • created but before the resource method has been invoked.
  • The only guarantee that both tasks will occur in the same thread is that the source code
  • for the current version (1.12) operates this way.
  • Hopefully the jersey-grizzly2 project will accept my patch (http://java.net/jira/browse/JERSEY-1160)
  • to make this hack unnecessary.
  • @author larrieu
    *
    */
Comment by Pavel Bucek [ 21/Aug/12 ]

already fixed in Jersey 2.x.





[JAX_RS_SPEC-117] Consider introducing ActiveLinks and turning Links into plain beans Created: 09/Jul/11  Updated: 18/Jun/13  Resolved: 06/Sep/11

Status: Resolved
Project: jax-rs-spec
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 2.0

Type: Improvement Priority: Major
Reporter: beryozkin_sergey Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: jax-rs, link

 Description   

Currently Link class is an active entity which effectively acts as a client.

I'd like to propose splitting Link into two parts:

  • base Link class which will only encapsulate the metadata and properties about target URI
  • ActiveLink extends Link and has setters as well as invocation factory methods

Thus:

  • Client.link factory methods would return ActiveLink
  • Client.request(Link) would also be introduced

I've concerned about Link being overloaded with the client-like capabilities.

Having original Client and multiple Links acting independently consuming the same or different endpoints
is interesting. However,a number of considerations may need to be taken into account:

  • fluent style code involving Links may not be very robust - no Link may even exist in the current payload and perhaps, more often than not some analysis have to be done on a current Link before acting.
  • I guess security considerations are also there

I think that Link->ActiveLink split will also work well in cases where Link needs to be passed around without expecting intermediate handlers to be involved.



 Comments   
Comment by Marek Potociar [ 06/Sep/11 ]

The client API Link was renamed to Target. In context of this issue it represents an "active link". New core.Link POJO was introduced to encapsulate the link information.





Interceptors (JAX_RS_SPEC-57)

[JAX_RS_SPEC-93] Create proposal to incorporate interceptors in JAX-RS 2.0 Created: 11/May/11  Updated: 18/Jun/13  Due: 25/May/11  Resolved: 06/Jun/11

Status: Closed
Project: jax-rs-spec
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0

Type: Sub-task Priority: Major
Reporter: Santiago Pericas-Geertsen Assignee: Santiago Pericas-Geertsen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: interceptors, jax-rs

 Description   

Initial task to create a proposal for interceptors. Related work is in EJB (as a separate spec), CDI (including binding) and Resteasy (http://docs.jboss.org/resteasy/docs/1.1.GA/userguide/html/Interceptors.html).



 Comments   
Comment by Santiago Pericas-Geertsen [ 06/Jun/11 ]

Proposal has been submitted for review. See http://java.net/projects/jax-rs-spec/pages/InterceptorsAndFilters





[JAX_RS_SPEC-72] Standardization of ResourceContext / Solution for Integration of manually created, stateful sub resources Created: 07/Apr/11  Updated: 18/Jun/13  Resolved: 24/Aug/12

Status: Resolved
Project: jax-rs-spec
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0

Type: New Feature Priority: Critical
Reporter: abien Assignee: Marek Potociar
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAX_RS_SPEC-35 provide a way to allow dependency inj... Closed
Related
is related to JAX_RS_SPEC-55 Support for JSR-330 annotations and CDI In Progress
is related to JAX_RS_SPEC-35 provide a way to allow dependency inj... Closed
is related to JERSEY-1087 Provide equivalent of ResourceContext... Resolved
is related to JAX_RS_SPEC-58 Make it easier to use EJBs as sub-res... Open
Sub-Tasks:
Key
Summary
Type
Status
Assignee
JAX_RS_SPEC-253 Document new ResourceContext API in t... Sub-task Resolved Santiago Pericas-Geertsen  
Tags: cdi, ejb, javaee, jax-rs

 Description   

Sub resources are created inside the root resource using the "new" operator. CDI Dependency injection just cannot work in this case.

The problem: access to Session Beans / CDI managed beans is only possible with a "lookup".

Jersey uses a proprietary extension to to "manage" a custom created class:

import com.sun.jersey.api.core.ResourceContext;

 @Context
  protected ResourceContext resourceContext;


 @Path("{customerId}/")
    public CustomerResource getCustomerResource(@PathParam("customerId")
    Integer id) {
        CustomerResource resource = resourceContext.getResource(CustomerResource.class);
        resource.setId(id);
        return resource;
    }

[from NetBeans 7 Samples Java Web Services -> REST: CustomerDB Java EE 5]

A ResourceContext should create and integrate the resource as a CDI managed bean. JAX-RS, as well as CDI injection should work in this case.

Essential: the path param @PathParam("customerId") should be directly accessible in the sub-resource via field-injection.

It means:

public class CustomerResource {

  @PathParam("customerId")
   protected Integer id;
}


 Comments   
Comment by Marek Potociar [ 07/Dec/11 ]

A couple of clarifying questions:

  • What would be the suggested default scope of the sub-resources created by the context?
  • Who should be the "owner" of the created sub-resource instances? JAX-RS runtime or CDI?

Let me also provide my take:

  • Instantiated sub-resources should live in the (JAX-RS) request scope.
  • Owner should be JAX-RS runtime.
Comment by abien [ 15/Apr/12 ]

> A couple of clarifying questions:
>
> * What would be the suggested default scope of the sub-resources created by the context?

Dependent scope. The scope would depend on the scope of the main resource.

> * Who should be the "owner" of the created sub-resource instances? JAX-RS runtime or CDI?

It depends what the main resource is. In case it is a @Stateless, then EJB, CDI managed bean, then CDI. JAX-RS then JAX-RS.

>
> Let me also provide my take:
>
> * Instantiated sub-resources should live in the (JAX-RS) request scope.
> * Owner should be JAX-RS runtime.

o.k. But: usually in my projects (what is not representative) JAX-RS resources are in most cases @Stateless EJBs in Java EE deployments.
>
>
>

Comment by Marek Potociar [ 24/Aug/12 ]

All right. So I still think that the default scope should be request, provided the sub-resource is managed by JAX-RS runtime. For all sub-resources managed by another container (EJB, CDI...) the default scope would be as defined by the managing container. Obviously any explicitly specified scope would override the defaults.

Comment by Marek Potociar [ 24/Aug/12 ]

Introduced ResourceContext API. See: http://java.net/projects/jax-rs-spec/sources/git/revision/d6a07ec69f2f0bae5c93f641247a0a493434f52b

Comment by patriot1burke [ 28/Aug/12 ]

From a CDI perspective, I'm against this idea as there is already sufficient APIs in CDI:

#1 CDI's BeanManager interface provides this functionality already
#2 The Sub-resource locator itself could be an injected CDI bean.
#3 Components needed by the sub-resource locator could be injected into the parent and passed in via a constructor or setter methods

BUT...

Resteasy does have something similar to access JAX-RS @Context injected things programmatically.

Comment by Marek Potociar [ 31/Aug/12 ]

Please note that the duplicate issue has a larger scope than CDI or EJB injection. As such evaluate the issue in this larger context.





[JAX_RS_SPEC-71] Alignment of "Convention over Configuration" / "Configuration By Exception" with other Java EE 6 APIs Created: 07/Apr/11  Updated: 15/Oct/14

Status: Open
Project: jax-rs-spec
Component/s: None
Affects Version/s: 1.1
Fix Version/s: 2.1

Type: New Feature Priority: Major
Reporter: abien Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by JAX_RS_SPEC-34 it would be nice if @PathParam @FormP... Resolved
is duplicated by JAX_RS_SPEC-59 Convention over configuration Resolved
Related
is related to JAX_RS_SPEC-18 @HttpMethod should guess value if omi... Open
Tags: CoC, ConventionOverConfiguration, JAX-RS, REST, javaee

 Description   

JAX-RS 2.0 should behave (Configuration by Exception / Convention over Configuration) like JPA 2 / EJB 3.2 / CDI APIs:

1. The value of the @Path annotation should be derived from class / method name respectively
2. The default MediaType for @Consumes / @Produces should be MediaType.TEXT_PLAIN
3. There is no need for the specification of @Consumes / @Produces in case 2.
4. A single method (regardless of its name) in a resource / sub resource should be defaulted to a @GET request.
5... [TBD]

But: HTTP methods (@GET, @POST, @PUT ...) must not be automatically derived from method names.

See also: JAX_RS_SPEC-59



 Comments   
Comment by Marek Potociar [ 07/Feb/13 ]

Ad 1. The value of the @Path annotation should be derived from class / method name respectively

This is a good suggestion. However, there's a lot to agree upon yet:

  1. we need to agree on the method for deriving path value from the Java artifacts. My suggestion would be to use "camel-case to all lower-case, dash separated", e.g. BookStore -> book-store, customerAddress() -> customer-address. This approach produces URIs in a canonical form that is very readable and supports applying generic redirection filters that detect non-canonical URIs and canonicalize them (e.g. upper-case letters in URI, see for instance www.stackoverflow.com).
  2. we need to agree what to do with common prefixes and suffixes (Resource, get(), post*. My current suggestion would be to strip them out, but we need to come up with a complete set.
  3. etc.

Ad 2, 3. The default MediaType for @Consumes / @Produces should be MediaType.TEXT_PLAIN

There is a default value specified already and it would be BW incompatible to change it. I suggest we do not proceed with the proposed CoC in this area.

Ad 4. A single method (regardless of its name) in a resource / sub resource should be defaulted to a @GET request.

I'm a bit afraid of loosing some readability, but we may want to start experimenting with this in our implementations and see how users react to that. If the experiment proves to be successful, we may proceed with standardizing.

Comment by Marek Potociar [ 07/Feb/13 ]

Deferring for future release.





[HK2-95] Provide HK2 injectable constructor selection algorithm that meets JSR299, JSR330 and JAX-RS requirements. Created: 01/Nov/12  Updated: 06/Dec/13  Resolved: 06/Dec/13

Status: Resolved
Project: hk2
Component/s: None
Affects Version/s: 2.1.*
Fix Version/s: 2.1.*

Type: New Feature Priority: Critical
Reporter: Marek Potociar Assignee: jwells
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: cdi, jax-rs, jersey

 Description   

JAX-RS spec says:

If more than one public constructor is suitable then an implementation MUST use the one with the most parameters. Choosing amongst suitable constructors with the same number of parameters is implementation specific, implementations SHOULD generate a warning about such ambiguity.

JSR330 says:

Injectable constructors are annotated with @Inject and accept zero or more dependencies as arguments. @Inject can apply to at most one constructor per class.

Proposed solution:

  • If @Inject-annotated constructor exists, use that one
    • if more @Inject-annotated constructors exist, fail
  • If there's no @Inject-annotated constructor, then:
    • find all other injectable constructors (including no-arg or default constructors) and select the one with most parameters
      • if there are more constructors with most parameters, select first one and log warning.


 Comments   
Comment by jwells [ 07/Jan/13 ]

Unfortunately section 3.1.3 of CDI specifies:

If the managed bean does not have a constructor that takes no parameters, it must have a constructor annotated @Inject.
No additional special annotations are required.

Unfortunately, the CDI specification (JSR 299) and the JAX-RS specification seem to be at odds on this issue.

I wonder if we need to make this about the constructor being public. Like, if there is a PUBLIC zero-arg constructor, we use it (which would satisfy 299) and if not then we use the PUBLIC constructor with the greatest number of arguments, which would kind of satisfy JAX-RS.

Of course, we will then run into the situation where a class has two constructors:

public class Foo {
public Foo() {
}

public Foo(Bar bar) {
}
}

The trouble is that now HK2 can't pick. It will either be CDI-style happy (pick the zero-arg constructor) or JAX-RS happy (pick the one-arg constructor). Do we need to add a field or something to the descriptor saying how it should resolve this conflict?

Comment by jwells [ 30/Jan/13 ]

This has been fixed by adding a new service called "ClassAnalyzer" that allows descriptors to choose how to analyze a class for its constructors, initializer methods, fields to be injected, post-construct method and pre-destroy method.

The default ClassAnalyzer chooses the 299 approach (prefers the zero-arg constructor). However, we have also supplied a "prefers the constructor with the most parameters" choice as well, which can be used by using the ServiceLocatorUtilities.addPreferLargestConstructorClassAnalyzer. To be clear, JAX-RS descriptors should therefor have a ClassAnalyzer name of ServiceLocatorUtilities.PREFER_LARGEST_CONSTRUCTOR. (The ClassAnalyzer name can be set on a Descriptor).

Among other parts of the solution:

The @Service annotation now also takes an "analyzer" field which allows descriptors to choose their analyzer with an annotation.

We will update GlassFish to call the addPreferLargestConstructorClassAnalyzer so that it can be used.





[GLASSFISH-20794] GF4: Non-working injection of JAX-RS resoures into CDI interceptors Created: 04/Sep/13  Updated: 04/Apr/14

Status: Open
Project: glassfish
Component/s: jax-rs
Affects Version/s: 4.0_b89_RC5
Fix Version/s: None

Type: Bug Priority: Major
Reporter: replicant77 Assignee: Jakub Podlesak
Resolution: Unresolved Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win 7 Pro 64Bit
GlassFish Server Open Source Edition 4.0 (build 89)
jdk1.7.0_21


Attachments: Zip Archive GLASSFISH-20794.zip    
Tags: cdi, glassfish4, interceptor, jax-rs, jersey

 Description   

We are currently evaluating glassfish 4 for migration of our enterprise projects from glassfish 3.1.2.2. We are making heavy use of interceptors for our jax-rs based rest services. In glassfish 3.1.2 injection of jax-rs based resources (e.g. @Context private HttpHeaders headers) into those interceptors worked fine. But with GF4 this doesn't work anymore.
Ways to reproduce:


@RequestScoped
@Path("test")
@Test
public class TestService {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String greet()

{ return "Hello World"; }

}

@Test
@Interceptor
public class TestInterceptor {
@Context
private HttpHeaders headers;

@AroundInvoke
public Object intercept(InvocationContext ic) throws Exception

{ System.out.println("httpHeaders: " + headers); return ic.proceed(); }

}

@Inherited
@InterceptorBinding
@Target(

{ ElementType.METHOD, ElementType.TYPE }

)
@Retention(RetentionPolicy.RUNTIME)
public @interface Test {
}

beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
<interceptors>
<class>TestInterceptor</class>
</interceptors>
</beans>

On GF3.1.2 the output is something like:
INFO: httpHeaders: com.sun.jersey.spi.container.ContainerRequest@4e7cb67f

On GF4:
INFO: httpHeaders: null



 Comments   
Comment by obfischer [ 05/Sep/13 ]

Did you try to update to CDI 1.1? I also had CDI related issues when migrating my application to GF 4. It was needed to to update all beans.xml to CDI 1.1. At the end I ended with updating to GF 4.0.1-SNAPSHOT.

Comment by replicant77 [ 05/Sep/13 ]

I followed your advice and updated the beans.xml in the example (see below). But the problem stays the same: HttpHeaders stays null.


<?xml version="1.0" encoding="UTF-8"?>
<beans 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"
version="1.1" bean-discovery-mode="all">
<interceptors>
<class>TestInterceptor</class>
</interceptors>
</beans>

Comment by replicant77 [ 05/Sep/13 ]

Note: i was still using 4.0_b89_RC5 for the updated beans.xml

Comment by TangYong [ 10/Sep/13 ]

I made an attachment based on the issue's description, and the issue can be re-produced using 4.0.1-b02.

[Steps]
1 mvn install
2 asadmin deploy ...
3 accessing "http://localhost:8080/glassfish-20794/webapi/test/"

You can see the following in server.log,
...
[2013-09-10T16:16:04.140+0900] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797364140] [levelValue: 800] [[
visiting unvisited references]]

[2013-09-10T16:16:04.140+0900] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797364140] [levelValue: 800] [[
visiting unvisited references]]

[2013-09-10T16:16:04.155+0900] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797364155] [levelValue: 800] [[
visiting unvisited references]]

[2013-09-10T16:16:04.718+0900] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797364718] [levelValue: 800] [[
Registering the Jersey servlet application, named javax.ws.rs.core.Application, with the following root resource and provider classes: [class TestService]]]

[2013-09-10T16:16:04.968+0900] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.server.ApplicationHandler] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797364968] [levelValue: 800] [[
Initiating Jersey application, version Jersey: 2.2 2013-08-14 08:51:58...]]

[2013-09-10T16:16:05.140+0900] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797365140] [levelValue: 800] [[
Loading application [glassfish-20794] at [/glassfish-20794]]]

[2013-09-10T16:16:05.155+0900] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=54 _ThreadName=admin-listener(4)] [timeMillis: 1378797365155] [levelValue: 800] [[
glassfish-20794 was successfully deployed in 1,203 milliseconds.]]

[2013-09-10T16:16:26.749+0900] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=29 _ThreadName=Thread-7] [timeMillis: 1378797386749] [levelValue: 800] [[
httpHeaders: null]]
...

So,

1) pl. JJ firstly evaluates whether being a bug from CDI?
2) if not, forwarding to jax-rs comp to evaluate deeply.

Thanks
Tang

Comment by jjsnyder83 [ 10/Sep/13 ]

@Context is not an annotation processed by Weld nor the GF CDI integration. I looked at the call stack for when the interceptor is created and it is created by
org.jboss.weld.bean.ManagedBean#create

This create method calls the following code

T instance = getProducer().produce(creationalContext);

to create the interceptor and then

getProducer().inject(instance, creationalContext);

to do the injection. For this the getProducer() returns an instance of

org.glassfish.jersey.gf.cdi.CdiComponentProvider

I would expect this class to handle the injection of non-CDI annotations. I do not have this source code handy so I can't verify.

I think the Jersey folks should take a look and see if they're handling the @Context annotation correctly.

Comment by TangYong [ 10/Sep/13 ]

Thanks JJ's confirmation and forwards to JAX-RS Comp to evaluate deeply.

Comment by tcke83 [ 04/Apr/14 ]

Is there an easy work around to get the context? I have the same issue.





[GLASSFISH-20597] UnsatisfiedDependencyException is thrown by JAX-RS, Bean Validation and CDI integration Created: 31/May/13  Updated: 19/Sep/14  Resolved: 11/Jun/13

Status: Resolved
Project: glassfish
Component/s: bean-validator, cdi, jax-rs
Affects Version/s: 4.0_b89_RC5
Fix Version/s: 4.1

Type: Bug Priority: Major
Reporter: HASUNUMA Kenji Assignee: Michal Gajdos
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 and JDK7 update 21 (both x86 and x86-64)


Issue Links:
Duplicate
duplicates GLASSFISH-20255 @Inject Strange Errors Closed
Related
is related to JERSEY-1908 UnsatisfiedDependencyException is th... Resolved
Tags: beanvalidation, cdi, jax-rs

 Description   

It is problem that a JAX-RS application (exactly a resource class) throws org.glassfish.hk2.api.UnsatisfiedDependencyException when I send GET request to it. The application uses both Bean Validation (@NotNull and @Min) and CDI (@Inject) into same resource class and it is neither Managed Bean nor EJB (Session Bean). If it uses either of them (for example, it uses without Bean Validation), it runs well and send response as status 200.

As a trial, I rewrite the application using not @Inject but @EJB (the resource class becomes Stateless Bean) and then it runs as expected.



 Comments   
Comment by Marek Potociar [ 04/Jun/13 ]

Please provide a reproducible test case. Marking as incomplete, targeting for 4.0.1. Will be closed if a reproducible test case is not provided.

Comment by HASUNUMA Kenji [ 04/Jun/13 ]

I seem to have no privilege with attached files, so I write the parts of application that throws UnsatisfiedDependencyException as following;

TweetResource.java (Resource class)
package jp.co.ines.sagittarius.api.twitter;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import twitter4j.TwitterException;

@Path("/twitter")
@Stateless
public class TwitterResource {
  @Inject
  private TwitterSearch twitterSearch;
  
  @GET
  @Path("/search")
  @Produces({"application/xml", "application/json"})
  public List<Tweet> search(@QueryParam("q") @NotNull String queryString,
      @DefaultValue("100") @QueryParam("count") @Min(1) int count) 
      throws TwitterException {
    return twitterSearch.search(queryString, count);
  }
  
  @GET
  @Path("/peek")
  @Produces({"application/xml", "application/json"})
  public List<Tweet> peek(@QueryParam("q") String queryString, 
      @QueryParam("count") @Min(1) int count) throws TwitterException {
    return twitterSearch.peek(queryString, count);
  }
}
TweetSearch.java (Injected EJB)
package jp.co.ines.sagittarius.api.twitter;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.ejb.Stateless;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.ServiceUnavailableException;

import twitter4j.Query;
import twitter4j.QueryResult;
import twitter4j.RateLimitStatus;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;

@Stateless
public class TwitterSearch {
  private static final int API_RATE_LIMIT = 180;
  private static final int SEARCH_RATE_LIMIT = 60;
  private static final int PEEK_RATE_LIMIT = 30;
  private static final int TWEETS_PER_PAGE = 100;
	
  public List<Tweet> search(String queryString, int count) 
      throws TwitterException {
    Twitter twitter = new TwitterFactory().getInstance();
    
    RateLimitStatus rateLimitStatus = 
      twitter.search(new Query("from:home")).getRateLimitStatus();
    if (getPages(count) > getRemaining(rateLimitStatus, SEARCH_RATE_LIMIT)) {
      throw new ServiceUnavailableException(
        (long) rateLimitStatus.getSecondsUntilReset());
    }
    
    Query query = new Query(queryString);
    query.setCount(TWEETS_PER_PAGE);
    
    List<Tweet> results = new ArrayList<>();
    for (int page = 0; page < getPages(count); page++) {
      QueryResult result = twitter.search(query);
      if (result.getTweets().isEmpty()) {
        break;
      }
      
      for (Status status : result.getTweets()) {
        Tweet tweet = new Tweet();
        tweet.setId(status.getId());
        tweet.setCreateAt(status.getCreatedAt());
        tweet.setFromUser(status.getUser().getScreenName());
        tweet.setFromUserName(status.getUser().getName());
        tweet.setProfileImageUrl(status.getUser().getProfileImageURLHttps());
        tweet.setVerified(status.getUser().isVerified());
        tweet.setText(status.getText());
        results.add(tweet);
      }
      query.setMaxId(result.getTweets().get(0).getId() - 1L);
    }
    return results;
  }

  public List<Tweet> peek(String queryString, int count) throws TwitterException {
    Twitter twitter = new TwitterFactory().getInstance();
    
    RateLimitStatus rateLimitStatus = twitter.search(
      new Query("from:home")).getRateLimitStatus();
    if (getPages(count) > getRemaining(rateLimitStatus, WATCH_RATE_LIMIT)) {
      throw new ServiceUnavailableException(
        (long) rateLimitStatus.getSecondsUntilReset());
    }
    
    Query query = new Query(queryString);
    query.setCount(TWEETS_PER_PAGE);
    
    List<Tweet> results = new ArrayList<>();
    for (int page = 0; page < getPages(count); page++) {
      QueryResult result = twitter.search(query);
      if (result.getTweets().isEmpty()) {
        break;
      }
      for (Status status : result.getTweets()) {
        Tweet tweet = new Tweet();
        tweet.setId(status.getId());
        tweet.setCreateAt(status.getCreatedAt());
        tweet.setFromUser(status.getUser().getScreenName());
        tweet.setFromUserName(status.getUser().getName());
        tweet.setProfileImageUrl(status.getUser().getProfileImageURLHttps());
        tweet.setVerified(status.getUser().isVerified());
        tweet.setText(status.getText());
        results.add(tweet);
      }
      try {
        int until = result.getRateLimitStatus().getSecondsUntilReset();
        int wait = until / getRemaining(
          result.getRateLimitStatus(), PEEK_RATE_LIMIT);
          TimeUnit.SECONDS.sleep(wait);
      } catch (InterruptedException e) {
        e.printStackTrace();
        throw new InternalServerErrorException(e);
      }
      query.setMaxId(result.getTweets().get(0).getId() - 1L);
    }
    return results;
  }
  
  private int getRemaining(RateLimitStatus rateLimitStatus, int rateLimit) {
    return rateLimitStatus.getRemaining() - (API_RATE_LIMIT - rateLimit);
  }
	
  private int getPages(int count) {
    return (count + TWEETS_PER_PAGE - 1) / TWEETS_PER_PAGE;
  }
}
Tweet.java (in part of)
package jp.co.ines.sagittarius.api.twitter;

import static javax.xml.bind.annotation.XmlAccessType.FIELD;

import java.io.Serializable;
import java.util.Date;

import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(FIELD)
public class Tweet implements Serializable {
  private static final long serialVersionUID = 3677514835637906987L;

  @XmlElement private long id;
  @XmlElement private Date createAt;
  @XmlElement private String fromUser;
  @XmlElement private String fromUserName;
  @XmlElement private String profileImageUrl;
  @XmlElement private boolean verified;
  @XmlElement private String text;

  // omit following getters/setters because of verbose description
}
WEB-INF/beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
</beans>

UnsatisfiedDependencyException is thrown directly following TwitterResource#search method. But I think it is also happen in TwitterSearch#peek method.

Remarks:

  • This application uses Twitter4J 3.0.3 (http://twitter4j.org/).
  • If I remove "@NotNull" and "@Min" from above TwitterResource, this runs well.
  • If I also replace "@Inject" to "@EJB" from above one, this runs well.


If possible, please grant attached files role to me because that I'll add reproducible test cases to future issues. I sent "Oracle Contributor Agreement" and wait it's acceptance.

Comment by Michal Gajdos [ 10/Jun/13 ]

Hi,

can you paste the whole stacktrace of the exception? Are you running this example on GlassFish or on something else?

Thanks.

Comment by HASUNUMA Kenji [ 10/Jun/13 ]

I run the example only on GlassFish 4.0 build 89.

The whole stacktrace is following;

org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=TwitterSearch,parent=TwitterResource,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,1920339034)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:771)
at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:790)
at org.glassfish.jersey.gf.cdi.CdiComponentProvider$1.inject(CdiComponentProvider.java:316)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:716)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:738)
at org.glassfish.jersey.gf.cdi.CdiComponentProvider$CdiFactory$1.getInstance(CdiComponentProvider.java:174)
at org.glassfish.jersey.gf.cdi.CdiComponentProvider$CdiFactory.provide(CdiComponentProvider.java:143)
at org.jvnet.hk2.internal.FactoryCreator.create(FactoryCreator.java:96)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:579)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:566)
at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)
at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:105)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:102)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:62)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:215)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:323)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)

Comment by Michal Gajdos [ 11/Jun/13 ]

Thanks for the stacktrace.

This issue is a duplicate of GLASSFISH-20255. The fix will be present in GF 4.0.1 and after the official release of GF 4.0 we will provide an IPS update package with Jersey where this issue is fixed. (I'll let you know when the package is available)

In the meantime you can download the jersey-gf-cdi from maven central ([1]), replace this module in glassfish4/glassfish/modules and delete the osgi cache glassfish4/glassfish/domains/domain1/osgi-cache/felix. This should fix the issue.

[1] http://repo1.maven.org/maven2/org/glassfish/jersey/containers/glassfish/jersey-gf-cdi/2.0/jersey-gf-cdi-2.0.jar





[GLASSFISH-20565] [fishcat] GF b89 : SEVERE: java.lang.TypeNotPresentException Created: 21/May/13  Updated: 22/May/13  Resolved: 22/May/13

Status: Resolved
Project: glassfish
Component/s: jax-rs
Affects Version/s: 4.0_b89_RC5
Fix Version/s: None

Type: Bug Priority: Major
Reporter: survivant Assignee: Marek Potociar
Resolution: Invalid Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Product Version: NetBeans IDE Dev (Build 201305052300)
Java: 1.7.0_13; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Windows XP version 5.1 running on x86; Cp1252; fr_CA (nb)
User directory: C:\Documents and Settings\sdionne1\Application Data\NetBeans\dev
Cache directory: C:\Documents and Settings\sdionne1\Local Settings\Application Data\NetBeans\Cache\dev


Tags: cdi, ejb, fishcat, jax-rs

 Description   

I used this command :

asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false

configs.config.server-config.cdi-service.enable-implicit-cdi=false
Command set executed successfully.

and after that, I deployed my sample jax-rs and got this error when I run my Client.

here the logs followed by the source.

Launching GlassFish on Felix platform
mai 21, 2013 7:56:50 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
mai 21, 2013 7:56:51 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
mai 21, 2013 7:56:51 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@c2599f in service registry.
Registry Info:: Total repositories: 1, Total modules = 293
Attached repository: []
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.services [239]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-mbeanserver [100]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.jta [191]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.security.auth.message-api [145]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-servlet-core [166]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.entitybean-container [76]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.runtime [233]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jca-plugin [54]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.registration-api [230]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.admin [42]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.json [140]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-osgi [271]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.asm-all-repackaged [18]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.enabler [206]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.config [114]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-javaee-base [289]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp.jstl [151]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.backup [19]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.common [222]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.gf-jpa-connector [85]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.jts [192]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [stax2-api [248]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.bean-validator [21]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.dataprovider [63]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-orb [96]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.enhancer [28]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-ejb-container [287]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.batch-api [130]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.dbschema-repackaged [64]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.shoal-cache-bootstrap [111]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-corba-plugin [51]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.fileinstall [280]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gf-web-connector [88]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.deployment-client [67]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.google.guava [108]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.scattered-archive-api [236]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.api [113]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.command [281]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.enterprise.deploy-api [135]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.resource-api [144]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-web-plugin [60]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.glassfish-extra-jre-packages [98]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-glassfish-cdi [252]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.admin [181]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-grizzly [253]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.oracle [217]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gf-weld-connector [89]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.glassfish-registration [103]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.internal-api [120]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.gmbal.gmbal [105]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.internal-api [44]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.config-types [41]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-mvc [178]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.jsr109-impl [189]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.websecurity [268]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ejb.security [75]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.util [8]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jspcaching-connector [188]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jsf-connector [185]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-community-branding-plugin [49]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.ha-file-store [110]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.ibm.jbatch-ri-spi [35]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-server [179]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.management.j2ee-api [142]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.glassfish [104]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.concurrent.connector [38]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.persistence [143]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.ha [265]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.cglib [22]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.bundlerepository [208]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-ee-api [97]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.jaspic.provider.framework [126]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.jpa-container [184]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.registration-impl [231]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.transaction-api [152]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp [149]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa.modelgen [215]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-api [90]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-core-asl [122]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.websocket-core [258]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.naming [266]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jpa [291]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.flashlight.flashlight-extra-jdk-packages [77]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.enterprise.concurrent [134]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.gf-restadmin-connector [87]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-naming [101]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-jackson [170]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.model [31]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security [240]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.core [182]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jts-plugin [57]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [woodstox-core-asl [276]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.osgi-platforms.osgi-cli-remote [219]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.ejb-container [72]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-api-osgi [3]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration-fragment [273]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.core [211]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-common [164]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.simple-glassfish-api [244]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.config [160]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.j-interop-repackaged [121]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.cache [241]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jstl-connector [190]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.kernel [193]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.core [7]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-web-container [293]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-cdi [285]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jsonp-jaxrs [187]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.management-api [199]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.batch.glassfish-batch-commands [91]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-sse [175]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-bean-validation [162]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-ejb-plugin [53]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-common-full-plugin [47]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-concurrent-plugin [50]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-common [48]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.spi [257]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.config-api [40]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ee [238]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.metro-glue [200]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.loadbalancer.load-balancer-admin [197]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-jaxrs [123]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.gf-jms-injection [84]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.common [68]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.jms-api [139]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-csiv2-idl [93]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-dynamic [226]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.osgi-resource-locator [4]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.dbws [212]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.loadbalancer.gf-load-balancer-connector [86]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.glassfish.jersey-gf-ejb [169]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-servlet [254]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.cli [260]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.jmxremote_optional-repackaged [183]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.grizzly.glassfish-grizzly-extra-all [99]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.class-model [23]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-tf-tools [227]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.javaee-full [70]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-multipart [174]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.webservices.security [272]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.annotation-api [1]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.javamail-runtime [129]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.moxy [216]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.osgi-adapter [218]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.ws.rs-api [154]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.pkg.client [229]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.sse [267]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.rest-client [234]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.cli [6]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet-api [147]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.glue [263]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.gf-ejb-connector [82]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.amx-core [9]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.amx-javaee [10]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jms-plugin [56]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gui-plugin-common [264]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-cluster-plugin [46]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.concurrent.impl [39]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.common [25]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.locator [115]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.ibm.jbatch-ri-runtime [36]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.osgi-platforms.osgi-container [220]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.jboss.weld.osgi-bundle [275]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.runlevel [116]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.el.javax.el [132]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.scr [284]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-internal-api [94]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.ldapbp-repackaged [195]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.gms-adapter [106]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.runtime [45]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet.jsp.jstl-api [150]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.javax.inject [137]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jpa-extension [221]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.annotation-framework [11]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.trilead-ssh2-repackaged [250]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.ant [12]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-client [163]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.javaee-core [69]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.admin [159]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.iiop [207]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.gf-client-module [80]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-ejb-lite-plugin [52]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.container-common [61]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-plugin-service [58]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [GlassFish-Application-Common-Module [14]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.connector [205]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-servlet [167]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.bean-validator-cdi [20]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ssl-impl [246]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-http [288]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.grizzly.nucleus-grizzly-all [203]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.ejb-api [131]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.xml.registry-api [155]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.shoal-cache-store [112]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.runtime [282]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.admin [24]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.inbound-runtime [43]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.connector [232]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.utils [117]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.ejb-full-container [73]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.gms-api [242]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.core [62]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.enterprise.concurrent-api [133]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-tf [228]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resourcebase.resources.nucleus-resources [204]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.javamail-connector [128]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.server.appclient-connector [15]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.server.appclient-server-core [16]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.acc-config [5]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.interceptor-api [138]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.javaee-kernel [127]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.stats77 [247]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-updatecenter-plugin [59]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-basic-tools [224]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.websocket-api [153]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.hk2 [118]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.util [37]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.gms-impl [243]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jdbc [290]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.core [255]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-basic [225]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.server [256]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.appclient.security [17]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.ssh [26]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.xml.rpc-api [156]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.rest-service [235]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.antlr-repackaged [13]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.work-management [277]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.jvnet.mimepull [201]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.batch.glassfish-batch-connector [92]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.runtime [161]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.monitoring-core [202]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-ee-resources [286]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.schema2beans-repackaged [237]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-moxy [173]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.gms-bootstrap [107]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.mail.javax.mail [141]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.generator-database [29]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.soap-tcp [245]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.jsftemplating [186]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.internal-api [30]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.eventadmin [279]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.embed-api [262]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.internal-api [249]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.client [251]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa [213]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.glassfish-oracle-jdbc-driver-packages [102]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.support-ejb [32]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-jettison [171]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jaxb-api [2]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.logging [198]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.connector [269]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-mvc-jsp [177]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-extra-jdk-packages [270]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.war-util [259]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jersey-mvc-connector [176]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.shell [283]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.inmemory.jacc.provider [119]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.ha.ha-api [109]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-processing [172]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jta [292]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.core [261]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.libpam4j-repackaged [196]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.configadmin [278]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.support-sqlstore [33]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-mapper-asl [124]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.dol [71]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.ejb-mapping [27]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jdbc-plugin [55]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.xml.bind [158]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.launcher [194]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.flashlight.framework [78]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-asm [223]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.faces [136]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.security.jacc-api [146]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.asm [210]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.glassfish.jersey-gf-cdi [168]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.gf-jms-connector [83]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-omgapi [95]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-xc [125]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.antlr [209]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.internal-api [74]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.codehaus.jettison.jettison [180]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.xml.bind.extra [157]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.autodeploy [66]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.utility [34]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.connector.gf-admingui-connector [79]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-grizzly2-http [165]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.gf-connectors-connector [81]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet.jsp-api [148]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration [274]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.admin [65]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa.jpql [214]], State = [NEW]]
Found populator: com.sun.enterprise.v3.server.GFDomainXml
#!## LogManagerService.postConstruct : rootFolder=F:\github\glassfish4-b89\glassfish
#!## LogManagerService.postConstruct : templateDir=F:\github\glassfish4-b89\glassfish\lib\templates
#!## LogManagerService.postConstruct : src=F:\github\glassfish4-b89\glassfish\lib\templates\logging.properties
#!## LogManagerService.postConstruct : dest=F:\github\glassfish4-b89\glassfish\domains\domain1\config\logging.properties
INFO: Running GlassFish Version: GlassFish Server Open Source Edition 4.0 (build 89)
INFO: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
INFO: Grizzly Framework 2.3.1 started in: 250ms - bound to [/0.0.0.0:8 080]
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:8 181]
INFO: Grizzly Framework 2.3.1 started in: 16ms - bound to [/0.0.0.0:4 848]
INFO: Authorization Service has successfully initialized.
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:3 700]
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
INFO: GlassFish Server Open Source Edition 4.0 (89) startup time : Felix (87 793ms), startup services(3 109ms), total(90 902ms)
INFO: HV000001: Hibernate Validator 5.0.0.Final
INFO: Initiating Jersey application, version Jersey: 2.0 2013-05-03 14:50:15...
INFO: Grizzly Framework 2.3.1 started in: 31ms - bound to [/0.0.0.0:8 080]
WARNING: Cannot start JMX connector JmxConnector config:

{ name = system, Protocol = rmi_jrmp, Address = 0.0.0.0, Port = 8686, AcceptAll = false, AuthRealmName = admin-realm, SecurityEnabled = false}

due to exception java.lang.RuntimeException: Port 8686 is not available for the internal rmi registry. This means that a call was made with the same port, without closing earlier registry instance. This has to do with the system jmx connector configuration in admin-service element of the configuration associated with this instance
SEVERE: java.lang.RuntimeException: Port 8686 is not available for the internal rmi registry. This means that a call was made with the same port, without closing earlier registry instance. This has to do with the system jmx connector configuration in admin-service element of the configuration associated with this instance
at org.glassfish.admin.mbeanserver.RMIConnectorStarter._startRegistry(RMIConnectorStarter.java:238)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.startRegistry(RMIConnectorStarter.java:216)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.<init>(RMIConnectorStarter.java:150)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.startConnector(JMXStartupService.java:294)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.run(JMXStartupService.java:333)
INFO: Grizzly Framework 2.3.1 started in: 16ms - bound to [/0.0.0.0:8 181]
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:7 676]
INFO: Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@2482fa as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@1a359e0.
INFO: Listening to REST requests at context: /command/domain.
INFO: this.makeModuleFor(org.glassfish.main.web.glue, null) returned OSGiModuleImpl:: Bundle = [org.glassfish.main.web.glue [263]], State = [READY]
INFO: this.makeModuleFor(org.glassfish.web.javax.servlet.jsp, null) returned OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp [149]], State = [READY]
INFO: visiting unvisited references
INFO: SEC1002: Security Manager is OFF.
INFO: SEC1010: Entering Security Startup Service
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: SEC1011: Security Service(s) Started Successfully
INFO: Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080
INFO: Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181
INFO: Created HTTP listener admin-listener on host/port 0.0.0.0:4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Setting JAAS app name glassfish-web
INFO: Virtual server server loaded default web module
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: EJB5181:Portable JNDI names for EJB EJBManagedBean: [java:global/WebApplication1/EJBManagedBean!com.demo.EJBManagedBean, java:global/WebApplication1/EJBManagedBean]
INFO: WELD-000900 2.0.0 (SP1)
WARNING: Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
WARNING: Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
INFO: Registering the Jersey servlet application, named org.netbeans.rest.application.config.ApplicationConfig, at the servlet mapping /resources/*, with the Application class of the same name.
INFO: Initialisation de Mojarra 2.2.0 ( 20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0@11930) pour le contexte «/WebApplication1»
INFO: Loading application [WebApplication1] at [/WebApplication1]
INFO: WebApplication1 was successfully deployed in 19 546 milliseconds.
SEVERE: WebModule[/WebApplication1]StandardWrapper.Throwable
java.lang.TypeNotPresentException: Type org.apache.abdera.model.Entry not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:84)
at java.lang.Class.getGenericSuperclass(Class.java:698)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.getAdvertisedTypesFromClass(ReflectionHelper.java:334)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.getAdvertisedTypesFromObject(ReflectionHelper.java:388)
at org.glassfish.hk2.utilities.BuilderHelper.createConstantDescriptor(BuilderHelper.java:259)
at org.glassfish.hk2.utilities.binding.AbstractBindingBuilder$InstanceBasedBindingBuilder.complete(AbstractBindingBuilder.java:248)
at org.glassfish.hk2.utilities.binding.AbstractBinder.resetBuilder(AbstractBinder.java:177)
at org.glassfish.hk2.utilities.binding.AbstractBinder.complete(AbstractBinder.java:187)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:171)
at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:313)
at org.glassfish.jersey.message.internal.MessagingBinders$MessageBodyProviders.configure(MessagingBinders.java:110)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:169)
at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:313)
at org.glassfish.jersey.server.ServerBinder.configure(ServerBinder.java:109)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:169)
at org.glassfish.jersey.internal.inject.Injections.bind(Injections.java:157)
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:147)
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:137)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:265)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.apache.abdera.model.Entry
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
... 56 more

WARNING: StandardWrapperValve[org.netbeans.rest.application.config.ApplicationConfig]: Allocate exception for servlet org.netbeans.rest.application.config.ApplicationConfig
java.lang.ClassNotFoundException: org.apache.abdera.model.Entry
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:84)
at java.lang.Class.getGenericSuperclass(Class.java:698)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.getAdvertisedTypesFromClass(ReflectionHelper.java:334)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.getAdvertisedTypesFromObject(ReflectionHelper.java:388)
at org.glassfish.hk2.utilities.BuilderHelper.createConstantDescriptor(BuilderHelper.java:259)
at org.glassfish.hk2.utilities.binding.AbstractBindingBuilder$InstanceBasedBindingBuilder.complete(AbstractBindingBuilder.java:248)
at org.glassfish.hk2.utilities.binding.AbstractBinder.resetBuilder(AbstractBinder.java:177)
at org.glassfish.hk2.utilities.binding.AbstractBinder.complete(AbstractBinder.java:187)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:171)
at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:313)
at org.glassfish.jersey.message.internal.MessagingBinders$MessageBodyProviders.configure(MessagingBinders.java:110)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:169)
at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:313)
at org.glassfish.jersey.server.ServerBinder.configure(ServerBinder.java:109)
at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:169)
at org.glassfish.jersey.internal.inject.Injections.bind(Injections.java:157)
at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:147)
at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:137)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:265)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)

SOURCE

NewJerseyClient.java

/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */

package com.demo;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;

/**

  • Jersey REST client generated for REST resource:HelloResource [hello]<br>
  • USAGE:
  • <pre>
  • NewJerseyClient client = new NewJerseyClient();
  • Object response = client.XXX(...);
  • // do whatever with response
  • client.close();
  • </pre>
    *
  • @author sdionne1
    */
    public class NewJerseyClient {
    private WebResource webResource;
    private Client client;
    private static final String BASE_URI = "http://localhost:8080/WebApplication1/resources";

public NewJerseyClient()

{ com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig(); client = Client.create(config); webResource = client.resource(BASE_URI).path("hello"); }

public void helloJson(Object requestEntity) throws UniformInterfaceException

{ webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).post(requestEntity); }

public String getHello() throws UniformInterfaceException

{ WebResource resource = webResource; return resource.accept(javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class); }

public void sayHello(Object requestEntity) throws UniformInterfaceException

{ webResource.type(javax.ws.rs.core.MediaType.TEXT_PLAIN).post(requestEntity); }

public void close()

{ client.destroy(); }

public static void main(String[] args)

{ NewJerseyClient client = new NewJerseyClient(); User user = new User(); user.name="name1"; user.lastname="lastname2"; client.helloJson(user); client.close(); }

}

HelloResource.java

package com.demo;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
*

  • @author sdionne1
    */
    @Path("hello")
    public class HelloResource {

@Inject
CDIManagedBean bean;

@Inject
EJBManagedBean ejb;

@PostConstruct
public void init()

{ System.out.println(HelloResource.class + " post construct"); }

@GET
@Produces("text/plain")
public String getHello()

{ return "hello : " + bean.getOutput() + " : " + ejb.getOutput(); }

@POST
@Consumes("text/plain")
public void sayHello(String message)

{ System.out.println("Say Hello : " + message); }

@POST
@Consumes("application/json")
public void helloJson(User user)

{ System.out.println("helloJson user : " + user); }

}



 Comments   
Comment by Marek Potociar [ 22/May/13 ]

The old Jersey 1.x proprietary client API is not supported in GF 4.0/Jersey 2.x. Please use the new standard JAX-RS 2.0 Client API instead. Also make sure to not bundle old Jersey 1.x classes with your application.

Closing as invalid.





[GLASSFISH-20539] [fishcat] GF b89 : SEVERE: Exception during lifecycle processing Created: 16/May/13  Updated: 22/May/13  Resolved: 22/May/13

Status: Resolved
Project: glassfish
Component/s: cdi
Affects Version/s: 4.0_b89_RC5
Fix Version/s: None

Type: Bug Priority: Major
Reporter: survivant Assignee: jjsnyder83
Resolution: Invalid Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Product Version: NetBeans IDE Dev (Build 201305052300)
Java: 1.7.0_13; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Windows XP version 5.1 running on x86; Cp1252; fr_CA (nb)
User directory: C:\Documents and Settings\sdionne1\Application Data\NetBeans\dev
Cache directory: C:\Documents and Settings\sdionne1\Local Settings\Application Data\NetBeans\Cache\dev


Tags: ejb, fishcat, guice, inject, jax-rs

 Description   

I'm trying to deploy a simple jax-rs with @Inject and got theses error, and unable to deploy the demo.

my source look like :

HelloResource.java

package com.demo;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
*

  • @author sdionne1
    */
    @Path("hello")
    public class HelloResource {

@Inject
CDIManagedBean bean;

@Inject
EJBManagedBean ejb;

@PostConstruct
public void init()

{ System.out.println(HelloResource.class + " post construct"); }

@GET
@Produces("text/plain")
public String getHello()

{ return "hello : " + bean.getOutput() + " : " + ejb.getOutput(); }

@POST
@Consumes("text/plain")
public void sayHello(String message)

{ System.out.println("Say Hello : " + message); }

@POST
@Consumes("application/json")
public void helloJson(User user)

{ System.out.println("helloJson user : " + user); }

}

ApplicationConfig.java (Generated by Netbeans dev build)

package org.netbeans.rest.application.config;

import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

/**
*

  • @author sdionne1
    */
    @ApplicationPath("resources")
    public class ApplicationConfig extends Application {

/**

  • Do not modify addRestResourceClasses() method.
  • It is automatically re-generated by NetBeans REST support to populate
  • given list with all resources defined in the project.
    */
    @Override
    public Set<Class<?>> getClasses()
    Unknown macro: { Set<Class<?>> resources = new java.util.HashSet<Class<?>>(); // following code can be used to customize Jersey 2.0 JSON provider}

private void addRestResourceClasses(Set<Class<?>> resources)

{ resources.add(com.demo.HelloResource.class); }

}

Launching GlassFish on Felix platform
mai 16, 2013 8:33:13 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
mai 16, 2013 8:33:13 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
mai 16, 2013 8:33:13 AM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@10e2859 in service registry.
Registry Info:: Total repositories: 1, Total modules = 293
Attached repository: []
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.services [239]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-mbeanserver [100]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.jta [191]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.security.auth.message-api [145]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-servlet-core [166]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.entitybean-container [76]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.runtime [233]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jca-plugin [54]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.registration-api [230]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.admin [42]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.json [140]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-osgi [271]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.asm-all-repackaged [18]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.enabler [206]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.config [114]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-javaee-base [289]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp.jstl [151]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.backup [19]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.common [222]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.gf-jpa-connector [85]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.jts [192]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [stax2-api [248]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.bean-validator [21]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.dataprovider [63]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-orb [96]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.enhancer [28]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-ejb-container [287]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.batch-api [130]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.dbschema-repackaged [64]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.shoal-cache-bootstrap [111]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-corba-plugin [51]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.fileinstall [280]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gf-web-connector [88]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.deployment-client [67]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.google.guava [108]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.scattered-archive-api [236]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.api [113]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.command [281]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.enterprise.deploy-api [135]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.resource-api [144]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-web-plugin [60]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.glassfish-extra-jre-packages [98]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-glassfish-cdi [252]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.admin [181]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-grizzly [253]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.oracle [217]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gf-weld-connector [89]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.glassfish-registration [103]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.internal-api [120]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.gmbal.gmbal [105]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.internal-api [44]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.config-types [41]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-mvc [178]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.jsr109-impl [189]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.websecurity [268]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ejb.security [75]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.util [8]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jspcaching-connector [188]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jsf-connector [185]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-community-branding-plugin [49]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.ha-file-store [110]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.ibm.jbatch-ri-spi [35]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-server [179]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.management.j2ee-api [142]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.glassfish [104]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.concurrent.connector [38]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.persistence [143]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.ha [265]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.cglib [22]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.bundlerepository [208]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-ee-api [97]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.jaspic.provider.framework [126]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.jpa-container [184]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.registration.registration-impl [231]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.transaction-api [152]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp [149]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa.modelgen [215]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-api [90]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-core-asl [122]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.websocket-core [258]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.naming [266]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jpa [291]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.flashlight.flashlight-extra-jdk-packages [77]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.enterprise.concurrent [134]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.gf-restadmin-connector [87]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-naming [101]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-jackson [170]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.model [31]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security [240]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.core [182]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jts-plugin [57]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [woodstox-core-asl [276]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.osgi-platforms.osgi-cli-remote [219]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.ejb-container [72]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-api-osgi [3]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration-fragment [273]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.core [211]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-common [164]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.simple-glassfish-api [244]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.config [160]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.j-interop-repackaged [121]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.cache [241]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jstl-connector [190]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.kernel [193]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.core [7]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-web-container [293]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-cdi [285]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jsonp-jaxrs [187]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.management-api [199]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.batch.glassfish-batch-commands [91]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-sse [175]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-bean-validation [162]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-ejb-plugin [53]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-common-full-plugin [47]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-concurrent-plugin [50]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-common [48]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.spi [257]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.config-api [40]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ee [238]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.metro-glue [200]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.loadbalancer.load-balancer-admin [197]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-jaxrs [123]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.gf-jms-injection [84]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.common [68]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.jms-api [139]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-csiv2-idl [93]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-dynamic [226]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.osgi-resource-locator [4]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.dbws [212]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.loadbalancer.gf-load-balancer-connector [86]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.glassfish.jersey-gf-ejb [169]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.container-servlet [254]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.cli [260]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.jmxremote_optional-repackaged [183]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.grizzly.glassfish-grizzly-extra-all [99]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.class-model [23]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-tf-tools [227]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.javaee-full [70]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-multipart [174]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.webservices.security [272]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.annotation-api [1]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.javamail-runtime [129]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.moxy [216]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.osgi-adapter [218]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.ws.rs-api [154]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.pkg.client [229]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.sse [267]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.rest-client [234]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.cli [6]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet-api [147]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.glue [263]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.gf-ejb-connector [82]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.amx-core [9]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.amx-javaee [10]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jms-plugin [56]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.gui-plugin-common [264]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-cluster-plugin [46]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.concurrent.impl [39]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.common [25]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.locator [115]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.ibm.jbatch-ri-runtime [36]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.osgi-platforms.osgi-container [220]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.jboss.weld.osgi-bundle [275]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.runlevel [116]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.el.javax.el [132]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.scr [284]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-internal-api [94]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.ldapbp-repackaged [195]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.gms-adapter [106]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.runtime [45]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet.jsp.jstl-api [150]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.javax.inject [137]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jpa-extension [221]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.annotation-framework [11]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.trilead-ssh2-repackaged [250]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.ant [12]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.core.jersey-client [163]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.javaee-core [69]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.admin [159]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.iiop [207]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.gf-client-module [80]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-ejb-lite-plugin [52]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.container-common [61]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-plugin-service [58]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [GlassFish-Application-Common-Module [14]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.orb.connector [205]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-servlet [167]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.external.bean-validator-cdi [20]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.ssl-impl [246]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-http [288]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.grizzly.nucleus-grizzly-all [203]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.ejb-api [131]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.xml.registry-api [155]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ha.shoal-cache-store [112]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.runtime [282]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.admin [24]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.inbound-runtime [43]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.connector [232]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.utils [117]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.ejb-full-container [73]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.gms-api [242]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.core [62]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.enterprise.concurrent-api [133]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-tf [228]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resourcebase.resources.nucleus-resources [204]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.resources.javamail-connector [128]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.server.appclient-connector [15]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.server.appclient-server-core [16]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.appclient.acc-config [5]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.interceptor-api [138]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.javaee-kernel [127]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.stats77 [247]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-updatecenter-plugin [59]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-basic-tools [224]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.websocket-api [153]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.hk2.hk2 [118]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.util [37]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.shoal.gms-impl [243]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jdbc [290]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.core [255]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-basic [225]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.server [256]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.appclient.security [17]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.ssh [26]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.xml.rpc-api [156]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.rest-service [235]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.antlr-repackaged [13]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.work-management [277]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.jvnet.mimepull [201]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.batch.glassfish-batch-connector [92]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jdbc.runtime [161]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.monitoring-core [202]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-ee-resources [286]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.external.schema2beans-repackaged [237]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-moxy [173]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.cluster.gms-bootstrap [107]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.mail.javax.mail [141]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.generator-database [29]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.soap-tcp [245]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.jsftemplating [186]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.internal-api [30]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.eventadmin [279]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.embed-api [262]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.internal-api [249]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.tyrus.client [251]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa [213]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.glassfish-oracle-jdbc-driver-packages [102]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.support-ejb [32]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-jettison [171]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jaxb-api [2]], State = [READY]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.core.logging [198]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.webservices.connector [269]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.ext.jersey-mvc-jsp [177]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.metro.webservices-extra-jdk-packages [270]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.war-util [259]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.jersey-mvc-connector [176]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.gogo.shell [283]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.security.inmemory.jacc.provider [119]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.ha.ha-api [109]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.media.jersey-media-json-processing [172]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.fighterfish.osgi-jta [292]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.core [261]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.external.libpam4j-repackaged [196]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.apache.felix.configadmin [278]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.support-sqlstore [33]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-mapper-asl [124]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.dol [71]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.ejb-mapping [27]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.console-jdbc-plugin [55]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.xml.bind [158]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.launcher [194]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.flashlight.framework [78]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.pfl.pfl-asm [223]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.javax.faces [136]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.security.jacc-api [146]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.asm [210]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.glassfish.jersey-gf-cdi [168]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.jms.gf-jms-connector [83]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.corba.glassfish-corba-omgapi [95]], State = [RESOLVED]]
Registered Module: [OSGiModuleImpl:: Bundle = [jackson-xc [125]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.antlr [209]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.ejb.internal-api [74]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.codehaus.jettison.jettison [180]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [com.sun.xml.bind.extra [157]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.autodeploy [66]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.persistence.cmp.utility [34]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admingui.connector.gf-admingui-connector [79]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.jersey.containers.jersey-container-grizzly2-http [165]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.connectors.gf-connectors-connector [81]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.servlet.jsp-api [148]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration [274]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.deployment.admin [65]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.eclipse.persistence.jpa.jpql [214]], State = [NEW]]
Found populator: com.sun.enterprise.v3.server.GFDomainXml
#!## LogManagerService.postConstruct : rootFolder=F:\github\glassfish4-b89\glassfish
#!## LogManagerService.postConstruct : templateDir=F:\github\glassfish4-b89\glassfish\lib\templates
#!## LogManagerService.postConstruct : src=F:\github\glassfish4-b89\glassfish\lib\templates\logging.properties
#!## LogManagerService.postConstruct : dest=F:\github\glassfish4-b89\glassfish\domains\domain1\config\logging.properties
INFO: Running GlassFish Version: GlassFish Server Open Source Edition 4.0 (build 89)
INFO: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
INFO: Grizzly Framework 2.3.1 started in: 93ms - bound to [/0.0.0.0:8 080]
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:8 181]
INFO: Grizzly Framework 2.3.1 started in: 47ms - bound to [/0.0.0.0:4 848]
INFO: Authorization Service has successfully initialized.
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:3 700]
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
INFO: HV000001: Hibernate Validator 5.0.0.Final
INFO: GlassFish Server Open Source Edition 4.0 (89) startup time : Felix (45 481ms), startup services(3 625ms), total(49 106ms)
INFO: Initiating Jersey application, version Jersey: 2.0 2013-05-03 14:50:15...
INFO: Grizzly Framework 2.3.1 started in: 31ms - bound to [/0.0.0.0:8 080]
WARNING: Cannot start JMX connector JmxConnector config:

{ name = system, Protocol = rmi_jrmp, Address = 0.0.0.0, Port = 8686, AcceptAll = false, AuthRealmName = admin-realm, SecurityEnabled = false}

due to exception java.lang.RuntimeException: Port 8686 is not available for the internal rmi registry. This means that a call was made with the same port, without closing earlier registry instance. This has to do with the system jmx connector configuration in admin-service element of the configuration associated with this instance
SEVERE: java.lang.RuntimeException: Port 8686 is not available for the internal rmi registry. This means that a call was made with the same port, without closing earlier registry instance. This has to do with the system jmx connector configuration in admin-service element of the configuration associated with this instance
at org.glassfish.admin.mbeanserver.RMIConnectorStarter._startRegistry(RMIConnectorStarter.java:238)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.startRegistry(RMIConnectorStarter.java:216)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.<init>(RMIConnectorStarter.java:150)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.startConnector(JMXStartupService.java:294)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.run(JMXStartupService.java:333)
INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:8 181]
INFO: this.makeModuleFor(org.glassfish.main.web.glue, null) returned OSGiModuleImpl:: Bundle = [org.glassfish.main.web.glue [263]], State = [READY]
INFO: this.makeModuleFor(org.glassfish.web.javax.servlet.jsp, null) returned OSGiModuleImpl:: Bundle = [org.glassfish.web.javax.servlet.jsp [149]], State = [READY]
INFO: visiting unvisited references
SEVERE: Config Listener class com.sun.enterprise.connectors.jms.system.JMSConfigListener notification took too long
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:258)
at java.util.concurrent.FutureTask.get(FutureTask.java:119)
at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:289)
at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1.call(Transactions.java:268)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:167)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

INFO: Grizzly Framework 2.3.1 started in: 0ms - bound to [/0.0.0.0:7 676]
INFO: Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@a78915 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@1e47220.
INFO: SEC1002: Security Manager is OFF.
INFO: SEC1010: Entering Security Startup Service
INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
INFO: SEC1011: Security Service(s) Started Successfully
INFO: Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080
INFO: Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181
INFO: Created HTTP listener admin-listener on host/port 0.0.0.0:4848
INFO: Created virtual server server
INFO: Created virtual server __asadmin
INFO: Setting JAAS app name glassfish-web
INFO: Virtual server server loaded default web module
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: visiting unvisited references
INFO: EJB5181:Portable JNDI names for EJB EJBManagedBean: [java:global/WebApplication1/EJBManagedBean!com.demo.EJBManagedBean, java:global/WebApplication1/EJBManagedBean]
INFO: WELD-000900 2.0.0 (SP1)
WARNING: AS-CDI-005
WARNING: AS-CDI-005
INFO: WELD-000119 Not generating any bean definitions from com.sun.jersey.guice.spi.container.servlet.GuiceContainer because of underlying class loading error: Type com.google.inject.Injector not found. If this is unexpected, enable DEBUG logging to see the full error.
SEVERE: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:Error loading class com.sun.jersey.guice.spi.container.servlet.GuiceContainer
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.sun.jersey.guice.spi.container.servlet.GuiceContainer
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:179)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:188)
at org.jboss.weld.manager.BeanManagerImpl.createAnnotatedType(BeanManagerImpl.java:1136)
at org.glassfish.weld.WeldDeployer.firePITEvent(WeldDeployer.java:389)
at org.glassfish.weld.WeldDeployer.fireProcessInjectionTargetEvents(WeldDeployer.java:360)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:212)
... 36 more
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Injector
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
at java.lang.Class.getDeclaredConstructors(Class.java:1855)
at org.jboss.weld.security.GetDeclaredConstructorsAction.run(GetDeclaredConstructorsAction.java:30)
at org.jboss.weld.security.GetDeclaredConstructorsAction.run(GetDeclaredConstructorsAction.java:22)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:161)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:158)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:64)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:85)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:82)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:358)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:396)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:174)
... 41 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Injector
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
... 63 more

SEVERE: Exception while loading the app
SEVERE: Undeployment failed for context /WebApplication1
SEVERE: Exception while loading the app : CDI deployment failure:Error loading class com.sun.jersey.guice.spi.container.servlet.GuiceContainer
org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class com.sun.jersey.guice.spi.container.servlet.GuiceContainer
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:179)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:188)
at org.jboss.weld.manager.BeanManagerImpl.createAnnotatedType(BeanManagerImpl.java:1136)
at org.glassfish.weld.WeldDeployer.firePITEvent(WeldDeployer.java:389)
at org.glassfish.weld.WeldDeployer.fireProcessInjectionTargetEvents(WeldDeployer.java:360)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:212)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Injector
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
at java.lang.Class.getDeclaredConstructors(Class.java:1855)
at org.jboss.weld.security.GetDeclaredConstructorsAction.run(GetDeclaredConstructorsAction.java:30)
at org.jboss.weld.security.GetDeclaredConstructorsAction.run(GetDeclaredConstructorsAction.java:22)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:161)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.computeValue(BackedAnnotatedType.java:158)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:154)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedConstructors.<init>(BackedAnnotatedType.java:158)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:64)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:47)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:85)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.apply(ClassTransformer.java:82)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:358)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:396)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:174)
... 41 more
Caused by: java.lang.ClassNotFoundException: com.google.inject.Injector
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
... 63 more

INFO: Domain Pinged: release.glassfish.org



 Comments   
Comment by survivant [ 17/May/13 ]

there is a problem in the source code provided :

here the code version :

package org.netbeans.rest.application.config;

import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

/**
*

  • @author sdionne1
    */
    @ApplicationPath("resources")
    public class ApplicationConfig extends Application {

/**

  • Do not modify addRestResourceClasses() method.
  • It is automatically re-generated by NetBeans REST support to populate
  • given list with all resources defined in the project.
    */
    @Override
    public Set<Class<?>> getClasses()
    Unknown macro: { Set<Class<?>> resources = new java.util.HashSet<Class<?>>(); // following code can be used to customize Jersey 2.0 JSON provider}

private void addRestResourceClasses(Set<Class<?>> resources)

{ resources.add(com.demo.HelloResource.class); }

}

Comment by jjsnyder83 [ 17/May/13 ]

Please provide the application and source code.

Comment by jjsnyder83 [ 22/May/13 ]

Please attach the application with source code.

Comment by survivant [ 22/May/13 ]

Where the link to attach source code in Jira ?

for now.. I send you the source code by email.

Comment by jjsnyder83 [ 22/May/13 ]

I see 2 problems with the application:
1) There are all sorts of jersey jars in the application. They should probably be removed since GlassFish ships with Jersey and so you don't need them in the war.
2) The CNFE happens because com/google/inject/Injector is not in the classpath of the application but when com.sun.jersey.guice.spi.container.servlet.GuiceContainer (contained in WEB-INF/lib/jersey-guice-1.13.jar) is loaded, because it has a reference to INjector it fails.





[GLASSFISH-20534] @Inject not working within JAX-RS @Provider Created: 15/May/13  Updated: 19/Sep/14  Resolved: 14/Aug/13

Status: Resolved
Project: glassfish
Component/s: embedded
Affects Version/s: 4.0
Fix Version/s: 4.1

Type: Bug Priority: Major
Reporter: buddypine Assignee: Marek Potociar
Resolution: Invalid Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Glassfish embedded 4.0


Tags: embedded, glassfish4, jax-rs, jersey

 Description   

Using https://maven.java.net/content/groups/promoted/org/glassfish/main/extras/glassfish-embedded-all/4.0/
Injection of stateless EJB into JAX-RS @Provider fails, same EJB injected into regular servlet works fine within the same app.

@Stateless
public class AuthService {}

@Provider
public class HmacAuthFilter implements ContainerRequestFilter, ContainerResponseFilter {
@Inject
private AuthService authService;
...
}

monospaced
MultiException stack 1 of 3
org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=AuthService,parent=HmacAuthFilter,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,1462515663)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:191)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:214)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
MultiException stack 2 of 3
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of io.scrub.http.HmacAuthFilter errors were found
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:226)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
MultiException stack 3 of 3
java.lang.IllegalStateException: Unable to perform operation: resolve on io.scrub.http.HmacAuthFilter
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:340)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.glassfish.jersey.internal.inject.Providers.getAllRankedProviders(Providers.java:234)
at org.glassfish.jersey.server.ApplicationHandler.getProcessingProviders(ApplicationHandler.java:568)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:393)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:157)
at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:280)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:277)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
monospaced



 Comments   
Comment by Wasomumba [ 17/Jun/13 ]

This happens also in a "normal" (non-embedded) V4.0.1-b01 with @Singleton or @ApplicationScoped.

Comment by Marek Potociar [ 14/Aug/13 ]

JAX-RS 2.0 does not support injection of EJBs into JAX-RS components (providers, resources). As such, this is not a bug and I'm closing it as invalid. I have opened a RFE in Jersey to implement support for this instead: JERSEY-2040

At the moment, you can try to enable CDI and migrate your JAX-RS provider to a CDI-managed component. That way you may be able to get EJBs injected into the JAX-RS providers via CDI.





[GLASSFISH-20515] [fishcat] codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "name" (Class com.demo.User), not marked as ignorable Created: 13/May/13  Updated: 19/Sep/14

Status: Open
Project: glassfish
Component/s: jax-rs
Affects Version/s: 4.0_b88_RC4
Fix Version/s: 4.1

Type: Bug Priority: Major
Reporter: survivant Assignee: Jakub Podlesak
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Product Version: NetBeans IDE Dev (Build 201305052300)
Java: 1.7.0_13; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Windows XP version 5.1 running on x86; Cp1252; fr_CA (nb)
User directory: C:\Documents and Settings\sdionne1\Application Data\NetBeans\dev
Cache directory: C:\Documents and Settings\sdionne1\Local Settings\Application Data\NetBeans\Cache\dev


Tags: 4_0-exclude, fishcat, jax-rs, rest

 Description   

I used Netbeans to generate a jax-rs resources and config to test a jax-rs application.

I also used Netbeans to generate the jax-rs client from the HelloResources.

The problem is when I try to consume a "application/json" into a User object. I obtain this stacktrace in GF 4.0 latest promoted build.

I'll provide the source code at the end of the stacktrace.

INFO: class com.demo.CDIManagedBean post construct
INFO: class com.demo.HelloResource post construct
WARNING: StandardWrapperValve[org.netbeans.rest.application.config.ApplicationConfig]: Servlet.service() for servlet org.netbeans.rest.application.config.ApplicationConfig threw exception
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "name" (Class com.demo.User), not marked as ignorable
at [Source: org.glassfish.jersey.message.internal.EntityInputStream@d03ff; line: 1, column: 10] (through reference chain: com.demo.User["name"])
at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53)
at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267)
at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673)
at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659)
at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365)
at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:703)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:181)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:134)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundReadFrom(MappableExceptionWrapperInterceptor.java:72)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:134)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:828)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:833)
at org.glassfish.jersey.server.ContainerRequest.readEntity(ContainerRequest.java:245)
at org.glassfish.jersey.server.internal.inject.EntityParamValueFactoryProvider$EntityValueFactory.get(EntityParamValueFactoryProvider.java:96)
at org.glassfish.jersey.server.internal.inject.AbstractHttpContextValueFactory.provide(AbstractHttpContextValueFactory.java:66)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:81)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$AbstractMethodParamInvoker.getParamValues(JavaResourceMethodDispatcherProvider.java:121)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:136)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:323)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)

package com.demo;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sdionne1
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class User {
    
    public String name;
    public String lastname;

}
package com.demo;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
 *
 * @author sdionne1
 */
@Path("hello")
public class HelloResource {
    
    @Inject            
    CDIManagedBean bean;
    
    @Inject
    EJBManagedBean ejb;
    
    @PostConstruct
    public void init(){
        System.out.println(HelloResource.class + " post construct");
    } 
    
    @GET
    @Produces("text/plain")
    public String getHello(){
        return "hello : " + bean.getOutput() + "  : " + ejb.getOutput();
    }
    
    @POST
    @Consumes("text/plain")
    public void sayHello(String message){
        System.out.println("Say Hello : " + message);
    }
    
    @POST
    @Consumes("application/json")
    public void helloJson(User user){
        System.out.println("helloJson user : " + user);
    }
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.demo;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;

/**
 * Jersey REST client generated for REST resource:HelloResource [hello]<br>
 * USAGE:
 * <pre>
 *        NewJerseyClient client = new NewJerseyClient();
 *        Object response = client.XXX(...);
 *        // do whatever with response
 *        client.close();
 * </pre>
 *
 * @author sdionne1
 */
public class NewJerseyClient {
    private WebResource webResource;
    private Client client;
    private static final String BASE_URI = "http://localhost:8080/WebApplication1/resources";

    public NewJerseyClient() {
        com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig();
        client = Client.create(config);
        webResource = client.resource(BASE_URI).path("hello");
    }

    public void helloJson(Object requestEntity) throws UniformInterfaceException {
        webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).post(requestEntity);
    }

    public String getHello() throws UniformInterfaceException {
        WebResource resource = webResource;
        return resource.accept(javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class);
    }

    public void sayHello(Object requestEntity) throws UniformInterfaceException {
        webResource.type(javax.ws.rs.core.MediaType.TEXT_PLAIN).post(requestEntity);
    }

    public void close() {
        client.destroy();
    }
    
    public static void main(String[] args){
        NewJerseyClient client = new NewJerseyClient();
        
        User user = new User();
        user.name="name1";
        user.lastname="lastname2";
        
        client.helloJson(user);
        
        client.close();
    }
}


 Comments   
Comment by survivant [ 13/May/13 ]

I can provide the source code in zip if you give my your email address.

thanks

Comment by Marek Potociar [ 14/May/13 ]

Updated java listing formatting in the issue desc.

Comment by Jakub Podlesak [ 14/May/13 ]

Deferred to 4.0.1.

Comment by survivant [ 17/May/13 ]

I created a new project and Netbeans dev, this time found some JSON providers.

Personnaly, I think Netbeans shouldn't override the method : getClasses(...) and let the container auto-detect the providers.

That method should be use if you want to force a provider, if not, the code won't be portable unless we add specific jars in the war.

My goal was to create a simple demo to show JSON -> Pojo with jax-rs that will work "out-of-the-box" in GF4 or Wildfly.. any JavaEE6 ou Java7 container without specific jax-rs implementation.

package org.netbeans.rest.application.config;

import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

/**
*

  • @author sdionne1
    */
    @ApplicationPath("resources")
    public class ApplicationConfig extends Application {

/**

  • Do not modify addRestResourceClasses() method.
  • It is automatically re-generated by NetBeans REST support to populate
  • given list with all resources defined in the project.
    */
    @Override
    public Set<Class<?>> getClasses()
    Unknown macro: { Set<Class<?>> resources = new java.util.HashSet<Class<?>>(); // following code can be used to customize Jersey 2.0 JSON provider}

private void addRestResourceClasses(Set<Class<?>> resources)

{ resources.add(com.demo.HelloResource.class); }

}

Comment by survivant [ 20/May/13 ]

wierd. The code wasn't right when I saved it in the previous comment.

try

{ Class jsonProvider = Class.forName("org.glassfish.jersey.jackson.JacksonFeature"); // Class jsonProvider = Class.forName("org.glassfish.jersey.moxy.json.MoxyJsonFeature"); // Class jsonProvider = Class.forName("org.glassfish.jersey.jettison.JettisonFeature"); resources.add(jsonProvider); }

catch (ClassNotFoundException ex)

{ java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE, null, ex); }

addRestResourceClasses(resources);
return resources;
}

private void addRestResourceClasses(Set<Class<?>> resources)

{ resources.add(com.demo.HelloResource.class); }




[GLASSFISH-20505] @PostConstruct method called twice on @Singleton Created: 10/May/13  Updated: 19/Sep/14

Status: Open
Project: glassfish
Component/s: jax-rs
Affects Version/s: 4.0_b87_RC3
Fix Version/s: 4.1

Type: Bug Priority: Major
Reporter: agksmehx Assignee: Jakub Podlesak
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Oracle JDK 7, Linux Fedora 18 64-bit, Eclipse Kepler m6


Tags: 4_0-exclude, ejb_container, jax-rs

 Description   

I am running a simple .war file under Glassfish 4.0-b87 that was created in Eclipse Kepler M6 using M2E as a simple project with Dynamic Web Module facet added, using Oracle Java 7 JDK/JVM.

There is essentially a single class for which I expect the `post_construct` method to be called exactly once. But it is called twice, first when the app is deployed, and one more time on the first and only the first HTTP request.

Here is the class (the log output follows). It should print "hello world" only once but in the log it can be seen twice.

    package com.example.main;
    
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.ejb.LocalBean;
    import javax.ejb.PostActivate;
    import javax.ejb.PrePassivate;
    import javax.ejb.Singleton;
    import javax.ejb.Startup;
    import javax.enterprise.inject.spi.PassivationCapable;
    import javax.ws.rs.ApplicationPath;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.core.Application;
    
    @Singleton
    @Startup
    @LocalBean
    @ApplicationPath("/rest")
    @Path("/life")
    public class Life extends Application implements PassivationCapable {
    
      @PostConstruct
      public void post_construct () {
        System.out.println("hello world!");
      }
    
      @PreDestroy
      public void pre_destroy () {
        System.out.println("so long and thanks for the fish!");
      }
    
      @PrePassivate
      public void pre_passivate () {
        System.out.println("taking a break");
      }
    
      @PostActivate
      public void post_activate () {
        System.out.println("back from break");
      }
    
      @Override
      public String getId () {
        return "life";
      }
    
      @GET
      public String greet () {
        return "hi";
      }
    }

The log output is as follows with a dashed line separating the part before the first HTTP call and the part after the HTTP call:

[2013-05-09T19:42:26.660-1000] [glassfish 4.0] [INFO] [NCLS-DEPLOYMENT-00027] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546660] [levelValue: 800] [[
Selecting file /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/singleton.war for autodeployment]]

[2013-05-09T19:42:26.692-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546692] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.702-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546702] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.706-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546706] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.709-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546709] [levelValue: 800] [[
visiting unvisited references]]

[2013-05-09T19:42:26.749-1000] [glassfish 4.0] [INFO] [ejb.portable_jndi_names] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546749] [levelValue: 800] [[
EJB5181:Portable JNDI names for EJB Life: [java:global/singleton/Life, java:global/singleton/Life!com.example.main.Life]]]

[2013-05-09T19:42:26.959-1000] [glassfish 4.0] [WARNING] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546959] [levelValue: 900] [[
WELD-001473 javax.enterprise.inject.spi.Bean implementation org.glassfish.jms.injection.JMSCDIExtension$LocalBean@cbcbf4a declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.]]

[2013-05-09T19:42:26.970-1000] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=59 _ThreadName=Thread-3] [timeMillis: 1368164546970] [levelValue: 800] [[
hello world!]]

[2013-05-09T19:42:26.982-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546982] [levelValue: 800] [[
Registering the Jersey servlet application, named com.example.main.Life, at the servlet mapping /rest/*, with the Application class of the same name.]]

[2013-05-09T19:42:26.988-1000] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164546988] [levelValue: 800] [[
Loading application [singleton] at [/singleton]]]

[2013-05-09T19:42:27.003-1000] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164547003] [levelValue: 800] [[
singleton was successfully deployed in 332 milliseconds.]]

[2013-05-09T19:42:27.006-1000] [glassfish 4.0] [INFO] [NCLS-DEPLOYMENT-00035] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=59 _ThreadName=AutoDeployer] [timeMillis: 1368164547006] [levelValue: 800] [[
[AutoDeploy] Successfully autodeployed : /usr/local/glassfish4/glassfish/domains/domain1/autodeploy/singleton.war.]]

-----------------------------AFTER FIRST HTTP CALL-----------------------------

[2013-05-09T19:42:44.940-1000] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=21 _ThreadName=Thread-3] [timeMillis: 1368164564940] [levelValue: 800] [[
hello world!]]

[2013-05-09T19:42:44.940-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.server.ApplicationHandler] [tid: _ThreadID=21 _ThreadName=http-listener-1(4)] [timeMillis: 1368164564940] [levelValue: 800] [[
Initiating Jersey application, version Jersey: 2.0-rc2 2013-04-23 12:04:25...]]

[2013-05-09T19:42:44.956-1000] [glassfish 4.0] [INFO] [] [org.glassfish.jersey.gf.ejb.EjbComponentProvider] [tid: _ThreadID=21 _ThreadName=http-listener-1(4)] [timeMillis: 1368164564956] [levelValue: 800] [[
The Jersey EJB interceptor is bound. JAX-RS EJB integration support is enabled.]]



 Comments   
Comment by agksmehx [ 10/May/13 ]

I got a stack trace of the second singleton creation by making it throw an error if a static boolean was found initialized to true

java.lang.Error: second singleton
at com.example.Life.post_construct(Life.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1010)
at org.jvnet.hk2.internal.Utilities.justPostConstruct(Utilities.java:735)
at org.jvnet.hk2.internal.ServiceLocatorImpl.postConstruct(ServiceLocatorImpl.java:818)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:864)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:855)
at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:293)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:272)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:262)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1225)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:237)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)

Comment by marina vatkina [ 10/May/13 ]

no EJB container code in the stack

Comment by agksmehx [ 10/May/13 ]

Essentially the @Singleton annotation is not playing well the @ApplicationPath + "extends Application" part. When I created a separate class for @ApplicationPath + "extends Application" and left the @Singleton + @Path together, things seemed fine (although I don't know whether Jersey would create more singletons under load).

What does the standard say about putting @Application, @Singleton, @Path all on the same class?

Comment by Marek Potociar [ 14/May/13 ]

Updated java code formatting in the issue desc.

Comment by Jakub Podlesak [ 14/May/13 ]

JAX-RS/EJB integration does not work fully for Application subclasses. There are some technical difficulties
as Application subclasses are involved in application bootstrapping. Jersey only makes sure certain scenarios work
(e.g. @PostConstruct/@PreDestroy annotated methods are invoked at all). The rest (like e.g. this one, that @Singleton annotated
beans should get created just once per an application) should be resolved
with future Jersey releases.

I recommend to stick with the above described workaround (keep separate classes for application and JAX-RS resources/providers)
until this gets resolved.

Comment by Jakub Podlesak [ 14/May/13 ]

deferred to 4.0.1

Comment by agksmehx [ 15/May/13 ]

love the formatting: "so long and thanks for the fish", "taking a break"

seriously, thank you marek for fixing the formatting and thank you jakub and everybody else for your very kind attention. love glassfish + jersey!

Comment by rdelaplante [ 28/Jun/13 ]

I'm getting @PostConstruct called twice in a row on this class in GlassFish 4.0 release:

@Singleton
@Startup
public class LoggingService {

@Inject @Cached
private SystemSettings systemSettings;

@PostConstruct
public void initializeLogAppenders()

{ LogManager.resetConfiguration(); PropertyConfigurator.configure( systemSettings.getRuntimeDataPath() + "logging.properties"); }

@PreDestroy
public void closeLogAppenders()

{ LogManager.shutdown(); }

}





[GLASSFISH-20400] [fishcat] Javaee7 web project : creating a class for JAX-RS suggest to configure the REST for Javaee6 speficication instead of 7 Created: 24/Apr/13  Updated: 24/Apr/13

Status: Open
Project: glassfish
Component/s: ide-integration
Affects Version/s: 4.0_b85
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: survivant Assignee: vince kraemer
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Product Version: NetBeans IDE Dev (Build 201304232301)
Java: 1.7.0_13; Java HotSpot(TM) Client VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Windows XP version 5.1 running on x86; Cp1252; fr_CA (nb)
User directory: C:\Documents and Settings\sdionne1\Application Data\NetBeans\dev
Cache directory: C:\Documents and Settings\sdionne1\Local Settings\Application Data\NetBeans\Cache\dev


Tags: jax-rs, netbeans, rest

 Description   

I created a Javaee7 web project.

I created a plain java class.

when I add the annotation : @Path("/coucou")

I got a warning, that's the resource is not configure.

When I click on the info bubble, I received a list of suggestions : Configure REST using javaee6 specifications,
jersey..

if the project is Javaee7, the line should be : Configure REST using javaee7 specifications

probably it's the same but will make more sens to keep it all javaee7.






[GLASSFISH-18793] Cannot @Inject an EJB implementation into a JAX-RS resource Created: 10/Jun/12  Updated: 12/Apr/13  Resolved: 12/Apr/13

Status: Resolved
Project: glassfish
Component/s: cdi
Affects Version/s: 3.1.2
Fix Version/s: 4.0

Type: Bug Priority: Major
Reporter: ljnelson Assignee: arjavdesai
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: GZip Archive cdi-jaxrs-bug-v2.tar.gz     GZip Archive cdi-jaxrs-bug-v3.tar.gz     GZip Archive cdi-jaxrs-bug.tar.gz    
Tags: cdi, ejb, jax-rs

 Description   

In an .ear file with JAX-RS resources in the lib directory, it is impossible to have CDI inject an EJB implementation into a JAX-RS resource.

I have an .ear file with a lib directory.

In the .ear file I have:

  • an "api" .jar in the lib directory consisting of a single interface (a business interface)
  • an EJB module (a .jar file at the root level containing a local stateless session bean implementing the business interface described above, and a META-INF/beans.xml file causing it to be a CDI bean archive
  • a "jaxrs" .jar in the lib directory containing a single JAX-RS resource class with an injection point in it declared as @Inject private Greeter greeter; (where Greeter is the business interface), and a META-INF/beans.xml file causing it to be a CDI bean archive
  • a .war file containing a single class that extends javax.ws.rs.core.Application and serves as the "mount point" for a JAX-RS application whose single resource is the resource described above

Through various permutations of this application, deployment fails with Weld claiming that it cannot satisfy the Greeter injection point.

If I get CDI out of the mix and put @ManagedBean on the resource class and change the @Inject to @EJB everything works fine. But I want to use CDI injection, not @EJB injection.

I have attached a test case. Unzip/Untar it and run mvn clean install on it. Then deploy the resulting .ear file. It will be available under (e.g.) http://localhost:8080/cdi-jaxrs-war/api/greeting.



 Comments   
Comment by Martin Matula [ 10/Jun/12 ]

FYI - I was able to make it work by removing beans.xml from the "jaxrs" jar and changing the annotation on the GreetingResource from @RequestScoped to @ManagedBean.
Apparently @RequestScoped does not work if there is no beans.xml in the jar. On the other hand, if I add beans.xml to the jar it complains in cannot satisfy the injection point.

Comment by ljnelson [ 11/Jun/12 ]

Wait, that's odd. You're saying you de-bean-archived the GreetingResource and then @Inject worked? I confess that is a whole different sort of specification violation I didn't even think to try.

Comment by ljnelson [ 11/Jun/12 ]

Martin: I tried your approach on the off chance it would work for some strange reason. I'm guessing that you got deployment to "work" (i.e. the console said that deployment completed normally)? Deployment may have completed, but injection did not. If you then actually hit the URL you should discover that the injection point is null, as you'd expect.

Comment by Martin Matula [ 11/Jun/12 ]

After I made the changes it does work including the injection. Here is what I did:

  • after downloading your sample, war was missing in the list of modules in the top-level pom (or at least it did not open in the IDE when I opened the pom), so I added it
  • I removed META-INF/beans.xml from the "jaxrs" jar - i.e. the jar that contains the JAX-RS resource (this fixes the deployment issue)
  • I changed the annotation on the resource from @RequestScoped to @ManagedBean

After I made these changes it started working (including the injection).

Before I did this, I actually created my own version of your app (based on your stackoverflow.com question) where I observed this behavior - so then I just applied the same to the project attached to the issue - both apps worked for me after I made these changes.

Comment by ljnelson [ 11/Jun/12 ]

Martin, thanks for the effort.

I've attached the latest version of the project, complete with Martin's suggested changes. It still does not work.

In case I'm doing something wrong, here are the steps I followed:

  • Made sure GlassFish 3.1.2 is running. I happen to have created a domain called (for unimportant reasons) jx with its admin port on 9048.
  • Made sure this GlassFish instance is empty of applications.
  • Downloaded the "cdi-jaxrs-bug-v2.tar.gz" tarball attached to this issue.
  • cd'ed into its root-level directory and ran mvn clean install
  • cd'ed into ear/target
  • Ran asadmin --port=9048 deploy ./cdi-jaxrs-ear-0.0.1-SNAPSHOT.ear
  • Deployment completed successfully
  • Pointed my browser at http://localhost:9080/cdi-jaxrs-war/api/greeting and observed a NullPointerException where the resource class attempts to use the injected Greeter implementation
Comment by Martin Matula [ 11/Jun/12 ]

Ah, one more thing I forgot was missing in your original project - I've added beans.xml to WEB-INF folder of your web app (war project). Do that in your v2 of the project and it'll start working.

Comment by ljnelson [ 11/Jun/12 ]

Thank you! Indeed, that works. I will see if I can write up a post-mortem here. I still think this bug is valid, although as you have helpfully pointed out there is a workaround.

Comment by ljnelson [ 11/Jun/12 ]

I've attached "version 3" of my project, complete with Martin's changes. This version works.

It is difficult to know whether this bug is a valid one or not.

Section 1.2.3 of the CDI specification says in part:

The container performs dependency injection on all managed bean instances, even those which are not contextual instances.

Because of the confusion in the specification between the term "managed bean" in the Managed Beans sense and "managed bean" in the CDI managed bean sense (see CDI specification section 3.1) it is unclear what this means. I'll capitalize the former term and leave the latter term lowercase.

It would appear that some combination of GlassFish and Jersey have interpreted this sentence to mean that CDI injection is performed on Managed Beans, whether or not those Managed Beans are managed beans. This would explain why Martin's fixes work here.

On the other hand, the CDI specification then says very explicitly in section 12.1 that "bean classes of enabled beans must be deployed in bean archives". (A bean archive is any .jar or .war file with a META-INF/bean.xml or a WEB-INF/beans.xml file (respectively).) Section 5 then goes on to describe in great detail how dependency injection in CDI works, but the thing that all scenarios share in common is that they work on bean classes, which, as we've just seen, are required to be part of bean archives.

Finally, other application server vendors recommend very strongly that all JAX-RS resources that should serve as the target for CDI injection should be annotated with @RequestScoped, which would also of course require their containing .jar or .war file to have a beans.xml.

My added wrinkle is that my JAX-RS classes are discovered "outside" of the .war file that serves as their "mount point". That is, my .war file does not (deliberately) bundle the JAX-RS resource classes it manages under either its classes or lib directory. Instead, they are located in the containing .ear file's lib directory where the JAX-RS Application class can discover them dynamically, per the JAX-RS specification. This allows me to do much more flexible .ear packaging.

So the odd thing about that is that of course technically speaking my .war file shouldn't really have to be a bean archive itself as it contains no bean classes.

For all these reasons I believe that GlassFish is in error here, at least in the following respects:

  • I should be able to put a META-INF/beans.xml file in my JAX-RS jars, annotate my JAX-RS resources with @RequestScoped and have CDI injection performed on them appropriately, whether or not they are also annotated with @ManagedBean.
  • My JAX-RS classes should not be required to have @ManagedBean on them in order for CDI injection to occur.
  • If my JAX-RS classes are divorced from the .war file that manages them, there should be no reason I should have to put a WEB-INF/beans.xml file in the .war file.
Comment by TangYong [ 12/Apr/13 ]

I have confirmed the sample(cdi-jaxrs-bug-v3.tar.gz ) on current v4, and while launching http://localhost:8080/cdi-jaxrs-war/api/greeting, accessing rest resource failed and in the server.log, the following exception happened,

[2013-04-12T16:39:34.602+0900] [glassfish 4.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=19 _ThreadName=http-listener-1(1)] [timeMillis: 1365752374602] [levelValue: 900] [[
StandardWrapperValve[com.edugility.cdi.jaxrs.Application]: Servlet.service() for servlet com.edugility.cdi.jaxrs.Application threw exception
org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=Greeter,parent=GreetingResource,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,23965041)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74)
at org.jvnet.hk2.internal.Utilities.justInject(Utilities.java:771)
at org.jvnet.hk2.internal.ServiceLocatorImpl.inject(ServiceLocatorImpl.java:781)
at org.glassfish.jersey.gf.cdi.CdiComponentProvider$CdiFactory$2.getInstance(CdiComponentProvider.java:183)
at org.glassfish.jersey.gf.cdi.CdiComponentProvider$CdiFactory.provide(CdiComponentProvider.java:130)
at org.jvnet.hk2.internal.FactoryCreator.create(FactoryCreator.java:96)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2203)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:574)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:561)
at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:172)
at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185)
at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:105)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:121)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:102)
at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:62)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:208)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:722)
]]

Noting the exception is the same as GLASSFISH-20255, so the issue has been blocked by GLASSFISH-20255

-Tang

Comment by TangYong [ 12/Apr/13 ]

BTW: even if not using @ManagedBean instead using CDI, the result should be same.
Component/s should be changed into jax-rs.

Comment by jjsnyder83 [ 12/Apr/13 ]

Duplicate of http://java.net/jira/browse/GLASSFISH-20255





[GLASSFISH-18622] Container incorrectly logs WebApplicationException thrown by JAX-RS endpoint Created: 11/Apr/12  Updated: 18/Apr/12  Resolved: 12/Apr/12

Status: Resolved
Project: glassfish
Component/s: ejb_container
Affects Version/s: 3.1.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: RensGroenveld Assignee: marina vatkina
Resolution: Works as designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: Container, EJB, JAX-RS, WebApplicationException

 Description   

Hi there,

I have a REST Webservice running on GlassFish v3.1.1.
The project contains an EJB which hosts the REST Service. When I let the container throw a new WebApplicationException(Status.NOT_FOUND), the webpage nicely shows that the page cannot be found. The EJB Container however, logs the stacktrace of the WebApplicationException which I do not want.

Here is a URL I found containing the same issue:
http://jersey.576304.n2.nabble.com/EJBException-throwed-when-using-WebApplicationException-td4755164.html

My stack trace:

[#|2012-04-11T15:57:54.295+0200|WARNING|oracle-glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=79;_ThreadName=Thread-2;|A system exception occurred during an invocation on EJB RelatieResource method public nl.onvz._201012.xmlschema.cannoniek.relatie.RelatieBericht nl.onvz.relatie.services.glassfish.relatieservice.resources.RelatieResource.getRelatie(java.lang.String) throws javax.xml.datatype.DatatypeConfigurationException
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5193)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5091)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4879)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2039)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1990)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:222)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at $Proxy124.getRelatie(Unknown Source)
at nl.onvz.relatie.services.glassfish.relatieservice.resources._EJB31_GeneratedRelatieResourceIntf__Bean_.getRelatie(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:232)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: javax.ws.rs.WebApplicationException
at nl.onvz.relatie.services.glassfish.relatieservice.resources.RelatieResource.getRelatie(RelatieResource.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5366)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5338)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5326)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
... 48 more

#]

Kind regards,

Rens Groenveld



 Comments   
Comment by marina vatkina [ 11/Apr/12 ]

Is WebApplicationException designated as an application exception according to the EJB spec rules?

Comment by marina vatkina [ 12/Apr/12 ]

WebApplicationException is a subclass of the RuntimeException and as such follows the rules in the EJB spec (one of them, it should be logged)

Comment by marina vatkina [ 18/Apr/12 ]

To mark WebApplicationException as an application exception, add this ejb-jar.xml to your EJB module:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
<assembly-descriptor>
<application-exception>
<exception-class>javax.ws.rs.WebApplicationException</exception-class>
<rollback>true</rollback>
</application-exception>
</assembly-descriptor>
</ejb-jar>

Comment by RensGroenveld [ 18/Apr/12 ]

Hi there,

I just solved this about 30 minutes ago by creating an exception class that extends the WebApplicationException.

Then, I annotate that class with the @ApplicationException tag.

Works too

Many thanks!





[GLASSFISH-16939] Warning when using @RunAs annotation on a JAX-RS web service Created: 01/Jul/11  Updated: 01/Aug/12

Status: Open
Project: glassfish
Component/s: web_services
Affects Version/s: 3.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: mmuller Assignee: Jakub Podlesak
Resolution: Unresolved Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008


Attachments: File jaxrs-inheritance_warning.war     GZip Archive jaxrs_inheritance_warning.tar.gz    
Tags: jax-rs, warning

 Description   

Annotating a JAX-RS web service class with @RunAs triggers a warning at deployment-time:

[#|2011-07-01T14:11:48.035+0200|WARNING|glassfish3.1|global|_ThreadID=21;_ThreadName=Thread-1;|The annotation symbol inheritance is not supported.
symbol: TYPE
location: class test.Service1

I don't really know if this is the expected behaviour, as this warning does not appear with @DeclareRoles and @RolesAllowed annotations.

The maven project attached contains:

  • An EJB exposed as JAXRS service.
  • A web.xml descriptor, to load Jersey's ServletContainer on startup.
  • A glassfish-ejb-jar.xml descriptor to map roles and define the run-as principal.


 Comments   
Comment by arjan tijms [ 27/Nov/11 ]

I get the same warning in 3.1.1 with @RunAS on a stateless or singleton session bean and on a message driven bean, e.g.:

WARNING: The annotation symbol inheritance is not supported.
 symbol: TYPE
 location: class com.example.RolesTestMDB

WARNING: The annotation symbol inheritance is not supported.
 symbol: TYPE
 location: class com.example.RolesTestStartupSingleton

WARNING: The annotation symbol inheritance is not supported.
 symbol: TYPE
 location: class com.example.RolesTestEJB
Comment by dmitriy.balakin [ 01/Aug/12 ]

GF 3.1.2.2, @Runas + @Singleton/@Steteless - WARNING still appears.

Comment by Hong Zhang [ 01/Aug/12 ]

assign to webservices team for initial evaluation





[GLASSFISH-16937] Having REST services in separate WARs in a single EAR prints classloading warnings Created: 01/Jul/11  Updated: 21/Dec/14

Status: Open
Project: glassfish
Component/s: web_container
Affects Version/s: 3.1
Fix Version/s: 4.1

Type: Bug Priority: Minor
Reporter: mmuller Assignee: Daniel
Resolution: Unresolved Votes: 11
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008


Attachments: File ear-1.0.ear     GZip Archive jaxrs_multimodule_test.tar.gz    
Tags: classloader, glassfish-3-1, jax-rs

 Description   

Warnings show up when an EAR is deployed, containing more than one WAR archove with REST web services. Looks like GlassFish/Jersey tries to load all the REST service classes for each of the WARs being deployed, and then shows classloader warnings:

WEB9052: Unable to load class <classname>, reason: java.lang.ClassNotFoundException: <classname>

I did a minimal project which produces an EAR with this structure:

ear-1.0.ear

  • META-INF/
`- application.xml
  • war-1-1.0.war
 
  • classes/
  `- test/war1/Service1.class
`- WEB-INF/
`- web.xml
`- war-2-1.0.war
  • classes/
`- test/war2/Service2.class
`- WEB-INF/
`- web.xml

(See the attached maven project).

test.war1.Service1 and test.war2.Service2 are POJOs with class-level @Path annotation and method-level @GET or @POST annotations.
The application.xml DD is generated by maven-ear-plugin and only contains the two webmodules and their contextroots.
Both web.xml only contain a display name and the Jersey ServletContainer loaded on startup.

When deploying to GlassFish 3.1 on Windows Server 2008, the log contains the following entries:

[#|2011-07-01T10:45:59.159+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=183;_ThreadName=Thread-1;|WEB9052: Unable to load class test.war2.Service2, reason: java.lang.ClassNotFoundException: test.war2.Service2|#]

[#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.WebAppResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes|#]

[#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Root resource classes found:
class test.war1.Service1|#]

[#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|No provider classes found.|#]

[#|2011-07-01T10:45:59.187+0200|INFO|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=23;_ThreadName=Thread-1;|Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'|#]

[#|2011-07-01T10:45:59.354+0200|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=183;_ThreadName=Thread-1;|WEB0671: Loading application ear-1.0#war-1-1.0.war at [/war1]|#]

[#|2011-07-01T10:45:59.368+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=183;_ThreadName=Thread-1;|WEB9052: Unable to load class test.war1.Service1, reason: java.lang.ClassNotFoundException: test.war1.Service1|#]

[#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.WebAppResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes|#]

[#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|Root resource classes found:
class test.war2.Service2|#]

[#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.api.core.ScanningResourceConfig|_ThreadID=23;_ThreadName=Thread-1;|No provider classes found.|#]

[#|2011-07-01T10:45:59.382+0200|INFO|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=23;_ThreadName=Thread-1;|Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36 PM'|#]

[#|2011-07-01T10:45:59.521+0200|INFO|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=183;_ThreadName=Thread-1;|WEB0671: Loading application ear-1.0#war-2-1.0.war at [/war2]|#]

[#|2011-07-01T10:45:59.535+0200|INFO|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=183;_ThreadName=Thread-1;|ear-1.0 was successfully deployed in 543 milliseconds.|#]

So this looks like Glassfish tries to load both services for each WAR module. When loading war-1, it cannot load test.war2.Service2, and while loading war-2, it cannot load test.war1.Service1...
Although, the application is correctly deployed and all the services do work !!

I guess this is a tiny bug, and could be fixed within a handful of lines. I could try to fix it, if someone could point me to the right module producing this warning.



 Comments   
Comment by mmuller [ 01/Jul/11 ]

Oops, looks like Jira didn't like my folder-tree syntax.

So, the EAR structure is

ear-1.0.ear
  META-INF/
    application.xml
  war-1-1.0.war
    classes/
      test/war1/Service1.class
    WEB-INF/
      web.xml
  war-2-1.0.war
    classes/
      test/war2/Service2.class
    WEB-INF/
      web.xml
Comment by Shing Wai Chan [ 01/Jul/11 ]

The calling stack is as follows:
StandardContext#callServletContainerInitializer
--> ServletContainerInitializerUtil#getInitializerList
--> ServletContainerInitializerUtil#checkAgainstInterestList

and the warning is coming from calling the checkAgainstInterestList method

The issue is from argument of calling the last method as follows:
1. Types classInfo contains the classes information for the ear
which is from WebModule#getTypes
wmInfo.getDeploymentContext().getTransientAppMetaData(
Types.class.getName(), Types.class);
2. WebappClassLoader cl, for war1, say, then it cannot load classes for war2

Even though the returned value of the method is correct, there is unnecessary call for loading other classes.

Comment by geturnerlmco [ 13/Oct/11 ]

This happens if there are multiple WARs, period. I have an application with 5 WARs, two are SOAP service endpoints and 3 are REST. If I remove 2 of the 3 REST WARS, I still get the WARNINGS. If I remove the 2 SOAP WARs, the WARNINGS are gone. I have searched every forum for an answer to this annoying problem, but this is the first one that is the closest to my problem. If anyone has a workaround other than destroying my EAR structure (which doesn't work well for fielding, ha ha) I would really appreciate knowing it.

Comment by geturnerlmco [ 14/Oct/11 ]

One additional comment that I thought would be helpful. I commented out all of the additional WARs from my application.xml but still built the EAR normally. The WARNINGS occured, just because the modules existed in the EAR directory structure, but the module definitions were commented out! Is the class scanner looking for ANY .class file in the EAR directory, whether it was defined to be part of the application or not???

Comment by Dan.Daneasa [ 23/Oct/11 ]

I have more comments on this.
I have 2 wars deployed in the same ear. One is a Jersey simple west app, the other one is an empty war.
I can see the ClassNotFoundExceptions.

There may be more to this problem. If i have an ear with 2 wars, one is a simple Jersey rest app, the other a simple Mojarra faces app. I see that the ClassNotFoundException is still present, also there are Mojarra-impl ClassNotFoundException warnings.
The same happens if i try to integrate MyFaces instead of Mojarra in the faces webapp.
Mojarra/Myfaces tries to load in the Jersey app as well, and vice-versa, Jersey tries to load in the Mojarra/MyFaces app.

If I have only one of the wars in the ear in any of the above combinations then the warnings are not present.

Comment by hpgisler [ 14/Nov/11 ]

Just for the record: Same problem here.

Two WAR's in an EAR
1. WAR JSF frontend
2. WAR REST frontend

If packaging only one of them into EAR, no problem; if packaging both inside EAR, Problem.

Comment by pettymt [ 10/Apr/12 ]

Confirmed on v3.1.1 (build 12)

30 WARs(each containing a REST service) in an EAR is a lot of warnings.

Comment by phealy [ 27/Mar/13 ]

I am getting a warning for every PimesFaces class every time I deploy (because I also have a Jersey app in my EAR). This does not reflect well on Glassfish.

Comment by nabizamani [ 13/Apr/13 ]

I have the same issue with GlassFish 3.1.2.2 (build 5) when deploying an EAR containing 2 wars and 1 ejb module (one of the wars contains restful web services).

Example:
WARNING: WEB9052: Unable to load class com.demo.service.exception.RestExceptionCatcher, reason: java.lang.ClassNotFoundException: com.demo.service.exception.RestExceptionCatcher
WARNING: WEB9052: Unable to load class com.demo.service.Order, reason: java.lang.ClassNotFoundException: com.demo.service.Order

RestExceptionCatcher is a @Provider and implements ExceptionMapper<Throwable>.
Order is a very simple REST service.

These warnings are very frustrating and I really want to get rid of them! But that would means I cannot use my EAR

Comment by yonatan [ 01/May/13 ]

If everything works properly, until the issue is resolved you can raise the logging level of that specific logger by adding javax.enterprise.system.container.web.org.glassfish.web.loader.level=SEVERE to the DOMAIN_HOME/config/logging.properties file.

Comment by andrey.v.markelov [ 07/May/13 ]

I have got the same trouble. Are you going to fix that?

Comment by Shing Wai Chan [ 25/Jun/13 ]

The given test case may need to update for GlassFish 4.

Comment by Daniel [ 25/Jun/13 ]

The web.xml for GF4 should use org.glassfish.jersey.servlet.ServletContainer API instead.

Comment by obfischer [ 17/Mar/14 ]

Is there a chance to get this fixed in the near future? Our monitoring reports all log messages with a log level above INFO. It is very annoying to warnings for a non-existent problem.

Comment by Philipp91 [ 21/Dec/14 ]

This issue should be prioritized higher. It may be a minor problem for people who's logs get flooded by these messages, but it is a major problem for people who can't use the REST services, which they deployed. The classes are not available, NoClassDefFound exceptions occur as follow-ups and the REST service is not available.

I use a simple JAR included in WEB-INF/lib.





[GLASSFISH-16199] IllegalArgumentException: object is not an instance of declaring class - on a REST / EJB Service Created: 13/Mar/11  Updated: 29/Apr/13  Resolved: 26/Mar/13

Status: Resolved
Project: glassfish
Component/s: jax-rs
Affects Version/s: V3, v3.0.1, 3.1
Fix Version/s: 3.1.1_b09

Type: Bug Priority: Major
Reporter: jraduget Assignee: Jakub Podlesak
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MacOs


Attachments: File restEjb.war    
Issue Links:
Dependency
depends on JERSEY-1813 Wrong handling method is used for EJB... Resolved
Tags: 3_1_1-approved, 3_2prd, jax-rs

 Description   

Hello,

I'm have the following error when deploying a JAX-RS / EJB service in a war or ear.

The exception : "java.lang.IllegalArgumentException: object is not an instance of declaring class"

Java code :

@Local
@Remote
public interface Echo {

   String echo(String message);

}

@Stateless
@Path("/echo")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public class EchoImpl implements Echo {

   @GET
   @Path("/send")
   public String echo(@QueryParam("message") final String message) {
	return message;
   }

}

public class RestResourcesApp extends Application {

   @Override
   public Set<Class<?>> getClasses() {
	Set<Class<?>> s = new HashSet<Class<?>>();
	s.add(EchoImpl.class);
	return s;
   }

}

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="WebApp_ID" version="3.0">
	<display-name>restEjb</display-name>
	<servlet>
		<servlet-name>RestResourcesServlet</servlet-name>
		<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
		<init-param>
			<param-name>javax.ws.rs.Application</param-name>
			<param-value>test.RestResourcesApp</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>RestResourcesServlet</servlet-name>
		<url-pattern>/rest/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
</web-app>

http://localhost:8080/restEjb/rest/echo/send?message=hello

works on tomcat 7.x, but failed on glassfish v3, V3.1

Please find attach war test case.

If you removed "implements Echo" in class EchoImpl , it will works

Regards,



 Comments   
Comment by jraduget [ 13/Mar/11 ]

A precision: the error occurred not at deployment step, but when I test the rest service with this uri in a browser :

http://localhost:8080/restEjb/rest/echo/send?message=hello

The full stack trace will be more convenient :

[#|2011-03-13T16:42:37.732+0100|SEVERE|glassfish3.1|com.sun.jersey.server.impl.application.WebApplicationImpl|_ThreadID=29;_ThreadName=Thread-1;|The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:167)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1347)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1279)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1219)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:680)

#]

Regards

Comment by Jason Lee [ 25/Mar/11 ]

Removing the rest-interface component, as it is unrelated to this issue. The rest-interface module is for issues with the GlassFish RESTful management interface.

Comment by Jakub Podlesak [ 30/Mar/11 ]

We work on a similar issue also with WLS guys.
To resolve this, we are going to

1) provide a hook in the resource method dispatcher logic
(will be reused by WLS, GF)
2) update the EJB integration layer in Jersey (GF specific)

Comment by Jakub Podlesak [ 03/Jun/11 ]

The plan is to have this fixed in Jersey 1.8. The fix should be available in the Jersey main trunk by June 17.

Comment by scatari [ 16/Jun/11 ]

Approved for 3.1.1. Please make sure to include "Fix in version" as "3.1.1_b09". Currently B09 is targeted for 06/23.

Comment by Jakub Podlesak [ 21/Jun/11 ]

Fixed in the Jersey main trunk, revision number 5119

Comment by ymenager [ 06/May/12 ]

I've just had that exact problem in glassfish 3.1.2, i thought this was supposed to be fixed in 3.1.1 ???

I've even downloaded the attached restEjb.war, and it fails in the exact same way

Comment by rherschke [ 26/Jun/12 ]

Please reopen this issue, due to it is not fixed and can reproduced in gf 3.1.2.

Comment by Jakub Podlesak [ 26/Jun/12 ]

This is a regression, as the app works fine with Jersey 1.8 in GlassFish 3.1.1
It is breaking again in Jersey 1.11 in GF 3.1.2

Comment by marina vatkina [ 26/Jun/12 ]

The EJB definition is not correct - see "4.9.7 Session Bean’s Business Interface" in the EJB 3.1 spec:

•The same business interface cannot be both a local and a remote business interface of the bean

Comment by rherschke [ 26/Jun/12 ]

Well, but this is not the reason for the error.

See http://www.adam-bien.com/roller/abien/entry/glassfish_jersey_exception_java_lang for a workaround. But sometimes, you have to expose your REST service as a remote session bean too, where the solution, Adam is suggesting in the url, will not fit.

Comment by marina vatkina [ 26/Jun/12 ]

If we would have a proper EJB validation during deployment, your application won't deploy. If you need to access your bean through a local and a remote view, you need to have 2 interfaces defined. Adam's example has a bean with a local view.

Comment by rherschke [ 26/Jun/12 ]

@marina vatkina:

You did not get the point:

(1) I did not give the example, attached to this issue
(2) I'm facing same problems with NO(!!!) Annotations (neither @Local nor @Remote) tagging the business interface
(3) I cannot tag the business interface due to it is in a third party dependency (well, could do this with aspectj but...)
(4) I know, that Adam's example use an @LocalBean annotation which will not fit in my scenario (as described before) with the requirement to have a Remote SLSB implementing the business interface and thats why the error occurs

I don't like to discuss about other's view of the specification nor about the correctness of others example.

I've written, that this issue is still reproducible in gf 3.1.2 esp. if there is no Annotation attached to the SLSB implementation nor the business interface.

So i'm very fine with Jakub's answer (which also leads to reopen this issue until another jersey version is available for gf 3.1.2).

Comment by Jakub Podlesak [ 02/Jul/12 ]

The regression should already be fixed in Jersey 1.13. Not sure yet, when this would get into GF. Most likely it will be included in GF 3.1.3.

Comment by Jakub Podlesak [ 26/Mar/13 ]

This has been fixed in Jersey 2.0-rc1, that has been integrated into the GF main trunk earlier today.

Comment by Jakub Podlesak [ 29/Apr/13 ]

The use case seems no longer supported by GF v4. The following error occurs when deploying the test web app:

+ asadmin deploy target/ejb-test-webapp.war
remote failure: Error occurred during deployment: Exception while deploying the app [ejb-test-webapp] : The interface org.glassfish.jersey.tests.ejb.resources.Echo cannot be both a local and a remote business interface. Please see server.log for more details.
Command deploy failed.




Generated at Sat Jul 04 11:09:55 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.