Skip to content

Commit

Permalink
java: fixed class-path after syslog-ng-core relocated
Browse files Browse the repository at this point in the history
The initial class path for the initial jvm didn't contain syslog-ng-core.jar

Fixes #620

Signed-off-by: Arsenault Adam <adam.arsenault@balabit.com>
  • Loading branch information
aneutrals committed Aug 7, 2015
1 parent cfa1252 commit e2df228
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Expand Up @@ -1252,6 +1252,7 @@ dnl ***************************************************************************

if test "x$module_path" = "x"; then
module_path="$moduledir"
java_module_path="$moduledir"/java-modules
fi

CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS $EVTLOG_CFLAGS $PCRE_CFLAGS $OPENSSL_CFLAGS $LIBNET_CFLAGS $LIBDBI_CFLAGS $IVYKIS_CFLAGS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
Expand Down Expand Up @@ -1376,6 +1377,7 @@ if test -n "$env_ld_library_path"; then
AC_DEFINE_UNQUOTED(ENV_LD_LIBRARY_PATH, "$env_ld_library_path", [set LD_LIBRARY_PATH to this value])
fi
AC_DEFINE_UNQUOTED(MODULE_PATH, "$module_path", [module search path])
AC_DEFINE_UNQUOTED(JAVA_MODULE_PATH, "$java_module_path", [java module search path])



Expand Down
2 changes: 2 additions & 0 deletions lib/mainloop.c
Expand Up @@ -96,6 +96,7 @@ static const gchar *cfgfilename;
static const gchar *persist_file;
static const gchar *ctlfilename;
const gchar *module_path;
const gchar *java_module_path;
static gchar *preprocess_into = NULL;
gboolean syntax_only = FALSE;
gboolean interactive_mode = FALSE;
Expand Down Expand Up @@ -530,5 +531,6 @@ main_loop_global_init(void)
persist_file = get_installation_path_for(PATH_PERSIST_CONFIG);
ctlfilename = get_installation_path_for(PATH_CONTROL_SOCKET);
module_path = get_installation_path_for(MODULE_PATH);
java_module_path = get_installation_path_for(JAVA_MODULE_PATH);
}

1 change: 1 addition & 0 deletions lib/syslog-ng.h
Expand Up @@ -56,5 +56,6 @@ typedef struct _AckRecord AckRecord;
/* configuration being parsed, used by the bison generated code, NULL whenever parsing is finished. */
extern GlobalConfig *configuration;
extern const gchar *module_path;
extern const gchar *java_module_path;

#endif
3 changes: 1 addition & 2 deletions modules/java/native/java-class-loader.c
Expand Up @@ -27,13 +27,12 @@
#include "messages.h"

#define SYSLOG_NG_CLASS_LOADER "org/syslog_ng/SyslogNgClassLoader"
//#define SYSLOG_NG_CLASS_LOADER "org.syslog_ng.SyslogNgClassLoader"
#define SYSLOG_NG_JAR "syslog-ng-core.jar"

jstring
__create_class_path(ClassLoader *self, JNIEnv *java_env, const gchar *class_path)
{
GString *g_class_path = g_string_new(module_path);
GString *g_class_path = g_string_new(java_module_path);
jstring str_class_path = NULL;
g_string_append(g_class_path, "/" SYSLOG_NG_JAR);
if (class_path && (strlen(class_path) > 0))
Expand Down
2 changes: 1 addition & 1 deletion modules/java/native/java_machine.c
Expand Up @@ -52,7 +52,7 @@ java_machine_ref()
g_jvm_s = g_new0(JavaVMSingleton, 1);
g_atomic_counter_set(&g_jvm_s->ref_cnt, 1);

g_jvm_s->class_path = g_string_new(module_path);
g_jvm_s->class_path = g_string_new(java_module_path);
g_string_append(g_jvm_s->class_path, "/syslog-ng-core.jar");
}
return g_jvm_s;
Expand Down

0 comments on commit e2df228

Please sign in to comment.