java

GWT conditional compile

I'm using the same source code for a GWT 1.5 and GWT 1.7 application. I'm wondering is there a way to conditionally compile parts of the java code for one or the other version. I know there is a way to do it for widgets and browsers in the module XML file. ...

AroundInvoke Interceptor on a @Timeout Annotated Method is Not Working

Application Server: JBOss 4.2 I have a method which I want to intercept.Its a method annotated @Timeout and invoked by javax.ejb.TimerService instance. The method signature: @Stateless class A @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @Timeout @Interceptors(AnInterceptor.class) public void ...

google data api for youtube

i am trying to run the sample program which comes with google data api.I am geting a run time error at following line YouTubeService myService = new YouTubeService("gdataSample-YouTube-1"); erroe is as follows : run: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps at com.google.gdata.w...

Can i get the project build path programicaly?

I want to a project build path (default is src...). Can I do it using some java API? ...

Session handling in Hibernate with Spring

Hello, I am not a beginner in hibernate, but I am a beginner in working with Hibernate in Spring. I read the book Spring in Action. So I wrote a small application to comprehend the examples in the book. Here an extraction of my application. I can give you more, if you want. @Transactional(propagation = Propagation.SUPPORTS, readOnly = ...

How to use ROWLOCK with EJB

I have a problem where I get a deadlock on a MS SQL Server. The same code runs without problems on MySQL. My problem is that I receive a request to delete a job (which is attached to a device), and afterwards I receive a request to create a new job for the same device. Most times this works without any problems, but once in a while the ...

XML format verification

Feels like Im about to reinvent the wheel. Im having a message payload (e.g. from a client through a socket) in XML format (in a simple java.lang.String). Below is an example what the payload could look like: <update> <type>newsource</type> <sources> <source>vedbyroad box 1492</source> </sources> </update> I want to...

Does Java provide some sort of Register\"Cookies" for storing of temporary data?

Does the Java provide some sort of registry- or cookie mechanism where I can store small pieces of data to load next start I start an java application- or applet? For example the application settings such as last opened file etc ...

mapping database link(drda) tables to entites in jpa

Hi all I'm using a oracle thin driver to connect to my database.My database links to another db(DB2) with drda specification.My problem is that I can only view the local tables of my database and map them using jpa but I select from drda in sqldeveloper and it works so the problem is definitely with my application development.What do yo...

folder monitor in java?

Is there a way to monitor folders in java to see when they are updated, ie file created, deleted, renamed,etc. And also is there any way to set it that it only looks for files that begin with a certain prefix, ie img? ...

Configuring SiteMesh for specific action mappings in Struts 2?

Hi, I'm trying to configure sitemesh to only take effect for a certain subset of action mappings in my Struts 2 application. Say for example, I have the following struts.xml snippet: <package name="default" namespace="/" extends="struts-default"> <action name="showForm"> <result>/view/form.jsp</result> </action> </package> <pa...

Why are these == but not `equals()`?

I'm a bit confused about the way Java treats == and equals() when it comes to int, Integer and other types of numbers. For example: Integer X = 9000; int x = 9000; Short Y = 9000; short y = 9000; List<Boolean> results = new ArrayList<Boolean>(); // results.add(X == Y); DOES NOT COMPILE 1) results.add(Y == 9000); ...

Where are these byte[]? (In Java using JProfiler)

I'm profiling a Java program that is leaking memory. Using JProfiler I see I get crazy amount of byte[] data. Is there a way to know more information about it? When is it allocated/created, where is it? ...

Selenium run as a Windows service to take screenshots on errors

I would like an automated web tests suite based on Selenium RC to take screenshots of pages when some errors are encountered. The test suite is a part of the continuous integration process and technically is executed by CruiseControl running as a Windows service. The selenium.captureScreenshot() method is called to trigger the actual s...

Combining java.util.Dates to create a date-time

I have current have two UI components used to specify a date and a time. Both components return java.util.Date instances representing the calendar date and time respectively. My question is: What is the best way to combine these values to create a java.util.Date instance representing the date and time? I would like to avoid dependenc...

how to add a file to Java EE projects?

I want to add a xml file to my Java ee project and use it in my code but when I address the file from src directory it does not understand my address and search for file in bin directory of tomcat. My project is using wicket framwork and JavaEE. does any one know how to address the file or where should I place the file to access is from ...

Configure Equinox to modify the management of the "local bundle cache"

Relating to a previous question, how let OSGi to reuse your configuration via Config Admin, I am still trying to solve this problem in the Equinox Framework. Pavol Juhos wrote: Equinox Config Admin (org.eclipse.equinox.cm) stores the configuration data in the persistent storage area provided by the Framework. And that happens to be ...

Setting webview background image to a resource graphic in Android

I'm trying to set the background of a webview to a drawable image resource in Android. From the sdk it seems something like this would work but it doesn't. WebView web = (WebView) findViewById(R.id.webView); web.setBackgroundResource(R.drawable.backgroundmain); web.loadData(profile, "text/html", "UTF-8"); Any idea's? ...

Please suggest me a J2EE book

Hello everyone, I'm a developer pretty much experienced in web development (HTML, JavaScript, PHP, Django, Ruby on Rails). I have just recently taken on Java (read "Core Java" and the SCJP 6 book) and I now want to start with J2EE. I need a book that will go through the most important aspects (EJB/JSF/etc., I know the buzzwords :) ) of ...

Is this an over-the-top question for Senior Java developer role?

A recruiter has sent me a fairly long quiz from an employer, and I think it's a bit excessive for what is supposedly a Senior Java developer role. The questions (to me) seem unfocused, and go into areas such as architecture, operations, capacity planning. One of the questions is this: "Internet-scale applications must be designed to pro...