I want to determine the class name where my application started, the one with the main() method, at runtime, but I'm in another thread and my stacktrace doesn't go all the way back to the original class.
I've searched System properties and everything that ClassLoader has to offer and come up with nothing. Is this information just not a...
Hello,
I am looking for an easy way (say, a single script/batch file or a simple program) to instrument a set of Java source files so that each method has an added System.out.println statement on entry and exit.
I could not find such a utility. The reason I need this (and why it has to work on source files and not .class files) is that...
In the context if Java, I have a code like this,
MyObject[] array;
and in different threads i have a code like this
array[i] = new MyObject(val);
If I ensure that each of my threads use different values of "i" then would I need to synchronize the above statement to take care of race conditions?
...
Hi,
I am pretty new to jruby and java and want to create a servlet in jruby while using jetty as web server. I am not sure if I am on the right way with the following code which shows the input form so far. I guess I have to extend now the HttpServlet class to handle the posted data but I don't know how to do this in this case and if it...
Hi,
I'm looking at implementing an OpenID provider ('OP') using Java + Tomcat/JBoss.
Now one of the key things about OpenID is that
The user communicates with both the OP and the RP and has a session with both sites.
The OP and RP communicate with each other to ensure the user hasn't faked anything.
A subject I've not been able to ...
How to assign the fault field of the SOAPFaultException on the server side?
...
The scenario is around calling an external SSL SOAP web service from within Mirth. The web service is requires an SSL/TLS connection along with a client certificate.
The intention is to use the built-in SOAP Sender Destination to call the remote secure web service, and somehow include that client certificate.
I understand that you fir...
My limited understanding of ThreadLocal is that it has resource leak issues. I gather this problem can be remedied through proper use of WeakReferences with ThreadLocal (although I may have misunderstood this point.) I would simply like a pattern or example for correctly using ThreadLocal with WeakReference, if one exists. For instance,...
I am an avid fan of the Spring framework for Java (by Rod Johnson).
I am learning Python and was excited to find about Spring for Python.
I would be interested in hearing the community's views on the comparison of
these two flavours of Spring. How well does it fit Python's paradigms etc.
...
what would be the easiest way to convert an ArrayList of Integers to one int, with the 1st Integer in the list being the 1st number in the int, etc. in Java?
For example an ArrayList of Integers: 1 4 6 7 8 3 8
becomes the int value 1467838
...
I'm using JDBC to get a large amount of data. The call completes successfully, but when resultSet.next() is called, I get the following error:
java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size: 15414016, Num elements: 7706998
I've attempted to increase the JVM memory size, but this does not fix the problem. I'm not sur...
public class StateQueryFilter extends FieldQueryFilter {
// private static final Log LOG = LogFactory.getLog(RecommendedParser.class.getName());
public StateQueryFilter() {
super("state", 5f);
super("city", 5f);
super("notdirectory", 5f);
//LOG.info("Added a state query");
}
}
And it reports:
Con...
In java, the method 'Class.getMethods()' returns an array of all the methods in the reciever class and also its superclasses.
Is there such a method like Class.getMethods() which only give us the class's methods, without those which are inhereted from its superclasses?
...
Hi,
I have a swing application which stores a list of objects. When the users clicks a button, I want to perform two operations on each object in the list, and then once that is complete, graph the results in a JPanel. I've been trying SwingWorker, Callable & Runnable to do the processing, but no matter what I do, while processing the l...
I want to issue a query like the following
select max(col1), f(:1, col2) from t group by f(:1, col2)
where :1 is a bind variable. Using PreparedStatement, if I say
connection.prepareStatement
("select max(col1), f(?, col2) from t group by f(?, col2)")
I get an error from the DBMS complaining that f(?, col2) is not a GROUP BY exp...
We have an extensive class hierarchy (using the joined-subclass model) where the base class has a Long primary key generated from a sequence in the DB.
We are working on transitioning to a GUID primary key, but wish to retain the old primary key (both in old and newly created content) for legacy apps. While the implementation seems f...
My web application is using Java, Hibernate's JPA implementation (EntityManager) and Spring. What are my logger choices and what would you recommend. Ideally the configuration would be simple (one config file for Hibernate, Spring and my code).
...
In my particular neck of the woods, .NET development is a little dry and low-paying, while is appears Java development is still pretty hot. Contracts are going for very good rates as well.
What avenues should I take to parallel my development expertise in DotNet with Java? I'm a senior developer/architect/dba.
...
URL generation in my web app is in charge of the presentation layer.
Now consider another module sending out messages containing URLs. (Not neccessarily triggered from presentation).
However, the presentation layer has to know about the module (since it might be the trigger, and the user can configure the module using the frontend).
I.e...
What's the most efficient way to trim the suffix in Java, like this:
title part1.txt
title part2.html
=>
title part1
title part2
...