java

Java SealedObject

I am encrypting an string with PBEWITHSHA256AND128BITAES-CBC-BC using SealedObject and write it to a file. After encrypting when i do a cat on the resulting file i i get read the salt used and the algorithm used in plain text even though the actual data is encrypted. Doesn't that give crackers a head start? They know the salt and the al...

java.rmi.ServerException: RuntimeException

When trying to access an ejb from a client , I get this exception : java.rmi.ServerException: RuntimeException; nested exception is: java.lang.NullPointerException at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:421) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209) I can't figure f...

IntelliJ Community Edition - How to import an Eclipse project?

There seems to be no eclipse support in the IntelliJ Community Edition. Do you know a smart way to import an eclipse project into IntelliJ Community Edition? See also http://blogs.jetbrains.com/idea/2009/10/intellij-idea-open-sourced/ ...

Java connection pool without JNDI?

Hi, I've a connection pool to access a MySQL DB from a servlet. I get the data source using a JNDI, which is defined on my META-INF/context.xml file. Everything is working fine, but I have to place the MySQL driver JAR within Tomcat's /common/lib folder, instead of webapp's WEB-INF/lib; otherwise the JNDI will not work (ClassNotFoundEx...

Java NIO UDP - Selector Hangs when trying to register

final DatagramChannel dc = DatagramChannel.open(); dc.configureBlocking(false); dc.socket().bind(localAddress); final SelDatagramChannel c = new SelDatagramChannel(dc, datagramListener); --->>>> final SelectionKey sk = dc.register(selector, SelectionKey.OP_READ); The market line hangs forever when you try...

Signed Java Applet Throws Security Exception on Connect to a Webservice

I have an java applet running on tomcat 5.5. It is signed ( -selfcert). I still get an java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader) Exception, when my Applet tries to connect to a webservice (already in this line): ws_locator = new My_WebserviceLocator(ws_adress + "?wsdl", ...

How to force a component to grow in MigLayout in Java

I have a component that is made up of various components such as a checkbox a slider and some buttons. i want to add this to a scrollpane and have the slider grow to fill all the remaining space. This is no problem as this code demonstrates : public static void main(String[] args) { JFrame f = new JFrame("Test"); JPanel c = new...

Datetime in java and default datetime mapping in hibernate

Hello good people, I need some little help about a confusion i'm having. since i came from C# .NET i was expeting java to have something similar to C# DateTime. While i manage to create a helper method to convert string representation of date like eg "2009-10-16 11:14:34" to date object. here is the method public static Date convertT...

How to get a list of all possible exceptions that could happen within a specific scope

I've a class class_A dealing with another class class_B which has methods with calls to other objects dealing with HTTP and JSON. Now I don't wanna handle these exceptions within class_B but rather on a higher level and thus forward them via throw e to class_A. Now I'm wondering when in my class A surrounding the call to a method of cla...

LazyInitialization Exception

I have 2 Hibernate objects : Dero and Motif. a Dero has a set of Motif. I load a Dero object from the DB fine. but when I try to access its set of Motif : assertEquals(dero.getMotifRefus(),deroFromDB.getMotifRefus()); I get an exception : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of rol...

How to create a temporary jms queue with jboss?

I need to create temporary queues on fly. How is that possible? ...

If I'm making a mail system that manages large amounts of email would I be better off using james or Javamail

I'm trying to decide whether to use James(http://james.apache.org/) or Javamail(http://java.sun.com/products/javamail/) to build a email system that takes and processes email. It will send and recieve email along with processing the content, checking for spam etc. What are the advantages/disadvantages of each and which do you recommend I...

How to add scrollable JTextArea to jDesktopPane

I was try several opinion but neither of them it seams to work. This method returns JTextArea private static JTextArea getJArea() { if (jArea == null) { jArea = new JTextArea(); jArea.setBounds(new Rectangle(16, 153, 468, 139)); jArea.setVisible(true); jArea.setLineWrap(true); jArea.setWrapStyleWord(true); jArea.set...

Java operator overloading

Not using operators makes my code obscure. (aNumber / aNother) * count is better than aNumber.divideBy(aNother).times(count) After 6 months of not writing a single comment I had to write a comment to the simple operation above. Usually I refactor until I don't need comment. And this made me realize that it is easier to read and pe...

Java, sockets, BufferedReader, and readline hang ... :(

I'm not a Java programmer at all. I try to avoid it at all costs actually, but it is required that I use it for a class (in the school sense). The teacher requires that we use Socket(), BufferedReader(), PrintWriter() and various other things including BufferedReader()'s readLine() method. Basically, this is the problem I'm having. T...

Serializing Java objects to xml and back (XML configuration)

I am looking for a XML serialization framework which has an option for a XML configuration instead of annotation to name classes and fields. I looked at Simple and XStream but I didn't find a method to do it. I suppose I could use Spring IOC and XStreams aliasing, but if there's any frameworks, which could do this for me, it would of co...

Writing to std out from Java JNI DLL - output only appear when application exits

We're writing a JNI DLL to wrap a third-party DLL. In our DLL, we're writing debug statements to standard out. When we use the DLL from our Java application, nothing gets printed to the Java console during the application execution. When the application is closed, all the output from the DLL gets written to the Java console. We'd like ...

Java .properties files as strongly typed classes

Is there way to get properties files as strongly typed classes? I guess there are code generators but doing it with annotations would be much cooler. What I mean is; foo.properties file keyFoo = valuefoo keyBar = valuebar maybe with @properties(file="foo.properties") class foo { } becomes class foo { String getKeyFoo() { } St...

web application - OC4J with Active Directory integration

i really need help. I'm searching for this from a very long time. I would like to make a servlet (application deployed on OC4J ) which will allow to enter users logged in domain (Active Directory) without any prompt for login and password. Is it possible to retrive in servlet : user name via getRemoteUser or getUserPrincipal methods with...

Project to isolate entities in Seam

Hi guys, Is it possible to have a Seam project just for entities (src/main) and other projects access them ? I have a situation that a organization has 6 projects accessing the same entities and i don't want to replicate them in each project. If it is possible, how can i do that ? where can i found documentation about it ? thanks, C...