glassfish

Can I (and how) lookup CDI managed beans using javax.naming.Context#lookup in EJB module?

醉酒当歌 提交于 2019-12-17 22:20:18
问题 Can I (and if so, how?) lookup CDI managed beans using javax.naming.Context#lookup in EJB module? I'm using GlassFish v3. I suppose that I can use @Named , but what is JNDI name of CDI managed bean? I want to lookup them from unmanaged POJOs so I can't use @Inject . 回答1: You can lookup the BeanManager via JNDI ( java:comp/BeanManager ) then use the JSR-299 API hung off of the BeanManager to get a contextual reference to a managed bean. JSR-299 managed beans are not available for direct JNDI

EclipseLink “create-or-extend-tables” not working: “…unknown column…”

自闭症网瘾萝莉.ら 提交于 2019-12-17 21:23:52
问题 I am using EclipseLink 2.4.1 with Glassfish and a MySQL database for persisting entities. I added a field to an entity, and when I try to persist this entity it says the new field is 'unknown'. How are we supposed to use the new 'create-or-extend-tables' feature? I would have thought it would create a new column for this field. Some relevant information is below, let me know if you want more. Thanks in advance! Stack Trace ... Caused by: Exception [EclipseLink-4002] (Eclipse Persistence

How to bind List<Integer> values to selectManyListbox in JSF

有些话、适合烂在心里 提交于 2019-12-17 20:57:48
问题 The situation : I have a JavaServer Faces page and a session-scoped managed bean that has two ArrayList<Integer> properties: one for holding a list of possible values and another for holding a list of selected values. On the JSF page there is a <h:selectManyListBox> component with these two properties bound. The problem : after submitting the form the selected values will be converted to string (the property of type ArrayList actually holds a couple of strings!); however, when I use a

*.xhtml url-pattern causes java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading

ε祈祈猫儿з 提交于 2019-12-17 20:52:06
问题 I am trying to force JSF to process my welcome file. I have set the servlet-mapping in my web.xml to the following: <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> However, when I try to run my project after doing this, I get this exception: java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading(ELFlash.java:793) at com.sun.faces.context.flash.ELFlash.getPhaseMapForReading(ELFlash

DCH class error with JavaMail

独自空忆成欢 提交于 2019-12-17 19:35:05
问题 I'm attempting to set up a simple logging test with JavaMail in Java EE 6, using the jar files provided with Glassfish 3.1. There seems to be a wealth of questions out there on this subject, but I haven't found any answers that have helped yet. My test code looks like this: import java.util.logging.Logger; public class MyClass { private static final Logger LOGGER = Logger.getLogger("MyClass"); public static void main(String[] args) { LOGGER.severe("This is a test"); } } My logging.properties

Getting JSTL to run within Tomcat and Eclipse

余生长醉 提交于 2019-12-17 19:08:26
问题 I've been trying to get this to run, but I can't. I'm using Eclipse Galileo, Tomcat 5.5.23 and have several JSTLs around. My latest try was to use the GlassFish jar file "jstl-impl-1.2.jar". I placed it in Tomcat's shared lib, added it as external jar into my Eclipse project and exported it. Could anybody tell me, which jars to load in which folder and how to tell it to load in Eclipse? 回答1: It's very simple to include jstl in your projects, what I do is: Download jstl-1.2.jar (JSP 2.1

How to deploy portlets to Liferay?

£可爱£侵袭症+ 提交于 2019-12-17 18:40:52
问题 I have faced problems in trying to install new portlets to Liferay running on Glassfish domain. I figured out the flow very lately and want to share it with others also. So, please read the answer and hope this helps someone :) (Pre requisites for the problem is that I knew that adding projects running on Glassfish is done with a autodeploy folder, but making them visible on Liferay was another story.) 回答1: So, you make first a .war file let's say a portlet of name your_file.war. You wanna

dynamic roles on a Java EE server

不打扰是莪最后的温柔 提交于 2019-12-17 16:27:49
问题 I want to manage user and roles in a dedicated application. For example a user of this application ("customerX boss") can create a new role "customerX employee". If an employee accesses the Java EE application server (GlassFish 3) he should get the role "customerX employee". It sounds simple, but it is not supported by Java EE, because groups are mapped to roles at start-up time and the roles within the application are static. What is the best way to manage user roles at runtime in a Java EE

GlassFish: How to set Access-Control-Allow-Origin header

被刻印的时光 ゝ 提交于 2019-12-17 16:11:58
问题 I am using the latest version of GlassFish. I want to set the Access-Control-Allow-Origin header in response so that my API which is hosted on GlassFish can be called from any domain. But I am not able to find out where to set it. 回答1: In my case, the API requests are exclusively handled by Jersey, therefore I can set response headers in a ContainerResponseFilter : package my.app; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerResponse;

How to setup JNDI for Glassfish 3.1.2 for a stand-alone client?

二次信任 提交于 2019-12-17 14:18:44
问题 I try to connect from a stand-alone swing client (running in a separate JVM on the client machine) to the Glassfish server. I currently use the following settings from Netbeans and everything works just fine: System.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory"); System.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming"); System.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi