glassfish-3

Possible to access remote EJBs from a custom LoginModule?

ぃ、小莉子 提交于 2019-12-10 11:02:07
问题 I found some nice hints on how to write a custom realm and loginModule. I'm wondering though if it is possible to access a remote EJB within the custom loginModule. In my case, I have remote EJBs that provide access to user-entities (via JPA) -- can I use them (e.g. via @EJB annotation)? 回答1: Ok, I found the answer myself: works fine! I can get a reference to the remote SLSB via an InitialContext. Here's the code: public class UserLoginModule extends AppservPasswordLoginModule { Logger log =

Unable to restart glassfish 3 server

ぐ巨炮叔叔 提交于 2019-12-10 10:14:24
问题 We have deployed application on glassfish3 server on Windows machine. The server and application were running fine. In the glassfish console, I restarted the server but it didn't start again. I also tried from the command prompt(as administrator) but getting below error log: C:\glassfish3\glassfish\bin> asadmin -p 4841 start-domain domain1 Waiting for domain1 to start ..Error starting domain domain1. The server exited prematurely with exit code 1. Before it died, it produced the following

Add Java EE Security Roles dynamically without using deployment descriptor

流过昼夜 提交于 2019-12-10 03:01:37
问题 I'm developing a Java EE 6 application using Glassfish 3.1, B06. To secure my app, i'm using a JDBCRealm and programmatic security. This works fine to check username and password. But when it comes to declaring security roles, i have a problem: To use Security Roles in Java EE 6, i have to declare those roles both in the EJB deployment descriptor and in the Glassfish-specific deployment descriptor to link those roles (as explained in the Java EE 6-tutorial) Only than i can use the method

Admin port configuration not found' error while setting up Glassfish config in IntelliJ

不打扰是莪最后的温柔 提交于 2019-12-10 01:45:46
问题 When setting up Glassfish in IntelliJ IDEA I get the following Error message ´Admin port configuration not found´. Now I searched high an low but I found no place where I can set the admin port. Searching Google all I found was a dead link on the JavaRanch. So Im not the first but the solution is lost. Does anybody know what is to be done? 回答1: IDEA GlassFish integration detects admin port from the file: <domain folder>/config/domain.xml XPaths checked: /configs/config[@name='server-config']

Glassfish 3 and import signed SSL certificate issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 17:54:12
问题 I am trying to install a signed SSL certificate into Glassfish but I failed. Here is the list of steps 1. I used keytool to generate new key pair (alias domain1) keytool -genkeypair -keyalg RSA -keystore glassfish/domains/domain1/config/keystore.jks -validity 1000 -alias domain1 2. Generate Certificate signing request (out - domain1.csr) keytool -certreq -alias domain1 -file **domain1.csr** -keystore glassfish/domains/domain1/config/keystore.jks 3. I used OpenSSL to generate my own Root CA

EJB 3.1. Is @Local annotation needed?

六月ゝ 毕业季﹏ 提交于 2019-12-09 11:39:56
问题 So far, I almost always worked with no-interface EJBs and have a slight understanding about the need of @Local annotation. Consider this example: public interface MyBeanIntf { void doStuff(); } @Stateless public class MyBean implements MyBeanIntf { public void doStuff(){ } } Should the MyBeanIntf be marked as @Local ? I don't see any benefit from that, because even when I don't annotate it as @Local , I still can use DI to properly inject it into UI Controller: @Named @SessionScoped public

how to use JPA life-cycle events to get entity data

拟墨画扇 提交于 2019-12-09 10:37:51
问题 I have a RESTful API that makes use of an entity class annotated with @EntityListners. And in the EntityListner.java, I have a method annotated with @PostPersist. So, when that event fires, I want to extract all the information regarding the entity that just got persisted to the database. But when I try to do that, Glassfish is generating an exception and the method in EntityListner class is not executing as expected. Here is the code public class EntityListner { private final static String

Glassfish @RolesAllowed with custom SecurityContext

柔情痞子 提交于 2019-12-09 04:57:41
问题 The question i'm about to ask is a bit tricky and I haven't found any answer yet. Maybe because i'm looking for the wrong thing. But i hope you will help me on this. I used the following tutorial to implement a custom SecurityContext that uses tokens instead of basic user/password authentication. Basically it initializes and injects a ResourceFilterFactory that will itself inject a ResourceFilter at every HTTP request sent to the application. This ResourceFilter searches for the

WebSockets, GlassFish, Grizzly — can't connect

天大地大妈咪最大 提交于 2019-12-08 14:37:35
I am trying to get started with WebSockets, and trying to write a simple application to send messages back and forth via a websoket. However, it looks like the socket that I am trying to create never gets connected. Why can that be? Below is the code of my WebSockets class. When .onConnect() is called, it logs: I am socket, I was connected. Am i connected? - false Update: in JavaScript, where I create the socket in question, the readyState is 1 , which means "socket open, communication is possble". import a.b.Misc; //writes logs. import com.sun.grizzly.websockets.BaseServerWebSocket; import

GlassFish 3.1.2.2 war can't find jar inside ear

喜夏-厌秋 提交于 2019-12-08 13:35:10
问题 I have built an ear with this structure (not all files shown here): myapp.ear/ myapp-ejb.jar myapp-web.war META-INF/ application.xml lib myapp-common.jar The problem is, when code in the war tries to reference classes in myapp-common.jar, it throws java.lang.ClassNotFoundException . Note the contents of META-INF/application.xml : <?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi