java

Jurisdiction policy files are not signed by trusted signers!

We have next exception during starting of our application under JBoss on AIX: Caused by: java.lang.SecurityException: Cannot set up certs fo 12:56:25,055 INFO [STDOUT] r trusted CAs at javax.crypto.b.<clinit>(Unknown Source) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J...

ServletWebServer or WebServer ?

What is the advantage of using org.apache.xmlrpc.webserver.ServletWebServer instead of or.apache.xmlrpc.webserver.WebServer when working with XMLRPC in JAVA? Can I use functions that return array of primitives types or nulls with ServletWebServer? ...

Where will WebLogic look for files by default?

Hi All, I have a web application deployed in WebLogic. In one of my java file, I tried to read PleaseNote.txt as following: File file = new File("PleaseNote.txt"); Now WebLogic is taking PleaseNote.txt from its domain directory.My question is: [1] Why it is domain directory? Why not the directory where my java file which has the abo...

Java Profiler: JProbe Replacement for Mac?

I have been using JProbe on Windows and I liked it very much. Unfortunately, I have to ditch my Windows PC due to office space limitation so I am left with MACs only. As far as I know, JProbe doesn't have a MAC version so I am looking for an alternative on Mac OS X, preferably free and with Eclipse plugins. Do you have any suggestions? ...

Insert 50 thousand record in MySQL

I want to insert 50 000 records into MySQL through a web service written in Java but only 20 000 records are getting inserted. I dont think there is size (number of record ) limition in my sql. is there something where i can Insert/Select 50k records in a single go (bulk) ...

How to make code modular?

I have some Java programs, now I want to find out whether it is modular or not, if it is modular then up to what extent, because modularity can never be binary term i.e. 0 or 1. How do I decide that particular code is modular upto this much extent. I want to know how to make code much more modular? ...

Clean way for conditionally rendering HTML in view?

Is there a cleaner way to do this in a JSP/Struts1 setup ? <% if (SessionConfig.isAdminMode() ) { %> ... some HTML here ... <% } %> EDIT: In admin mode I would like to have access to additional parameters from a form element, e.g. from the form element: input type="text" value="Test user" name="Owner" EDIT 2: Actually, my probl...

Making a OneToOne-relation lazy

In this application we are developing, we noticed that a view was particularly slow. I profiled the view and noticed that there was one query executed by hibernate which took 10 seconds even if there only were two object in the database to fetch. All OneToMany and ManyToMany relations were lazy so that wasn't the problem. When inspecting...

How much memory does a Java object use when all its members are null?

Is it correct to assume a Java object only takes up the 8 bytes for the object reference as long as all it's members are set to null or does the definition of members already use up space in the instance for some reason? In other words, if I have a large collection of objects that I want to be space efficient, can I count on leaving unu...

Applet issue with jre 1.6

Hi all I have an applet, and it consist of an CLOSE button which closes the applet and redirects user to the home page. Home page consists 3 frames (Top, Left and Right). Once user clicks on the CLOSE button, the home page is appearing in the right frames, due to this now user has inconsistent view (multiple frames) of the page. Code ...

Defensive Programming: Guidelines in Java

I’m from a .NET background and now dabbling in Java. Currently, I’m having big problems designing an API defensively against faulty input. Let’s say I’ve got the following code (close enough): public void setTokens(Node node, int newTokens) { tokens.put(node, newTokens); } However, this code can fail for two reasons: User passe...

Apache Commons vs. Google Collections

I was looking for a bidirectional map implementation in Java, and stumbled upon these two libraries: Apache Commons Collections Google Collections Both are free, have the bidirectional map implementation that I was looking for (BidiMap in Apache, BiMap in Google), are amazingly nearly the same size (Apache 493 kB, Google 499 kB) and ...

Custom configuration for JBoss applications?

I've built a simple alert monitor to display the health of various applications. This is configured by XML, as each monitor instance needs to show different metrics. An example configuration may be: <machine> <monitors> <check type="connectivity" name="Production Server"> <property key="host" value="ops01.corp" /> <ala...

Is it possible to configure log4j to create a new file with every run of the application?

For example, the first time I run an application (or immediately after I clear out the /logs directory), I want log4j to write the application's logs to a file called log.0. Then, I exit the application and restart it, I want the logs to be written to log.1. And so on. I would like to keep this in the configuration file, although if I c...

Java HTTP post for XML SOAP message

How to expose / publish services using Java HTTP post for XML SOAP message. What are all steps need to follow. I did googling but haven't found any thing about exposing / publishing services. ...

getServletContext().getAttribute() returning null?

When trying to set Context attributes like so: void init() { String testing = new String(); testing = "This is a test"; getServletContext().setAttribute("test", testing); } In one servlet, and getting the attribute like so: String testing = (String) getServletContext().getAttribute("test") In a second servlet, testing i...

Does anyone know where I can find the "Orto" Javascript JVM?

I've read about "Orto", a Java virtual machine that runs on Javascript, but I can't find the actual code, only a few articles about it - like this one: http://ejohn.org/blog/running-java-in-javascript/ Does anyone know where I can find Orto itself, or something else that can run Java bytecode on Javascript? Note that the GWT doesn't me...

Anonymous methods/functions: a fundamental feature or a violation of OO principles?

Is the recent movement towards anonymous methods/functions by mainstream languages like perl and C# something important, or a weird feature that violates OO principles? Are recent libraries like the most recent version of Intel's Thread Building Blocks and Microsofts PPL and Linq that depend on such things a good thing, or not? Are lan...

How to handle authentication through AJAX with a java web app that uses form based login

I have a java web application running on WebSphere 7. The application uses form authentication method and part of the application accesses some protected resources using ajax requests. However, when the user's session expires, I am getting the login page in place of the content that is supposed to be refreshed by the ajax request. Is t...

Multicast Send Performance

We recently completed an analysis of multicast sending performance. Happily, Java and C performed almost identically as we tested different traffic sending rates on Windows and Solaris. However, we noticed that the time to send a multicast message increases as the time between sends increases. The more frequently we call send, the le...