Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JNI WLS 4->5

0 views
Skip to first unread message

szvxg3

unread,
May 22, 2000, 3:00:00 AM5/22/00
to
Please respond to robert....@eds.com or the newsgroup.

I've had complete success writing code with JNI on WLS 4.03 on NT4.0 SP6
(servlets, EJBs etc)

However after migrating to WLS 5 I am no longer to able to call any JNI
methods, receiving "unsatisfied link errors".

The DLL is definately being loaded, dllmain() gets called correctly (I
have put a breakpoint on it),
the native method names are generated by "javah" so they are also
correct. If we put the classes/dlls
back on to the previous version of WLS no problems occur.

The jni classes are in c:\weblogic\classes
The test servlet in c:\weblogic\myserver\servletclasses
The dll's are also in c:\weblogic\myserver\servletclasses

The servlet does a
"System.load("c:\weblogic\myserver\servletclasses\test.dll");

=========================================================================================================================

Here is a copy of my environment ::
=========================================================================================================================

ClassPath=c:\jdk1.2.2\lib;c:\jdk1.2.2\jre\lib;c:\jdk1.2.2\jre\lib\ext;C:\Program
Files\Exceed.nt\hcljrcsv.jar;C:\Program Files\Exceed.nt\;C:\Program
Files\Exceed.nt\hcljrcsv.jar;c:\;
COMPUTERNAME=STEVEC
ComSpec=C:\WINNT\system32\cmd.exe
HOMEDRIVE=C:
HOMEPATH=\users
InocuLAN=C:\NET\VIRUS\INOCNT
J2EE_HOME=C:\j2sdkee1.2
JAVA_HOME=c:\jdk1.2.2
LOGONSERVER=\\PHILG
MGL_ROOT=C:\SCITECH
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Os2LibPath=C:\WINNT\system32\os2\dll;
Path=C:\WINNT\system32;C:\WINNT;C:\NET\VIRUS\INOCNT;c:\jdk1.2.2\bin;c:\jdk1.2.2\jre\bin

PATHEXT=.COM;.EXE;.BAT;.CMD
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 7 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0703
PROMPT=$P$G
SystemDrive=C:
SystemRoot=C:\WINNT
TEMP=C:\TEMP
TMP=C:\TEMP
USERDOMAIN=SOG
USERNAME=stevec
USERPROFILE=C:\WINNT\Profiles\stevec
windir=C:\WINNT


=========================================================================================================================

Here is a stack trace
=========================================================================================================================

Sat May 22 19:57:33 GMT 1999:<I> <ListenThread> Listening on port: 7001

<NT Performance Pack> NATIVE: created IoCompletionPort successfully.
IoPort=0x00
000198
Sat May 22 19:57:33 GMT 1999:<I> <WebLogicServer> WebLogic Server
started
Sat May 22 19:57:43 GMT 1999:<I> <NT Performance Pack> Allocating: '2'
NT reader
threads
Sat May 22 19:57:44 GMT 1999:<I> <ServletContext-General> ES: init
doGet()
Sat May 22 19:57:44 GMT 1999:<I> <ServletContext-General> ES: loading
librarys
Sat May 22 19:57:44 GMT 1999:<I> <ServletContext-General> ES: created
iv2d()
Sat May 22 19:57:44 GMT 1999:<I> <ServletContext-General> ES: About to
Test Mini

Sat May 22 19:57:44 GMT 1999:<E> <ServletContext-General> Servlet failed
with Ex
ception
java.lang.UnsatisfiedLinkError: TestTheMini
at ESServlet.test(ESServlet.java:88)
at ESServlet.doGet(ESServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:105)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
textImpl.java:742)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
textImpl.java:686)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
ContextManager.java:247)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
a:361)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
Compiled Code)

Sat May 22 19:57:47 GMT 1999:<I> <ServletContext-General> servletimages:
init

=========================================================================================================================

Here is the native code:
=========================================================================================================================

//
// MiniTest.H
//
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif

JNIEXPORT jint JNICALL Java_MiniTest_TestTheMini(JNIEnv *env, jobject
dontuse);


#ifdef __cplusplus
}
#endif


//
// MiniTest.c :
//

#include <windows.h>
#include "MiniTest.h"

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}


// This is an example of an exported function.
JNIEXPORT jint JNICALL Java_MiniTest_TestTheMini(JNIEnv *env, jobject
dontuse)
{
printf ("Hello!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
return 98;
}

=========================================================================================================================

/////////////////////// JAVA CODE //////////////////
=========================================================================================================================

public class MiniTest
{
public native int TestTheMini();
};

=========================================================================================================================

/// Servlet Code
=========================================================================================================================

static
{
String MINITEST = "c:/weblogic/myserver/servletclasses/MiniTest.dll";

System.load(MINITEST);
}

MiniTest a = new MiniTest();
a.TestTheMini();


It just doesn't work!!!!

Any help greatly appreciated.


Mark Griffith

unread,
May 23, 2000, 3:00:00 AM5/23/00
to
See rant below.

Will answer this post in .environment.

mbg

In article <3929951F...@eds.com>, guido....@eds.com says...

--
==================================================
NewsGroup Rant
==================================================
Rant 3.

Dont Crosspost. Choose the group it belongs to and
Post there. If it doesnt belong anywhere post to misc.

Mark Griffith

unread,
May 23, 2000, 3:00:00 AM5/23/00
to
SEE RANT.

This article will not be answered in this newsgroup.
mbg

--

Mark Griffith

unread,
May 23, 2000, 3:00:00 AM5/23/00
to
I am having someone take a look at this. I or they will let you know
something here soon.

mbg

--
==================================================
NewsGroup Rant
==================================================
Rant 1.

The less info you provide about your problem means
the less we can help you. Try to look at the
problem from an external perspective and provide
all the data necessary to put your problem in
perspective.

Mark Griffith

unread,
May 23, 2000, 3:00:00 AM5/23/00
to
try { System.load(...) } catch(Throwable t} { System.out.println("T: " +
t); }

Lets see what exception is getting thrown... may be a security exception
if the policy file is not configured to allow loading??? Maybe something
bad happens as part of DDL initialization that is thrown up as an
exception??

Let us know
mbg


In article <MPG.1394bccea...@newsgroups.bea.com>, ma...@bea.com
says...


> I am having someone take a look at this. I or they will let you know
> something here soon.
>
> mbg
>
> In article <3929951F...@eds.com>, guido....@eds.com says...

> > Please respond to robert....@eds.com or the newsgroup.
> >
> > I've had complete success writing code with JNI on WLS 4.03 on NT4.0 SP6
> > (servlets, EJBs etc)
> >
> > However after migrating to WLS 5 I am no longer to able to call any JNI
> > methods, receiving "unsatisfied link errors".
> >
> > The DLL is definately being loaded, dllmain() gets called correctly (I
> > have put a breakpoint on it),
> > the native method names are generated by "javah" so they are also
> > correct. If we put the classes/dlls
> > back on to the previous version of WLS no problems occur.
> >
> > The jni classes are in c:\weblogic\classes
> > The test servlet in c:\weblogic\myserver\servletclasses
> > The dll's are also in c:\weblogic\myserver\servletclasses
> >
> > The servlet does a
> > "System.load("c:\weblogic\myserver\servletclasses\test.dll");

Sunesh Kumra

unread,
May 31, 2000, 3:00:00 AM5/31/00
to
Hi Mark,

I am getting a similar problem. I am able to load the library via System.load(....) but after that when I call other methods it gives me java.lang.UnsatisfiedLinkError thrown to the client side. At the server side it just hangs and client programs prints this exception and exits.
At the server side it prints the following and hangs :
[Loaded com.nokia.in.nina.sdb.dai.DriverManager] (this uses JNI and is loaded)
[Loaded weblogic.common.internal.ResetableOutputStream]
[Loaded weblogic.rmi.internal.DGCClientHelper]

I am using Weblogic 5.1. Is this a problem with WLS5.1 or am I doing something wrong ?

My weblogic.policy settings are :

grant codeBase "file:/export/home6/kumra/weblogic/-" {
  permission java.io.FilePermission "${/}export${/}home6${/}kumra${/}weblogic:${
/}myserver${/}serverclasses${/}-", "read,write,delete,execute";
  permission java.net.SocketPermission "localhost:1-9000", "connect,accept,liste
n,resolve";
  permission java.awt.AWTPermission "accessClipboard";
  permission java.awt.AWTPermission "accessEventQueue";
  permission java.awt.AWTPermission "showWindowWithoutWarningBanner";
  permission java.io.SerializablePermission "enableSubclassImplementation";
  permission java.io.SerializablePermission "enableSubstitution";
  permission java.lang.RuntimePermission "accessClassInPackage.*";
  permission java.lang.RuntimePermission "accessDeclaredMembers.*";
  permission java.lang.RuntimePermission "createClassLoader";
  permission java.lang.RuntimePermission "createSecurityManager";
  permission java.lang.RuntimePermission "defineClassInPackage.*";
  permission java.lang.RuntimePermission "exitVM";
  permission java.lang.RuntimePermission "getClassLoader";
  permission java.lang.RuntimePermission "createClassLoader";
  permission java.lang.RuntimePermission "getProtectionDomain";
  permission java.lang.RuntimePermission "loadLibrary.*";
  permission java.lang.RuntimePermission "modifyThread";
  permission java.lang.RuntimePermission "modifyThreadGroup";
  permission java.lang.RuntimePermission "readFileDescriptor";
  permission java.lang.RuntimePermission "setContextClassLoader";
  permission java.lang.RuntimePermission "setFactory";
  permission java.lang.RuntimePermission "setIO";
  permission java.lang.RuntimePermission "setProtectionDomain";
  permission java.lang.RuntimePermission "setSecurityManager";
  permission java.lang.RuntimePermission "writeFileDescriptor";
  permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
  permission java.net.NetPermission "requestPasswordAuthentication";
  permission java.net.NetPermission "setDefaultAuthenticator";
  permission java.security.SecurityPermission "getPolicy";
  permission java.security.SecurityPermission "setPolicy";
  permission java.util.PropertyPermission "*", "read,write";
};

Regards,
Sunesh

-----Original Message-----

Mark Griffith wrote:

try { System.load(...) } catch(Throwable t} { System.out.println("T: " +
t); }

Lets see what exception is getting thrown...  may be a security exception
if the policy file is not configured to allow loading???  Maybe something
bad happens as part of DDL initialization that is thrown up as an
exception??

Let us know
mbg

In article <MPG.1394bccea...@newsgroups.bea.com>, ma...@bea.com
says...
> I am having someone take a look at this.  I or they will let you know
> something here soon.
>
> mbg
>
> In article <3929951F...@eds.com>, guido....@eds.com says...

> > Please respond to robert....@eds.com or the newsgroup.
> >
> > I've had complete success writing code with JNI on WLS 4.03 on NT4.0 SP6
> > (servlets, EJBs etc)
> >
> > However after migrating to WLS 5 I am no longer to able to call any JNI
> > methods, receiving "unsatisfied link errors".
> >
> > The DLL is definately being loaded, dllmain() gets called correctly (I
> > have put a breakpoint on it),
> > the native method names are generated by "javah" so they are also
> > correct.  If we put the classes/dlls
> > back on to the previous version of WLS no problems occur.
> >
> > The jni classes are in      c:\weblogic\classes
> > The test servlet in           c:\weblogic\myserver\servletclasses
> > The dll's are also in        c:\weblogic\myserver\servletclasses
> >
> > The servlet does a
> > "System.load("c:\weblogic\myserver\servletclasses\test.dll");

--

Pan Wei You

unread,
Sep 15, 2000, 3:00:00 AM9/15/00
to
The last reply that i see is in May 2000. Is there any solution to the
java.lang.UnsatisfiedLinkError when a JNI method is called ???

Can some kind soul from BEA or anyone who has solved it in Weblogic 5.1
(preferably SP5 onwards) gives an advice here ?

TIA.

Regards
Wei You
Component Developer
Netlife Singapore Pte Ltd

Mark Griffith wrote:
>
> try { System.load(...) } catch(Throwable t} { System.out.println("T: " +
> t); }
>
> Lets see what exception is getting thrown... may be a security exception
> if the policy file is not configured to allow loading??? Maybe something
> bad happens as part of DDL initialization that is thrown up as an
> exception??
>
> Let us know
> mbg
>
> In article <MPG.1394bccea...@newsgroups.bea.com>, ma...@bea.com
> says...
> > I am having someone take a look at this. I or they will let you know
> > something here soon.
> >
> > mbg
> >
> > In article <3929951F...@eds.com>, guido....@eds.com says...

> > > Please respond to robert....@eds.com or the newsgroup.
> > >
> > > I've had complete success writing code with JNI on WLS 4.03 on NT4.0 SP6
> > > (servlets, EJBs etc)
> > >
> > > However after migrating to WLS 5 I am no longer to able to call any JNI
> > > methods, receiving "unsatisfied link errors".
> > >
> > > The DLL is definately being loaded, dllmain() gets called correctly (I
> > > have put a breakpoint on it),
> > > the native method names are generated by "javah" so they are also
> > > correct. If we put the classes/dlls
> > > back on to the previous version of WLS no problems occur.
> > >
> > > The jni classes are in c:\weblogic\classes
> > > The test servlet in c:\weblogic\myserver\servletclasses
> > > The dll's are also in c:\weblogic\myserver\servletclasses
> > >
> > > The servlet does a
> > > "System.load("c:\weblogic\myserver\servletclasses\test.dll");
>

weiyou.vcf
0 new messages