glassfish-3

How to use 3rd party libraries in glassfish?

大兔子大兔子 提交于 2019-11-26 16:18:42
问题 I need to connect to a MongoDB instance from my EJB3 application, running on glassfish 3.0.1. The Mongo project provides a set of drivers, and I'm able to use them in a standalone Java application. How would I use them in a Java EE application? Or maybe better phrasing: how would I make a 3rd party library available to my application when it runs in an EJB container? At the moment, I'm getting a java.lang.NoClassDefFoundError when deploying a bean that tries to import from the library: [#

How should I log uncaught exceptions in my RESTful JAX-RS web service?

三世轮回 提交于 2019-11-26 15:45:23
问题 I have a RESTful web service running under Glassfish 3.1.2 using Jersey and Jackson: @Stateless @LocalBean @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("users") public class UserRestService { private static final Logger log = ...; @GET @Path("{userId:[0-9]+}") public User getUser(@PathParam("userId") Long userId) { User user; user = loadUserByIdAndThrowApplicableWebApplicationExceptionIfNotFound(userId); return user; } } For expected exceptions, I throw

How to set response header in JAX-RS so that user sees download popup for Excel?

人盡茶涼 提交于 2019-11-26 12:13:10
问题 I wrote code that generate Excel file using REST JAX-RS and I confirmed that the generated Excel file is in GlassFish server directory. But my goal is when user click on the button (which generate Excel .xls), I want download popup to show up asking user whether to save or open the .xls file just like any other web services doing for downloading any type of files. According to my search, the step is: generate Excel .xls (DONE) write the excel to stream in JAX-RS file, set response header to

eclipse error: glassfish\domains\domain1 does not exist

偶尔善良 提交于 2019-11-26 11:31:34
问题 I have java ee6 web profile sdk & I am using eclipse ee. I installed Glassfish plugin for eclipse using Download additional server adapters in the New Server wizard. Now during building a test app, eclipse raise this error glassfish\\domains\\domain1 does not exist . Whats the reason & how can I remove it? 回答1: Either your eclipse glassfish plugin points to the wrong domain or your server has no domain although there should be at least a default domain which is usually named domain1 . Check

Where to use EJB 3.1 and CDI?

微笑、不失礼 提交于 2019-11-26 08:38:59
问题 I am making a Java EE based product in which I\'m using GlassFish 3 and EJB 3.1. My application has session beans, a scheduler and uses web services. I recently came to know about Apache TomEE, which supports Contexts and Dependency Injection (CDI). The GlassFish container also supports CDI. Can I replace session beans where I do not require any feature that CDI also doesn\'t already provides? And if then, what are the benefits I can get? 回答1: Yes, you can freely mix both CDI and EJB and

How to install the GlassFish 3 server adapter with Eclipse Helios 3.6

允我心安 提交于 2019-11-26 08:13:12
问题 Question as stated in the title: how to install the GlassFish Server Adapter on Eclipse Helios 3.6? 回答1: Eclipse Helios 3.6 At the time of writing this (07/26/2010), there are in theory two ways to install the GlassFish Server adapter: via the Eclipse Marketplace or via an update site. Update: As mentioned by Thorbjørn in a comment, the adapter is now (09/24/2010) available in the Additional server adapters dialogue (the "normal way"). New Server There are several ways to do this but one ways