Environment Independent Single WAR Generation
Oct 8, 2014
I have a project which has a set of configuration files, where each configuration file represents an environment specific configurations. In other words, I have 3 environments, development, staging, and production. The configuration for each environment is different, e.g. DB name, url etc.
Whenever I want to deploy the same code, on each environment, I have to manually generate environment specific .war file, so that it has environment specific configuration file in it.
What I am looking for is a kind of solution where i have to compile only once in maven and it generates only one .war file, which I can use on every environment. In other words, i want the environment specifi application server/tomcat to identify which configuration to pick.
That way, I'll be sure that we are deploying and testing the same .war file on every environment/application server.
How can i restructure the application to achieve this functionality?
View Replies
ADVERTISEMENT
Feb 16, 2015
Is it possible to map URL's with independent view dir structure? If so how?
My goal is to simply point an url to a specific view file:
i.e.
[URL] ....
to
not/default/path/views/main/index.xhtml
and
www.myserver.com/application/admin/
to
not/default/path/views/admin/index.xhtml
A couple solutions I found so far where:
Solution 1
PrettyFaces
I just didn't wanted to use a third party solution. This is my best solution so far.
Solution 2(a JSF solution):
navigation rule entries in the faces-config.xml file.
A bean is required, not a bad thing in above example but not great in combination with static navigation like:<h:commandButton action="index"/>
Solution 3 (another JSF solution)
Resource Library Contracts
This forces me to work in the contracts file.
None of the solutions gave me a clear solution except prettyfaces.
Are there some elegant native JSF solutions ? Something flexible and reusable? Something like a mvc controller i used to use in php applications. In this controller I was able to add a template file in the constructor and an content file in specific function. Custom paths where no problem. I didn't want to use mvc nor the php language in this project.
View Replies
View Related
Aug 12, 2014
I have just started learning Java from a local teacher, this teacher said that the Architecture Neutral refers to Hardware while Platform Independent refers to Operating System, but I found a link to a White Paper by James Gosling. The chapter 4 of this White Paper mentions about both binary code format that is independent of hardware architecture and operating system interfaces, but the main point to be noted is that he has put both under the heading Architecture Neutral. Does it mean that the original buzz word is Architecture Neutral, which includes both hardware and operating system independence?
View Replies
View Related
Jan 21, 2014
I Have one query regarding OTP, In my project while registration the otp should be generate and send to the mobile number of user which is registered the form.
View Replies
View Related
Apr 13, 2014
I am new in this programming language, java. I have a problem after I set my path ";C:Program Files (x86)Javajdk1.7.0_51in". I made a simple program but an error occurred. Here's the screenshot.....
Attached image(s)
View Replies
View Related
Dec 7, 2014
The problem you have is that it doesn't produce a 4x4 array. For that you need more nested for loops.This is what I have tried so far:
import java.util.Scanner;
import java.util.Random;
public class challenged2e
{
static Scanner console = new Scanner(System.in);
public static int i=0;
public static void main (String args[])
[code]...
I get 21 errors and they all have to do with i and j.
View Replies
View Related
Feb 9, 2014
I am generating pdf and displaying it in separate window/tab using the approach described in BalusC Code: PDF handling.I need to display blockui ajax loader when i select the commandlink to display pdf.The pdf gets generated but the ajax loader image remains as it is.I need to manually refresh the page to hide it.Is there any way using which it can be hidden as soon as the pdf gets displayed.My code snippet is as below
JSF page
<h:form id="subFrm">
<p:commandLink value="Download PDF" action="#{pdfBean.downloadPDF}"
onclick="blkUi.show()" oncomplete="blkUi.hide()" id="cmdLink"
ajax="false" />
[code]....
View Replies
View Related
Jul 5, 2014
I want to do a Registration page on some website. i connected to mysql and creating some id like 1 and 2 like this , but i don't want like this. i want to generate v21001 and v21002 to generate on every registration.
View Replies
View Related
Jul 18, 2014
Can we use EJB @Asynchronous annotation in distribute environment. I know we can use it but I want to know its Advisable or not. Because It's not advisable to manage user thread in Distribute environment like EJB container .Earlier if we want to make Asyn call then we use JMS. But now they added @Asynchronous annotation with Future Class to achieve the same result.
View Replies
View Related
May 22, 2014
I want to generate a new tile every 1,5,10,15 (please check the code to gain an understanding of where I'm going) the session last for 4m :20 sec, I need using the date package, I tried using the sleep method however I don't want to pause the whole thread, so I need setting up the time aspect of the key generation (assume all other code works).
Java Code:
import info.gridworld.actor.*;
import info.gridworld.grid.*;
import java.awt.*;
import java.util.*;
//importations, just in case you were wondering
//locations and actor world are set up
//assume all other code works
[Code] ....
I'm using grid world to set up the locations, the tiles are actors that move south every turn
View Replies
View Related
Sep 5, 2014
I am developing an inhouse project in my organization. I unable to implement the pdf uploading, downloading, report generation logic as i am totally new to this implementation.
View Replies
View Related
Jan 23, 2014
I am having a doubt about how to fix and what could be the code to generate a retroActive salary case in payroll generation. Upto last year(2013) it was working fine.Now it is 2014 and i am stuck as i am new to java.
The system is computing every value in yearly basis,but the inputs are in monthly basis.
View Replies
View Related
Aug 26, 2014
Flow of this program?
public class ThreadA {
public static void main(String [] args) {
ThreadB b = new ThreadB();
b.start();
synchronized(b) {
[Code] ...
View Replies
View Related
Sep 19, 2014
I am trying to run tshark command using runtime environment in java on ubuntu . My code is as follows :-
try {
String destip = map1.get((String) innObj.get("value"));
Runtime run = Runtime.getRuntime();
String tshk = "/usr/bin/tshark -r /home/pratibha/Desktop/vox.pcap -Y "ip.dst == "
+ destip
+ " && http" -T fields -e tcp.port -e col.Info";
Process pr = run.exec(tshk);
[Code]...
map1 is hashmap which contains the destination ip adress When i run the above code the exit code for process (pr) is 1 and hence the tshark command is not executing properly.
View Replies
View Related
Jul 8, 2014
While executing my application i came across with this unexpected error which i don't know why?
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fdcacd79a9, pid=4980, tid=7724
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [ntdll.dll+0x79a9]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit: [URL} .....
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
View Replies
View Related
Sep 4, 2014
how would a program code look like, input ten words and output them backwards in a msdos environment. My code this far is:
package baktext;
import java.util.*;
import java.io.*;
import java.awt.*;
//public static String baklänges(String s) {
//}
public class Baktext {
[Code] ....
View Replies
View Related
Apr 8, 2014
I need to generate reports for huge data (around 2 to 5 lakh records) in different file formats (PDF , XLS , RTF , XML) in my web application.
Data will be fetched from database.
I have been searching for a best open source report generation tool and ended up on choosing on Dynamic Reports.
Aspose , is licensed and unluckily we could not afford to at this moment.
Whether i can use Dynamic Reports , or is there any other tool available.
View Replies
View Related
Jan 22, 2015
I am writing a payroll program .The program generates random PPS numbers and then takes in users information and calculates the salary accordingly. I am using netbeans and my code is showing errors on line 18 and 42 ("cannot find symbol")on the code for grossPay(). The program seems to crash after a new PPS number is generated and will not run.
package sd_assg_2;
import java.util.Arrays;
import java.util.Random;
import javax.swing.JOptionPane;
public class SD_ASSG_2 {
public static void main(String[] args) {
String[] newPPs = getPPSno();
[Code] ....
View Replies
View Related
Mar 13, 2015
I was having trouble running some Java programs (not my own) in Windows XP, and in the process I uninstalled and installed JRE versions 6, 7, and 8, one at a time, probably in the order 7, 8, 7, 6, 7. The program that had the original problem only worked in V6, but some other programs stopped working. I went back to V7, and those other programs still didn't work. The message was "the registry refers to a nonexistent java runtime environment installation". The only advice I could find with Web searches was to reinstall the JRE. Needless to say, that didn't work.
So I looked at the registry, and I found that there were still references to V8, which had been uninstalled. The first was
HKEY_CLASSES_ROOTjarfileshellopencommand - (Default) = "C:Program FilesJavajre1.8.0_31binjavaw.exe" -jar "%1" %*
The folder re1.8.0_31 doesn't exist, so I changed it to jre7. That didn't work.
Then I found
HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment - CurrentVersion = 1.8
I changed this to 1.7, and deleted some following entries such as
HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment1.8 - JavaHome = C:Program FilesJavajre1.8.0_31
retaining entries such as
HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava Runtime Environment1.7 - JavaHome = C:Program FilesJavajre7
That worked!
So, there is a bug in the installer(s): if you uninstall V8 and install V7, the 'CurrentVersion' isn't set correctly, with the result that the registry points to a non-existent folder. The V8 uninstallation should delete these entries, or the V7 installation should change them.
View Replies
View Related
Jun 30, 2014
I have installed and tested j2se jdk8 u5 on my Windows 7 64 bit laptop and successfully tested in Eclipse with a quick Hello World.
JAVA_HOME = C:Program FilesJavajdk1.6.0_25
When I try to install j2ee jdk7 sdk7 I get
Error: Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'
View Replies
View Related
Feb 25, 2015
I want to create off-screen images by Canvases in multi-thread environment.
I know that I use methods of GraphicsContext2D to draw on Canvas. Can I do this on Canvas which is not added to Scene ?
How can I get an image from a canvas after I invoke GraphicsContext2D methods? Can I get images in multi-thread environment ?
View Replies
View Related
Feb 18, 2014
I have a task of returning US holiday based on the given date and this utility will be used in a multi thread environment. I have written as below, how to know if my code breaks at any given point by multiple threads
Declared Enum
public enum Holiday {
CHRISTMASDAY("Christmas Day"),
GOODFRIDAY("Good Friday"),
INDEPENDENCEDAY("Independence Day"),
LABORDAY("Labor Day"),
NONE("None");
[code]...
I tried to test this with few concurrent threads, and noticed that the DB call is made for the very first time or when the year being requested is not same as the cached year. But I wanted to see, if this is properly synchronizing and would not fail in any case. My intention is to make a singleton HolidayCalendar, and also synchronized well enough so that every thread using this class gets the required data without blocking each other.
View Replies
View Related
Apr 25, 2014
why exactly this isn't printing out the correct way.I'm supposed to print out 100 elements from an array but assign them random integers between 0 and 9.I've tried troubleshooting the issue and when I do it seems i'm only getting one element assigned.
public class Exercise_6_7{
public static void main(String[] args){
int[] counts = new int[100];
for(int i=0; i<counts.length; i++){
counts[i] = (int)(Math.random()*10);
[code]....
View Replies
View Related
Mar 31, 2013
When I click on "Clean and Build" NetBeans generates a .jar file and inside the folder "dist" it add a directory called "lib" with all the java libraries used to implement the program. I would like to achieve with this IDE an unique .jar file that includes everything you need such as Eclipse does by default. Is it possible?
View Replies
View Related
May 27, 2014
I am coding a game and I am trying to implement a pause and unpause button. in the BoardPanel class I've added the button's 'p' and 'o' to game.wait() and game.notify() (main code is in game class). however the game.wait is having issues and even if i throw interrupted exception or try/catch it doesn't work. I'd like to code it to a single button if at all possible.
View Replies
View Related
Dec 14, 2014
Is there a way to multiply two single arrays in which the corresponding iteration from one array multiplies with the corresponding iteration from the second array. For example say you have array1[] and array2[]. Each array has a length of 5. Is there a way to multiply array1[0] by array2[0] and array1[1] by array2[1] and so on.... without having to actually write out the equation of array1[0] + array2[0] = someValue for all iterations of the two arrays?
View Replies
View Related