Export And Import Of Configuration Files

Apr 24, 2015

I have a library that I'm writing, the library contains a spring xml configuration file (lets say it's called libraryContext.xml) that sets the library up correctly for runtime, it also includes a test spring xml file that sets the library up for test by importing libraryContext.xml and overriding certain dependency injection beans (the library basically connects to a real database under normal conditions and uses dummy DAO's under test conditions). That bit is all fine.

The thing is, when I build the jar for the library (lets say it's called library-0.1.jar), the jar does not seem to contain the libraryContext.xml and that means that I can't import library.xml into my applications context.xml.

Basically, I have this line in my applications context.xml

Java Code: <import resource = "classpath:libraryContext.xml"/> mh_sh_highlight_all('java');

Unsurprisingly, since the xml file is not contained in the library-0.1.jar, the error I get is,

Java Code:

Offending resource: class path resource [applicationContext.xml];
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource [libraryContext.xml];
nested exception is java.io.FileNotFoundException: class path resource [libraryContext.xml] cannot be opened because it does not exist mh_sh_highlight_all('java');

With respect to potential solutions to the above problem, I could:

1) physically copy the libraryContext.xml file (and its other *.xml and *.properties dependencies) into the application, but then I'd have to maintain duplicate files - I don't like this option.

2) find out if there is a better way to handle this problem from people who know better. E.g. is there a way to embed the libraryContext.xml file (and it's dependencies) into the jar file so that it can then be imported into the application. I've spent a while on google trying to figure this out and haven't come up with anything overly useful (perhaps I've been using the wrong search parameters).

View Replies


ADVERTISEMENT

Making Import / Export Of XML

Sep 17, 2014

I'm making an import/export of xml - I have the import of xml sorted I'm just trying to finish off the export. My export class is called XmlWriter.java. Inside the class I have an updateFile method to update an xml file as such:

public void updateFile(Environment environment,Document doc)
{
// code
}

I then in my main method have

public static void main(String argv[]){
 //declare new object of class
XmlWriter xmlWriter = new XmlWriter();
//test testUpdate method
// xmlWriter.testUpdate();
 Environment environment = ;

[code]....

I don't know what to make my variables equal to - eclipse keeps trying to use null but obviously that won't work. The Environment is another class that just contains getters and setters for the 3 different databases (that are in the xml file) and the getter/setter for the environment ID (also in xml file).

View Replies View Related

Servlets :: Why All Configuration Files Are In XML Format

Mar 3, 2014

I dunno why all the configuration files for ex: web.xml and struts.xml in any web application are xml files.

View Replies View Related

Create A Database Configuration File And Include All Other Files

Apr 19, 2014

I am creating an application in core java where i am using database. I need to create a database configuration file & include it all other files. So, how can i do that ?

Java Code:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:MYDSN","system","tiger"); mh_sh_highlight_all('java');

I cannot do this in an interface since only abstract methods exist there. I tried to create an another class file to extend it but my program is already extending other class i.e. javax.swing.JFrame..How can i implement this ? just by creating the object of that class in main method ?

View Replies View Related

File Import Which Is Not Standard Import

Apr 5, 2014

Usually, most of the time, I import the standard java stuff.But what happens when I find a code with a list of those com. imports:

import java.io.File;
import java.io.IOException;
import com.itseasy.rtf.RTFDocument;
import com.itseasy.rtf.text.Border;
import com.itseasy.rtf.text.Field;

Where are these imports and how do I "get" them?

View Replies View Related

JSP :: Could Not Load Tomcat Server Configuration

Jul 31, 2014

I am using RAD and I copied the Tomcat server from server to local folder. Then I tried to add this tomcat by adding new server. I got the error in title. After searching, I copied the Tomcatconf files to myworkspaceserver omcat at localhost-config, restart RAD and refresh. But now I am getting the error that the conf may corrupted or incomplete.

View Replies View Related

Spring MVC - Java Based Configuration

Aug 16, 2014

For some time i've been trying to rewrite my XML configurated webapp into one that has Java Based cofiguration. Unfortunately ,even after going through many tutorials i've been unable to do so.

View Replies View Related

Singleton For DirContext For LDAP Configuration

Aug 9, 2013

I want to create a singleton for DirContext for LDAP configuration, hence i have used the initialize on demandclass holder idiom as shown below

public class SlmApplicationContext {
/**    
* inner class to hold the instance.    
*/   
private static class Holder {       
private static DirContext instance = new InitialDirContext();   
}
   
/**    
* Method to get the singleton instance of this class.    
* @return SlmApplicationContext    
*/   
public static SlmApplicationContext getInstance() {       
return Holder.instance;    }       
...       
}

Now the problem is if i close the DirContext.close(), when the next request comes the singleton wont    work as the dir context is already closed, hence it will create a new dir context for each requests. Which breaks the singleton concept, hence how we can ensure the  singleton works fine even with DirContext.close()?

View Replies View Related

How To Set State Of Radio Button Based On Configuration File

Apr 10, 2014

I am using Java Swing to create a GUI. I have some radio buttons on a JFrame that gets opened when the user makes a certain selection. I want to read a config file to have the radio buttons selected or deselected when the form is opened to indicate the current state of the radio button based on the saved config file.

How do I go about setting the radio button as selected (visibly selected) when I open up the JFrame?

I was trying to use RadioButton.setSelected(True); but this doesn't actually visibly select the radio button.

View Replies View Related

Get Access To Either Logger Or LogManager Class And Print Current Configuration

Oct 22, 2014

I want to know if I can get the entire log4j.properties file constructed in Java code. I am not talking about configuring the logger using Java code.I have a logger that is already configured using a file. I want to get access to either Logger or LogManager (any other?) class and print the current configuration that is in memory.

View Replies View Related

JSF :: How To Export Page To PDF

Apr 1, 2015

how to export a full jsf page to PDF. In my jsf page, I have a button to export to PDF and some fields where I am retrieving the values from a database. The form is ready but I don't know how to program code or program a button to export the page to PDF. I tried to search for an easy and a standard way but unfortunately I didn't find any useful example or code.

View Replies View Related

How To Export The Page To PDF

Apr 1, 2015

How to export a full jsf page to PDF. In my jsf page, I have a button to export to PDF and some fields where I am retrieving the values from a database. The form is ready but I don't know how to program code or program a button to export the page to PDF.

View Replies View Related

Export To Jar With More Than 1 Class

Feb 8, 2014

I create a snake game. Ant this game have more than 1 class. So i need this thing export to jar.. So i have question:

1.Do i have insert to public static void main(String[]args) method to somewhere class?
2.How to export to jar with more than 1 class..

And again, if I must insert main method in somewhere class, so which class?

snakeCanvas.java :

import java.awt.Event;
import java.awt.Point;
import javax.swing.event.*;
 import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;

[Code] .....

View Replies View Related

Export To Runnable Jar

Oct 29, 2014

My app uses docx4J, XStream, and also uses an image on the start page. I placed all of this external libraries in Java Buid Path and in Eclipse it all works well but when I export all data to runnable jar file it doesn't work.

View Replies View Related

JSP :: Export To PDF Format

May 24, 2006

I'm doing a project in JSP and Oracle..Here in my project there are two types of department.. Accounts and Sales.. Accounts department is able to download some pages to Excel format and it is working properly.. now in the sales they have to download in pdf format.. then only it is possible to send to the HO..now what they are doing is downloading the JSP page in excel format and converting to pdf manually using the Acrobat Printer.. is that possible to change to pdf format.. for converting to excel format.. i'm just using 2 linesand it is here

<%@ page language="java" session="true" import="java.sql.*" import="java.lang.*" contentType="application/vnd.ms-excel" %><%response.setHeader("Content Disposition","attachment; filename=test.xls");%>

in the filename side i chaged to test.pdf.. and in the contentType i changed to Acrobat readerand it is downloading but cannot view the content

View Replies View Related

MySQL DB Export To Excel Using JXL?

May 2, 2015

I am trying to export a DB record to an excel sheet. Below is the code which I tried. I am not getting any error but still only the first record of the table is getting inserted into the excel sheet. But when I try printing, I prints all the records. Below is the code I did to insert records.

for (int i=0;i<ColumnCount;i++) {
System.out.println("Inside for");
Label label=new Label(i,0,rsmd.getColumnName(i+1),cellFormat);
sheet.addCell(label);
WritableCell cell = sheet.getWritableCell(i+1, 0);
System.out.println("Column " + rsmd.getColumnName(i+1)+ " inserted");
cell.setCellFormat(cellFormat);

[code]....

I hope i am making a logical mi stake in the for loop. But still i am unable to locate that.

View Replies View Related

JSP :: Java Program To Export To Excel

May 28, 2014

I have a JSP and Java program which will read data from Excel and add them dynamically to create table.My requirement is i should able to edit the columns what ever the data that was fetched from Excel and export those contents to another excel file.This should happen on clicking a button, i mean to exporting the contents of the table.

View Replies View Related

Java Game Export Error

May 8, 2014

So I am creating a game in Java, the game works fine when I run it in Eclipse but when I export it it does not draw anything on the screen.

I added a try and catch for nullpointerexceptions but the game does not throw any nullpointerexceptions.

What is the problem?

The game seems to be finding all the images & resources since it does not throw any NullPointerExceptions...

View Replies View Related

JSF :: Export To Excel With Indexing Feature With Icefaces 1.8.2

Feb 24, 2014

As of now am using icefaces 1.8.2 provided tags for downloading data into excel sheet where i can download all the data from a data table. But now the requirement is like need to download the data into excel sheet based on values passed from UI as parameters to the action class method.

Attaching the code snippet along with this post.

CustomerList.xhtml :-
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<ice:outputLabel value="Export:" />

[Code] ....

View Replies View Related

Export Runnable Jar File That Requires LWJGL

Aug 13, 2014

I'm trying to export a runnable jar file that requires lwjgl. Everything works in eclipse as I'm using

-Djava.library.path=nativewindows

as a VM Argument for the jinput .dll files.

After exporting & launching the jar it doesn't work of course! I get this error:

java.lang.UnsatisfiedLinkError: no junput-dx8 in java.library.path

I'm not sure how to make it work outside of eclipse....

View Replies View Related

Export Solaris Display On Linux And Trying To Launch JNLP

Feb 23, 2015

I am trying to export Solaris Display on Linux and trying to launch JNLP.

I am trying to follow the instruction mention in the following URL.

[URL] .....

I would like use the property mentioned in the above article in JNLP file on client side .

I did following nothing is working.

1. <argument>awt.toolkit=sun.awt.motif.MToolkit </argument>
2. <property name="awt.toolkit" value="sun.awt.motif.MToolkit"/>
3. java-vm-args="-Dawt.toolkit=sun.awt.motif.MToolkit"
4. export AWT_TOOLKIT=MToolkit

How do i check JNLP client is using it?

View Replies View Related

Java Servlet :: Not Able To Export File As WAR To Webapps In Tomcat Home

Jun 30, 2013

Below is my first servlet program:

FirstServlet.java:
 
package edu.aspire;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;

[Code] .....
 
web.xml:
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

[Code] ....
 
Deployement:

To deploy my project into %TOMCAT_HOME%webapps folder.
Right click on Project ->Export-> War File
Project Name: Hello
Destination: D:Program FilesApache Software FoundationTomcat 6.0webappsHello.war
 
Result found in web browser:

HTTP Status 404 - /Hello/first 
And Hello.war file is not found in webapps folder too after exporting as .war.
I am using Apache tomcat 6.0.37, eclipse 3.7.2 release, tomcat plugin :com.sysdeo.eclipse.tomcat_3.3.0

View Replies View Related

Servlets :: Fetch Data From Backend (DB2) And Export To Excel - Slow File Download

Jan 31, 2014

Recently we got an issue about file download. We are using below code to fetch the data from backend(DB2) and export to excel.

Before Jan 15 it use to take 2 minutes to download the file (2 MB size). But now its taking half an hour to download.

response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition","attachment; filename=Attendance_Report.xls");

We have restarted server, system but still problem exists. We found that there is no code level or data base level or network level issues.

Now we have to see server level issue. What are the factors which effects the file downloading at server level.
We are using websphere 6.1 ,java1.4

View Replies View Related

How To Create Java Files Into Windows Applications (Exe Files)

Oct 26, 2014

What step to know to develop software..

View Replies View Related

How To Attach External Files To Executable Jar Or Exe Files

Apr 13, 2015

In a program I created, I'm using a text file that contains some texts needed for the program. The method relevant to this is something like the following.

private String wordgen(){
try {
BufferedReader reader = new BufferedReader(new FileReader("src/Resources/adjectives.txt"));
Random rand = new Random();
int low = rand.nextInt(400);
String fil="";
int i=0;
while(i!=low){

[Code]...

The program runs fine in netbeans project but once the jar is created it does not corporate with the text file. ("null" is returned) How can I attach text files to jar and exe?

View Replies View Related

JSP :: How To Import / Refer Css

Aug 7, 2014

accdg to this: [URL]....

we can use EL expression as follows:

${pageContext.request.contextPath}

but there's no instructions as to how I will set its value.

And also, what would happen in case I refer 2 css files in my jsp and both defines the following:

CSS 1 :
body { background-color: #fdf5e6;
font-size: 810px;
}

CSS 2:
body { background-color: #fdf5e6;
font-size: 50px;
}

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved