# The .jar doesn't get exported on preview mode?

**URL:** <https://community.ofelia.com/t/the-jar-doesnt-get-exported-on-preview-mode/5189>\
**Category:** Q&A\
**Created:** [26 September 2014 03:51 UTC](https://community.ofelia.com/t/the-jar-doesnt-get-exported-on-preview-mode/5189 "2014-09-26T03:51:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![javierron](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@javierron](https://community.ofelia.com/u/javierron)\
**Post date:** [26 September 2014 03:51 UTC](https://community.ofelia.com/t/the-jar-doesnt-get-exported-on-preview-mode/5189/1 "2014-09-26T03:51:15Z")

</div>

Hello!

Im trying to fill a select widget from a Groovy script that needs a .jar as a dependency. I’ve already added the dependency to the process through the configure dialog, but I keep getting an error when trying to preview the form. This error indicates that a class cannot be found, and this class is supposed to be declared in the .jar.

Version 6.3.3

Stack trace here:  
/////////////////////////////////////////////////////////////////////////////////////////////////////////  
1 error

```
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.evaluateExpressionsOnActivityInstance(ProcessAPIImpl.java:5571)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:368)
at org.bonitasoft.engine.api.impl.ServerAPIImpl$1.call(ServerAPIImpl.java:337)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:276)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:344)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:286)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:128)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
at com.sun.proxy.$Proxy16.evaluateExpressionsOnActivityInstance(Unknown Source)
at org.bonitasoft.forms.server.accessor.api.ExpressionEvaluatorEngineClient.evaluateExpressionsOnActivityInstance(ExpressionEvaluatorEngineClient.java:45)
... 32 more

```

Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:  
Script2.groovy: 13: unable to resolve class com.mysql.jdbc.Driver  
@ line 13, column 115.  
, “\*\*_ **“,”** _”,new com.my  
^  
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

FYI, when I evaluate the Groovy script, and check the dependency, everything works as it is supposed to.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [2 October 2014 07:14 UTC](https://community.ofelia.com/t/the-jar-doesnt-get-exported-on-preview-mode/5189/2 "2014-10-02T07:14:53Z")

</div>

Hi there,

I saw something similar with Postgres…it’s not the .jar itself it can’t find it’s the MySQL class it can’t find…

This is my code:

String url = "jdbc:postgresql://"+dbParms.get("dbHost")+":"+dbParms.get("dbPort")+"/"+dbParms.get("dbDatabase"); try { try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException ex1) { dbParms.clear(); dbParms.put("Error", thisModule+": DB Connection Error (ex1): "+ex1.toString()); logger.severe(thisModule+": DB Connection Error (ex1): "+ex1.toString()); } con = DriverManager.getConnection(url, dbParms.get("dbUser"),dbParms.get("dbPassword")); } catch (SQLException ex2) { logger.severe(thisModule+": DB Connection Error (ex2): dbParms="+dbParms); dbParms.clear(); dbParms.put("Error", thisModule+": DB Connection Error (ex2): "+ex2.toString()); logger.severe(thisModule+": DB Connection Error (ex2): "+ex2.toString()); } finally { try { if (con != null) { con.close(); } } catch (SQLException ex3) { dbParms.clear(); dbParms.put("Error", thisModule+": DB Connection Error (ex3): "+ex3.toString()); logger.severe(thisModule+": DB Connection Error (ex3): "+ex3.toString()); } } 

the important bit is to add the following…and it should work.

`
	try {
		Class.forName("org.postgresql.Driver");
	} 
        catch (ClassNotFoundException ex1) {
	}
`

obviously change postgres to MySQL…

hope it helps

regards  
Seán
