java-ee

two log4j files for EAR with two modules

喜欢而已 提交于 2019-12-25 03:13:10
问题 I have an EAR that is made up of two modules. Both expose services and share common code. Imagine that the ear has a common.jar shared by a webservices.war and webapp.war. I use log4j to log the activities. I would like to be able to have two log files (webservices.log and webapp.log) capturing the events that are specific to each of them plus all the stuff that is handled by the common.jar. How should I configure my categories and my appenders to achieve this? At the moment I have the

Re-inject CDI bean if some injected property changed

你。 提交于 2019-12-25 03:03:01
问题 I have a bean BeanA with injected property private int url : class BeanA { @Value(${"db.url"}) private String url; private DbConnection connection; } Let us say this Value annotation is similar to Spring Value . During initialization, connection will be initialized by using injected property into url field. And also there is some PostConstruct and PreDestroy methods in BeanA . My question is: is it possible to dynamically reinstantiate BeanA when url property changed. I have mechanism of

Custom session id generation implement UuidGenerator

旧城冷巷雨未停 提交于 2019-12-25 02:57:38
问题 i want to set cutom class for session id generation(Custom session id generation) in glassfish server , from my search till now i found that custom class should implement "com sun enterprise util uuid.UuidGenerator" class so i tried to create my own class as import com.sun.enterprise.util.uuid; public class Customsessionid implements UuidGenerator { public UuidGeneratorImpl() { } public String generateUuid() { return UuidUtil.generateUuid(); } public String generateUuid(Object obj) { return

Google maps and Markers, JSP

时间秒杀一切 提交于 2019-12-25 02:53:33
问题 I am working on a web application with Java EE and I would like to dynamically add markers to the Google map placed on my JSP page with coordinates from my database. I have the following code, but I can't pinpoint the issue <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01

Persisting entity to database with JPA and autogenerated primary key identity

送分小仙女□ 提交于 2019-12-25 02:42:18
问题 I have a full Java EE web application with a presentation layer and a database. I'm using derby with glassfish 3.1 and JPA to handle persistence. I've created a Read ok but now I'm having troulbe doing a Create and persisting to the database. I think I'm close but something is not right with the way I'm trying to do the create. Here is my EAO code: /** * Session Bean implementation class XRSSeao */ @Stateless @LocalBean public class XRSSeao { @PersistenceContext EntityManager em; public

Bug in debugging Red5 server as Java Application inside eclipse

送分小仙女□ 提交于 2019-12-25 02:37:24
问题 I am following Red5 Media Server - Workspace Setup Guide - r4737! I am able to build Red5 distribution and rename distribution jar files i.e completed upto step 6.But when I followed step 7 - Run inside of eclipse failed to debug it as java application - Red5 root: /home/yuvraj/Documents/RED5/red5 java code all/java/server/trunk Configuation root: /home/yuvraj/Documents/RED5/red5 java code all/java/server/trunk/conf Red5 server jar was not found, using fallback. URL list: [file:/home/yuvraj

CSS not working - Maven & EE

孤街浪徒 提交于 2019-12-25 02:33:04
问题 This is a quite basic question, but I just can't solve it. At first I had normal Java project and then I converted it to Maven Project (Configure -> Convert to Maven Project). Now the folder structure is looking like this. I don't have webapp -folder, is that a problem? Everything else is working, but I can't solve out the right path to CSS -file. <link rel="stylesheet" type="text/css" href="views/styles/common.css"/> I have this in my jsp's head, but it isn't working. I have also tried

CSS not working - Maven & EE

▼魔方 西西 提交于 2019-12-25 02:32:37
问题 This is a quite basic question, but I just can't solve it. At first I had normal Java project and then I converted it to Maven Project (Configure -> Convert to Maven Project). Now the folder structure is looking like this. I don't have webapp -folder, is that a problem? Everything else is working, but I can't solve out the right path to CSS -file. <link rel="stylesheet" type="text/css" href="views/styles/common.css"/> I have this in my jsp's head, but it isn't working. I have also tried

Server side J2EE Webservice gets null values on parameters

隐身守侯 提交于 2019-12-25 02:29:26
问题 I am a newbie at J2ee, What am I doing wrong here ? I am getting null values for my parameters. HTTP GET URL http://:8080/mypath?identity=abcd&identityType=1 Code @GET @Path("Request") @Consumes({ MediaType.TEXT_PLAIN }) public Response get(@PathParam("identity") String identity, @PathParam("identityType") int identityType) { System.out.println("Identity "+identity+" IdentityType "+identityType) ; Returns Identity null IdentityType 0 Client Side Junit Code String phoneNumber = new String(

How to get Client's IP address in Java? Request.getRemoteAddr() returns IP address of the machine on which Tomcat server is running

扶醉桌前 提交于 2019-12-25 02:29:04
问题 I am using the following code to get the Client's Ip Address. But for all the headers, i am getting null value. And request.getRemoteAddr() returns IP address of the machine on which Tomcat server is running. So, what is the efficient way to get the IP address of the machine from which request is coming ? private static final String[] HEADERS_TO_TRY = { "X-Forwarded-For", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED", "HTTP_X_CLUSTER_CLIENT_IP", "HTTP