Hi,
We have upgraded our JIRA version from 5.0.2 to 6.3.8 successfully and part of this upgrade proces we have also upgraded supported tomcat version to apache-tomcat-7.0.55. But in this tomcat version we do not have common/lib folder and lib folder directly present in tomcat home directory only. We have custom code which connects to SQL server and we are trying to load driver "com.microsoft.sqlserver.jdbc.SQLServerDriver" from code, but in JIRA version 6.3.8 version it is giving class not found exception even we placed required sql jar "sqljdbc4.jar" in lib folder of tomcat. But it is working fine with tomcat 5 of JIRA 5.0.2 version. Please help us, do we need to configure anything else in tomcat 7.
One observation is that same code is working as standalone java program from eclipse but not in JIRA.
Community moderators have prevented the ability to post new answers.
If you copy "sqljdbc4.jar" to your JIRA webapp's WEB-INF/lib directory will it help?
Hi Sash, We already tried same, but did not get any help on it. We are having this code in plug-in type 2(osgi). We observed one thing in log file under java system java properties still we seeing Catalina-home reference, is it correct or it should be replaced with that variable value? ___ Java System Properties ________________ atlassian.plugins.enable.wait : 300 awt.toolkit : sun.awt.windows.WToolkit catalina.base : C:\GL\Work\JIRA638\apache-tomcat-7.0.55 catalina.home : C:\GL\Work\JIRA638\apache-tomcat-7.0.55 catalina.useNaming : true common.loader : ${catalina.base}/lib, ${catalina.base}/lib/*.jar, ${catalina.home}/lib, ${catalina.home}/lib/*.jar file.encoding : Cp1252
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have ${catalina.home} and ${catalina.base} set ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes we have both set that is why ${catalina.home} and ${catalina.base} showing their values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have mentioned that you use it in OSGI (as plugin), so it looks like a classloading issue Have you tried to bundle it with your plugin and how exactly do you get the connection (load the driver) in your plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the code using for connection: public java.sql.Connection getConnection( String userName, String password) throws ClassNotFoundException, SQLException { final String driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; String url = "jdbc:sqlserver://1.1.1.1:1433;databaseName=abc" Driver driver = null; try { driver = (Driver)Class.forName(driverClassName, true,Thread.currentThread().getContextClassLoader()).newInstance(); } catch (InstantiationException e) { logger.error("Unable to create instance of "+ driverClassName , e.getCause()); } catch (IllegalAccessException e) { logger.error("Unable to access the class "+ driverClassName , e.getCause()); } final Properties prop = new Properties(); prop.put("user",userName); prop.put("password",password); return driver.connect(url, prop); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Class.forName will not work when used in OSGI, in a plugin... Try to use: com.opensymphony.util.ClassLoaderUtil instead. This is what XWorkModuleDescriptor class uses when you plugin is loaded.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sash, How it is working in tomcat 5.0.29 version with JIRA 5.0.2 version in OSGI plugin. Is there any changes between JIRA versions ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, it seems it did... you have updated both, tomcat and JIRA, and there is a big difference even in major version numbers, so I would expect that it has been changed. Take a look at this page, quite large and complex, but worth reading... https://developer.atlassian.com/docs/getting-started/working-with-the-pom/managing-dependencies {quote} In the past, you could add a JAR file to the WEB-INF/lib directory and make it available to all plugins, as well as the product itself. This no longer works, as the plugin system doesn't know about any code in the product beyond what it's been told to use; placing random JARs in WEB-INF/lib or class files in WEB-INF/classes will not make them available in the system bundle. {quote}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sash, It worked. Thanks for your help. Its really helped me a lot!!!.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad it is solved!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.