Using external jars in WAR deployment

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

Using external jars in WAR deployment

Postby Ruben79 » Mon Jan 04, 2016 4:02 pm

I'm using an external jar (with 2 required extra jars) in a Servoy method, in this case to generate a QR code. This works great, but I'm having an issue when deploying the solution as a war deployment.
I'd expect it to work when I put the jars in \beans or \plugins but the code throws an error in the servoy log that it cannot find the method in the jar. However, when I put the jars in the \WEB-INF\lib\ subdirectory in the WAR file, the method is found and the code works.

Why doesn't it work when just placing the jars in \beans or \plugins?
Ruben de Jong
Stb Software Development
SAN Partner

Stb Software Development - http://www.stb.nl
User avatar
Ruben79
 
Posts: 97
Joined: Wed Apr 18, 2007 12:43 pm

Re: Using external jars in WAR deployment

Postby Andrei Costescu » Mon Jan 04, 2016 5:54 pm

Are those external jars Servoy plugins/beans? If so you should be able to check them when exporting to .war (there is a page where you choose which plugins/beans should be included).

If they are just simple java jars and you access them directly through Rhino then it explains why they are not exported. In this case you could try to copy them to the app_server/lib folder before war export. Then they will end up I think where you need them.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: Using external jars in WAR deployment

Postby Ruben79 » Tue Jan 05, 2016 6:25 pm

They are just simple java jars, no plugins.
When I put them in the plugins or beans folder in developer, the code works. I can even check them for WAR export. They also end up in the war file's plugin directory, but the code won't work unless I put them in the \WEB-INF\lib dir.
I just do that now by opening the war file with 7zip and drag the jars into it, but it will work if I put them in the application_server\lib folder I guess.

Just wondering why it works in developer but not in WAR environment.
Ruben de Jong
Stb Software Development
SAN Partner

Stb Software Development - http://www.stb.nl
User avatar
Ruben79
 
Posts: 97
Joined: Wed Apr 18, 2007 12:43 pm

Re: Using external jars in WAR deployment

Postby jcompagner » Tue Jan 05, 2016 6:33 pm

you have to somehow tell servoy to include it
so with a bean you have to have a dummy bean.jar (with a dummy bean in it in the manifest) and then have the classpath attribtue of the manifest file pointing to the jars you want to ship
or you have to generate a dummy plugin.jnlp file with a dummy plugin that includes your jars

this way we know what really is used. And it should be then included in the classloader.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Using external jars in WAR deployment

Postby Ruben79 » Tue Jan 05, 2016 9:45 pm

I see, but how come that there are a lot of plugins without a jnlp in the plugins directory that work aswell?

Just trying to understand how stuff works :)
Ruben de Jong
Stb Software Development
SAN Partner

Stb Software Development - http://www.stb.nl
User avatar
Ruben79
 
Posts: 97
Joined: Wed Apr 18, 2007 12:43 pm

Re: Using external jars in WAR deployment

Postby IT2Be » Tue Jan 05, 2016 10:30 pm

The jnlp tells the vm where to look for the jars that are needed (among other things).

Without jnlp it is possible that:
- there is no dependency other than servoy libs that are loaded anyway.
- the plugin relies on libs that are used by servoy (and loaded by servoy before the plugin is used).
- the plugin relies on libs that are coincidentally loaded by other plugins (so the plugin developer has a bit of luck).

In all other cases (unless I forgot something) you need a jnlp...

When you want to know more there is lots of stuff about it floating around on the web.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: Using external jars in WAR deployment

Postby jcompagner » Wed Jan 06, 2016 4:50 pm

yes without a actual jnlp we just auto generate such a jnlp. Then only that jar is included.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 4 guests