I got this error when I tried renaming a Project in Project Explorer in Eclipse:
Resource is out of sync with file system
To fix this error: Right-click on the Project and select Refresh.
This error can be avoided via auto-refresh. To turn this on check the Refresh Automatically option found within the Preferences tab:
Window > Preferences > General > Workspace
Wednesday, 9 January 2013
Monday, 26 November 2012
Unexpected error during Oracle Service Bus synchronization.
I was attempting to export my OSB project as a Jar in Eclipse OSB 11g, but I was getting this error (visible in the Problem tab) which was halting my progress:
Unexpected error during Oracle Service Bus synchronization. Please see the logs for more information.
A solution I found for this was:
Unexpected error during Oracle Service Bus synchronization. Please see the logs for more information.
A solution I found for this was:
- Close all projects (including the OSB Configuration Project) in the Eclipse Project Explorer, except for the OSB Project you are trying to export.
- Refresh the OSB Project
- Reopen the OSB Configuration Project that corresponds to the OSB project
Tuesday, 13 November 2012
Eclipse OSB 11g: "This project is not associated with an Oracle Service Bus Configuration"
If you receive the error:
"This project is not associated with an Oracle Service Bus Configuration"
Go to Oracle Service Bus perspective (top right). Now you can drag your project into a OSB Configuration project in the Project Explorer. If there is not an OSB Configuration project available, create one (File > New > Oracle Service Bus Configuration Project).
"This project is not associated with an Oracle Service Bus Configuration"
Go to Oracle Service Bus perspective (top right). Now you can drag your project into a OSB Configuration project in the Project Explorer. If there is not an OSB Configuration project available, create one (File > New > Oracle Service Bus Configuration Project).
Wednesday, 11 July 2012
The Java EE server classpath is not correctly set up - server home directory is missing.
I received this error when running 'clean dist' for my Java web application from Jenkins but it can also occur in NetBeans:
The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=<app_server_installation_directory>
The solution I found for this was to add this line to nbproject/project.properties:
j2ee.server.home=http://localhost
After this change the build was successful.
Labels:
j2ee.server.home,
Java,
NetBeans,
project.properties
Location:
Eastbourne, East Sussex, UK
Monday, 14 May 2012
Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve
I've just installed NetBeans 7.1.2. When attempting to run an Ivy project I get the following error:
/home/rsharp/projects/project_name/ant-ivy.xml:5: Problem: failed to create task or type antlib:org.apache.ivy.ant:retrieve
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-ANT_HOME/lib
-the IDE Ant configuration dialogs
BUILD FAILED (total time: 0 seconds)
This was because the default location for Ant in NetBeans is:
/usr/local/netbeans-7.1.2/java/ant
Whereas Ant is actually installed at:
/usr/local/ant
To set this, go to Tools > Options > Miscellaneous > Ant and modify Ant Home.
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet
This appears to be an antlib declaration.
Action: Check that the implementing library exists in one of:
-ANT_HOME/lib
-the IDE Ant configuration dialogs
BUILD FAILED (total time: 0 seconds)
This was because the default location for Ant in NetBeans is:
/usr/local/netbeans-7.1.2/java/ant
Whereas Ant is actually installed at:
/usr/local/ant
To set this, go to Tools > Options > Miscellaneous > Ant and modify Ant Home.
Location:
Eastbourne, East Sussex, UK
Thursday, 3 May 2012
DriverManager.setLoginTimeout() and DriverManager.getLoginTimeout()
When attempting to connect to a data source which is unreliable, to stop the application from hanging (i.e. waiting for a response from the DriverManager,getConnection(...) method), you can use the login timeout integer. This represents a maximum time in seconds that the data source will wait when attempting to connect to the database.
Description from Oracle Java Docs:
DriverManager.setLoginTimeout ( ) - Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database. A value of zero
specifies that the timeout is the default system timeout
if there is one; otherwise, it specifies that there is no timeout.
When a
DataSource
object is created, the login timeout is
initially zero.
DriverManager.getLoginTimeout( ) - Gets the maximum time in seconds that this data source can wait
while attempting to connect to a database. A value of zero
means that the timeout is the default system timeout
if there is one; otherwise, it means that there is no timeout.
When a
DataSource
object is created, the login timeout is
initially zero.
Labels:
DriverManager,
getLoginTimeout,
Java,
JDBC,
setLoginTimeout
Location:
Eastbourne, East Sussex, UK
Wednesday, 11 April 2012
Java bubble sort with ArrayList and custom args
Bubble sort: http://en.wikipedia.org/wiki/Bubble_sort
As a bit of fun I wrote my own version of the bubble sort algorithm.
package bubblesort;
import java.util.ArrayList;
import java.util.Iterator;
/**
* Java bubble sort example: This class shows how to sort an array list of
* Integers using the bubble sort algorithm. Enter numbers as arguments to be
* sorted.
*
* @author rsharp 9/4/12
*/
public class BubbleSort {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
if (args.length > 0) {
ArrayList<Integer> numbersToSort = new ArrayList<Integer>();
for (String arg : args) {
try {
numbersToSort.add(Integer.parseInt(arg));
} catch (NumberFormatException ex) {
System.out.println(arg + " is not a number. Please enter only numbers into the bubble sort!");
}
}
//print array before sorting using bubble sort algorithm
System.out.println("Array before the bubble sort");
for (int i : numbersToSort) {
System.out.print(i + " ");
}
//sort an array using bubble sort algorithm
bubbleSort(numbersToSort);
System.out.println("");
//print array after sorting using bubble sort algorithm
System.out.println("Array after bubble sort");
for (int i : numbersToSort) {
System.out.print(i + " ");
}
} else {
System.out.println("Please enter a list of numbers to bubble sort!");
}
}
/**
* This method performs the bubble sort
* @param numbersToSort
*/
private static void bubbleSort(ArrayList<Integer> numbersToSort) {
int temp = 0;
for (int i = 0; i < numbersToSort.size() - 1; i++) {
for (int j = 1; j < (numbersToSort.size() - i); j++) {
if (numbersToSort.get(j - 1) > numbersToSort.get(j)) {
//swap the elements!
temp = numbersToSort.get(j - 1);
numbersToSort.set(j - 1, numbersToSort.get(j));
numbersToSort.set(j, temp);
}
}
}
}
}
You can run this from the command line with arguments. There is error checking for if no or incorrect arguments are sent in:
java bubblesort.BubbleSort 10 2 7 8 3 1 6 9 5 4
As a bit of fun I wrote my own version of the bubble sort algorithm.
package bubblesort;
import java.util.ArrayList;
import java.util.Iterator;
/**
* Java bubble sort example: This class shows how to sort an array list of
* Integers using the bubble sort algorithm. Enter numbers as arguments to be
* sorted.
*
* @author rsharp 9/4/12
*/
public class BubbleSort {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
if (args.length > 0) {
ArrayList<Integer> numbersToSort = new ArrayList<Integer>();
for (String arg : args) {
try {
numbersToSort.add(Integer.parseInt(arg));
} catch (NumberFormatException ex) {
System.out.println(arg + " is not a number. Please enter only numbers into the bubble sort!");
}
}
//print array before sorting using bubble sort algorithm
System.out.println("Array before the bubble sort");
for (int i : numbersToSort) {
System.out.print(i + " ");
}
//sort an array using bubble sort algorithm
bubbleSort(numbersToSort);
System.out.println("");
//print array after sorting using bubble sort algorithm
System.out.println("Array after bubble sort");
for (int i : numbersToSort) {
System.out.print(i + " ");
}
} else {
System.out.println("Please enter a list of numbers to bubble sort!");
}
}
/**
* This method performs the bubble sort
* @param numbersToSort
*/
private static void bubbleSort(ArrayList<Integer> numbersToSort) {
int temp = 0;
for (int i = 0; i < numbersToSort.size() - 1; i++) {
for (int j = 1; j < (numbersToSort.size() - i); j++) {
if (numbersToSort.get(j - 1) > numbersToSort.get(j)) {
//swap the elements!
temp = numbersToSort.get(j - 1);
numbersToSort.set(j - 1, numbersToSort.get(j));
numbersToSort.set(j, temp);
}
}
}
}
}
You can run this from the command line with arguments. There is error checking for if no or incorrect arguments are sent in:
java bubblesort.BubbleSort 10 2 7 8 3 1 6 9 5 4
Subscribe to:
Posts (Atom)