Compile Error

I’'m attempting to compile Jive from source for the first time, and get a compile error at java/org/jivesoftware/database/JNDIDataSourceProvider, line 113.

The constructor for InitialContext is being passed a Properties object, but there is no constructor for InitialContext that takes a Properties object. There is one that takes a Hashtable(<String, ?>),


Using JDK1.5.0, jive_messenger_src_2_2_0 source.

Hi mcgredo,

Properties actually inherits from Hastabalbe, so passing a Properties object to the InitialContext constructor is valid. Are you using the ant build script to compile Messenger?



Yep, used the ant script and JDK1.5.0.

The argument to InitialContext is a generic, Hashtable(,?) while Properties

inherits from Hashtable(Object, Object). Is that the source of the problem, that

Properties can take a non-String as the key?

Hey McGregor,

Could you post the compilation error that you are getting? How are you compiling the source code? Are you using an IDE?


– Gato

Compiling from the command line.

Windows XP, JDK1.5.0:


Buildfile: build.xml


Expanding: C:\projects\jive\jive_messenger_src\build\lib\merge\whack

.jar into C:\projects\jive\jive_messenger_src\target\whack


Compiling 273 source files to C:\projects\jive\jive_messenger_src\ta


C:\projects\jive\jive_messenger_src\src\java\org\jivesoftware\database\JNDIData cannot find symbol

symbol : constructor InitialContext(java.util.Properties)

location: class javax.naming.InitialContext

context = new InitialContext(contextProperties);


Note: * uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

1 error


C:\projects\jive\jive_messenger_src\build\build.xml:238: Compile failed; see the

compiler error output for details.

Total time: 5 seconds

C:\projects\jive\jive_messenger_src\build>which javac

/cygdrive/c/Program Files/Java/jdk1.5.0/bin/javac

As I said, the InitialContext constructor barfs because it’'s getting passed a

Properties rather than a Hashtable–apparently because the InitialContext Hashtable argument is parameterized to be a <String, ?> and a Properties object constructor can take an (Object, Object) argument:

InitialContext(Hashtable<String,?> environment)

Constructs an initial context using the supplied environment.

While Properties is a subclass of Hashtable, this particular constructor has a narrower view of what can be in Hashtables.

I fixed this by simply changing the declaration of the object being passed

in to a Hashtable and changing the method for adding to the contents

of the container.

Hi mcgredo,

It’‘s so strange that you are getting this error. According the url= javadocs[/url] the constructor argument is InitialContext(Hashtable<?,?> environment). I looked to see if there is a bug for this issue in the 1.5 release of the JDK but I didn’'t see one. Could you upgrade to the latest JDK release, 1.5.0_04, to see if that that fixes the problem?



Yes, that got it. Moving to 1.5_04 solved the problem. Apparently Sun has been monkeying with the API.