You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Pietag, Tobias (Enterprise Security Services)" <to...@hpe.com> on 2016/08/12 12:19:16 UTC

RE: Native Library Error using Context forward in server.xml

Hello,

 

We are using the Context in the server.xml to change the root application to
a different webapp. 

 

<Host name="localhost"  appBase="webapps" unpackWARs="true"
autoDeploy="true" deployOnStartup="true" >

        <Context path="/" docBase="iiq" />

        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l
%u %t &quot;%r&quot; %s %b"  resolveHosts="false" />

</Host>

 

So that the webapp can be call from https://url:8443/ and
https://url:8443/iiq. 

The webapp is using the sapjco3.jar and the native library libsapjco3.so to
connect to SAP systems.

If the webapp is open from both URLs, it will result in the following error.

 

java.lang.ExceptionInInitializerError: JCo initialization failed with
java.lang.UnsatisfiedLinkError: Native Library
/appl/tomcat/apps/ap/figi/apache-tomcat-latest/webapps/iiq/WEB-INF/lib/libsa
pjco3.so already loaded in another classloader

 

The library only exists once in the tomcat structure.

It seems that the tomcat sees both URLs as different applications and tries
to load native library twice.

After removing the Context element it's working without any error.

 

Is this the normal behavior with the Context element ?

Is there an option to change this behavior, or does it look like a bug ?

 

Thanks

Tobias Pietag


RE: Native Library Error using Context forward in server.xml

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Pietag, Tobias (Enterprise Security Services) [mailto:tobias.pietag@hpe.com] 
> Subject: RE: Native Library Error using Context forward in server.xml

> We are using the Context in the server.xml to change the root application to a 
> different webapp. 

That's a really, really bad idea.  Name your default webapp ROOT, and be done with it.  Alternatively, construct a ROOT webapp that does nothing but redirect to iiq (or vice-versa).

> <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true" deployOnStartup="true" >
>        <Context path="/" docBase="iiq" />

Read the doc and discover why that path attribute is using an illegal value, even when in server.xml.
 
> So that the webapp can be call from https://url:8443/ and https://url:8443/iiq. 

You should do this with a redirect.

> If the webapp is open from both URLs, it will result in the following error.

That's because it's not "the webapp"; your configuration forces it to be deployed twice, once as the default, once as iiq.  Each deployment uses a separate classloader so the underlying classes (and native library references) cannot be mixed.
 
> It seems that the tomcat sees both URLs as different applications and tries to load native library twice.

Exactly.

> After removing the Context element it's working without any error.

Except you cannot reach the webapp without using iiq in the URL.

> Is this the normal behavior with the Context element ?

Yes.

> Is there an option to change this behavior, or does it look like a bug ?

It's a bug in your configuration and deployment strategy.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org