glassfish-4

Using a secured EJB from a JAX-RS web service

浪子不回头ぞ 提交于 2019-12-06 01:12:16
I'm running Glassfish 4 and Jersey as JAX-RS implementation. I have secured my EJB like this: @Stateless @DeclareRoles({"Authentication_Reader"}) @RolesAllowed({"Authentication_Reader"}) public class AuthenticationServiceBean { public void foo() { ... } } I have created a security-role-mapping entry in glassfish-web.xml, and I've also created a security-role declaration in web.xml. The following works from a servlet: @WebServlet(name = "TestServlet", urlPatterns = {"/test.do"}) @RunAs("Authentication_Reader") public class TestServlet extends HttpServlet { @Inject private

GlassFish 4.0 / Jersey 2.0 - NoClassDefFoundError for JsonStructureBodyReader

旧街凉风 提交于 2019-12-05 23:11:46
I'm using GlassFish 4.0 R89 on my dev system, working with JAX-RS. Simple calls work, so I can get a serialized object, represented in XML. I had to install that on the machine of a guy who will also be involved in the coding process, and I also tried that on my notebook - and I'm getting the same result - a NoClassDefFoundError is thrown for the class JsonStructureBodyReader (although I'm not even using JSON, tried that, the server definitely returns XML with correct headers for the content-type). I thought I might have imported a project incorrectly, but after a comparison of the files in

How to fix a javax.naming.NamingException: Lookup failed

烂漫一生 提交于 2019-12-05 13:15:30
I'm trying to persist an entity via a simple jsp form but it doesn't work. the exception that appear is : javax.naming.NamingException: Lookup failed for 'java:global/jee-projet-web' . I'm using glasfish as server. This is the code of my form: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Add admin</title> </head> <body> <p id="info"> ${info} </p>

Prevent Glassfish from using its own versions of libraries instead of those in a project

喜你入骨 提交于 2019-12-05 02:00:00
问题 Glassfish has whole bunch of third-side libraries stored in its modules directory. To my surprise, if my project uses a library which is present there, Glassfish will provide it from there, instead of the right version I have packed-in in my WAR file. This leads to a number of errors. For example, I use jackson-datatype-joda version 2.6.3, which requires jackson-databind with same version, and it is included in my project. But Glassfish replaces that package with version 2.3.2, which leads to

Glassfish 4 server stops unexpectedly

帅比萌擦擦* 提交于 2019-12-04 12:01:23
问题 I'm new to GlassFish, and to application servers in general. I have an Amazon EC2 instance running Ubuntu and have installed GlassFish 4. It starts up without problems, but after a while the GlassFish server just shuts down all by itself. I have looked through server.log, but everything seems normal, and there are no entries describing any failures or shut down. Any input on what can be the cause, or where I should look to find any clues? 回答1: I am facing the exact same situation. I suspected

How to setup an empty password for a MySQL connection pool in glassfish 4 from the GUI?

核能气质少年 提交于 2019-12-04 08:17:57
Im being unable to set an empty password for a MySQL connection pool from the GUI in glassfish 4. In previous versions of glassfish it used to work by simply putting "()" without the quotes. It doesnt work anymore for me in glassfish 4. By the way, I've been googling my issue with any luck. Does anyone know what is the proper way to do it in glassfish 4? Thanks in advance for you support Regards What I did to fix this was to manually in /glassfish/domains/(yourDomainName)/domain.xml add the following property to the connection pool: <property name="password" value=""></property> Remember to

Glassfish 4, JSF 2.2 and PrimeFaces FileUploadEvent not working together

浪尽此生 提交于 2019-12-04 05:31:20
After upgrading to GlassFish 4 and JSF 2.2 Primefaces FileUploadEvent stop working. With JSF 2.1 it was working with no problem. Everything is working fine except file uploading. Is there something that I am missing? GlassFish 4 JSF 2.2 PrimeFaces 3.4.2 and 3.5 Commons io version: 2.4 Commons fileupload version: 1.3 Controller side public void handleFileUpload(FileUploadEvent event) { System.out.println("HandleFileUpload"); byte[] file = event.getFile().getContents(); newFieldset.setData(file); FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");

Adding glassfish Server in Eclipse Kepler error

怎甘沉沦 提交于 2019-12-04 04:46:46
问题 I am trying to add Glassfish-4 server to Eclipse in order to be able to run applications on this server, but at the final step in "new Server" wizard, finished or next buttons are disabled and a message says: to enable Install Server, enter a path to a new directory.. The Glassfish server is found on the given path. I can't add images because I don't have reputation, but here are the links: http://tinypic.com/view.php?pic=18yck1&s=5#.Umeq3vmnosY http://tinypic.com/view.php?pic=13yezcm&s=5#

Prevent Glassfish from using its own versions of libraries instead of those in a project

五迷三道 提交于 2019-12-03 16:49:52
Glassfish has whole bunch of third-side libraries stored in its modules directory. To my surprise, if my project uses a library which is present there, Glassfish will provide it from there, instead of the right version I have packed-in in my WAR file. This leads to a number of errors. For example, I use jackson-datatype-joda version 2.6.3, which requires jackson-databind with same version, and it is included in my project. But Glassfish replaces that package with version 2.3.2, which leads to this issue . How can I prevent Glassfish (4.1) from replacing the libraries I use with another

Accesing JobContext from a partitioned step in JSR 352

无人久伴 提交于 2019-12-03 15:38:42
I'm trying to pass an object between batchlets, but I've encountered a problem when trying to access the jobContext from a partitioned step (batchlet). According to the JSR 352 Specification 9.4.1.1 Batch Context Lifecycle and Scope: A batch context has thread affinity and is visible only to the batch artifacts executing on that particular thread. A batch context injected field may be null when out of scope. Each context type has a distinct scope and lifecycle as follows: 1. JobContext There is one JobContext per job execution. It exists for the life of a job. There is a distinct JobContext