Free Support Forum - groupdocs.com

Can't run Annotation java sample


#1

I have downloaded GroupDocs.Annotation java samples, but can’t run it.

It has compile errors on AnnotationServlet line 142, 146:
141 if (connector instanceof ICustomConnector){
142 ((ICustomConnector)connector).setEnvironmentCreator(annotationHandler);
143 }
144 // This callback will be called for each case when collaborator should be created
145
146 annotationHandler.setCollaboratorCallback(new ICallback<Pair<Integer, Color>, Pair<IUser, IDocument>>() {
@Override
public Pair<Integer, Color> onCallback(Pair<IUser, IDocument> param) {

// User collaborator for document will be created with returned access rights and color
// Default CollaboratorCallback is made similarly
return new Pair<Integer, Color>(AccessRights.All.value(), Color.red);
}
});
If i comment out those two parts,
It throws “java.lang.NullPointerException
at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)”. when i run this web application.


#2
Hello,

Thank you for your inquiry.

Please don't comment these two lines of code, this sample should works well without any comments. Could you please share with us your full stack trace of the error and we will investigate it. Also please share with us additional information about your environment:

1. Tomcat version that you use
2. Java version
3. Your Application.properties file

We will wait for these details and will be glad to help you.

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

Thank you for your quick reply.

1. Tomcat version that you use: apache-tomcat-8.0.21

2. Java version: jdk1.8.0_40

3. Your Application.properties file: We use Informix database

#Licence path

#Set path to licence file

#Example: E:/Projects/GroupDocs/app/Resources/Aspose License/GroupDocs.Viewer.Java.lic

#ATTENTION: for trial version set it as null.

#licensePath=D:/Projects/GroupDocs/app/Resources/Aspose License/annotation/GroupDocs.Annotation.Java.lic

licensePath=null

#Application path

#Application path is used in application for receiving and sending requests

#Path can be absolute, relative, empty or null

#groupdocs.annotation.applicationPath=http://127.0.0.1:8080

#Note: document-annotation is the context path

#groupdocs.annotation.applicationPath=custom-url

#Note: custom-url prefix will be used in addition to application and context path, ex: http://127.0.0.1:8080/custom-url

#groupdocs.annotation.applicationPath=null

#groupdocs.annotation.applicationPath=

#Note: null or empty value will set default application request URI, in this case http://127.0.0.1:8080

applicationPath=http://groupdocs.localhost:9090

#Localization configuration

#Used in sample source

#Values: `RU` - for Russian, `GE` for German, `EN` or `null` or empty for English

localization=null

#Files path: absolute path to files (documents) directory.

#basePath=D:/Projects/GroupDocs/Apps/xFiles/

basePath=c:/temp/catalogue/

#Cache path

cachePath=D:/Projects/GroupDocs/Apps/xFiles/temp/

#Upload path

#Set relative path for file uploads

#Example= 'uploadPath= uploads', this way file will be uploaded into /assets/uploads/

#Set null for default directory, the default directory is assets/ directory

uploadPath=/upload/

# Storage type

# default | sqlite | mysql | mssql | postgre | json | xml | custom

#storageType=default

storageType=custom

# Logic of files storage (only for xml and json storage)

# one | few | many | lot

storeLogic=many

# Database Storage path

# Used for json and xml storage

# Example ${groupdocs.annotation.basePath}/storageDirectory

storagePath=null

# Database server

dbServer=test

# Database port

dbPort=1500

# Database name

dbName=test

# Database user name

dbUsername=test

# Database user pasword

dbPassword=test

#Cache

#Use cache generated files

useCache=false

#Disable Atmosphere framework

disableAtmosphere=true

# Encoding

encoding=

# Fonts path

fontsPath=

4. When I don’t comment out those two lines, code shows compile errors when I build it under Eclipse.

After I download your java examples, I also get the latest version from github repository. Here is the jar list:

atmosphere-runtime-2.2.3.jar

commons-io-2.4.jar

cors-filter-1.9.2.jar

GroupDocs.Annotation.jar

jackson-annotations-2.5.0.jar

jackson-core-2.5.0.jar

jackson-databind-2.5.0.jar

java-property-utils-1.9.1.jar

log4j-1.2.17.jar

ormlite-core-4.48.jar

ormlite-jdbc-4.48.jar

servlet-api.jar

slf4j-api-1.7.8.jar

sqlite-jdbc-3.7.2.jar

xstream-1.3.1.jar

If I comment out those two lines, I get nullpointerexception:

Dec 15, 2015 11:00:30 AM com.groupdocs.viewer.d.b.a b

WARNING: Invalid or expired license. Starting up evaluation mode...

Dec 15, 2015 11:00:30 AM com.groupdocs.viewer.d.b.a b

INFO: For more information, please contact GroupDocs support

Dec 15, 2015 11:00:31 AM com.groupdocs.viewer.c.a getConnection

SEVERE: null

java.sql.SQLException: path to 'D:/Projects/GroupDocs/Apps/xFiles/temp/data.db': 'D:\' does not exist

at org.sqlite.Conn.open(Unknown Source)

at org.sqlite.Conn.(Unknown Source)

at org.sqlite.JDBC.createConnection(Unknown Source)

at org.sqlite.JDBC.connect(Unknown Source)

at java.sql.DriverManager.getConnection(DriverManager.java:664)

at java.sql.DriverManager.getConnection(DriverManager.java:270)

at com.groupdocs.viewer.c.a.getConnection(Unknown Source)

at com.groupdocs.viewer.c.a.a.ilB(Unknown Source)

at com.groupdocs.viewer.config.ServiceConfiguration.initLinkManager(Unknown Source)

at com.groupdocs.viewer.handlers.a.e.(Unknown Source)

at com.groupdocs.viewer.handlers.ViewerHandlerBasic.(Unknown Source)

at com.groupdocs.viewer.handlers.ViewerHandler.(Unknown Source)

at com.groupdocs.annotation.api.a.b.(Unknown Source)

at com.groupdocs.annotation.api.shared.CommonApi.(Unknown Source)

at com.groupdocs.annotation.api.shared.WebApi.(Unknown Source)

at com.groupdocs.annotation.handler.AnnotationHandler.(Unknown Source)

at com.groupdocs.annotation.handler.AnnotationHandler.(Unknown Source)

at com.groupdocs.annotation.samples.javaweb.AnnotationServlet.init(AnnotationServlet.java:139)

at javax.servlet.GenericServlet.init(GenericServlet.java:158)

at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)

at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)

at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Dec 15, 2015 11:00:31 AM com.groupdocs.annotation.api.a.b

SEVERE: null

Dec 15, 2015 11:00:31 AM com.groupdocs.annotation.data.connector.db.AbstractDatabaseConnector getConnection

SEVERE: Error during create Sql connection: com.mysql.jdbc.Driver

Dec 15, 2015 11:00:31 AM com.groupdocs.annotation.data.connector.db.AbstractDatabaseConnector getConnection

SEVERE: Error during create Sql connection: com.mysql.jdbc.Driver

ERROR com.groupdocs.annotation.samples.javaweb.IndexServlet: com.groupdocs.annotation.exception.AnnotationException: connectionSource argument cannot be null

Dec 15, 2015 11:00:31 AM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [IndexServlet] in context with path [] threw exception

java.lang.NullPointerException

at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)

at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)

at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Dec 15, 2015 11:00:31 AM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [IndexServlet] in context with path [] threw exception

java.lang.NullPointerException

at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)

at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)

at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)


#4
Hello,

Thank you for your details.

Please, don't comment these two lines, from your stack trace we can assume that you have incorrectly configured path to the cache folder. And this line confirms it:

java.sql.SQLException: path to 'D:/Projects/GroupDocs/Apps/xFiles/temp/data.db': 'D:\' does not exist

we can recommend you to use this cache path for your application :
cachePath=c:/temp/catalogue/temp

If you will get compile errors when you uncomment these lines , then please share with us full stack trace for these compile errors and we will help you .

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#5
Under eclipse, it still show those two lines compile error. But when i compile whole package, it's successful. Weird! I have changed cachePath=c:/temp/catalogue/, but i still can't run the sample. It shows database connection error(our database is informix):
Dec 16, 2015 9:36:04 AM com.groupdocs.viewer.d.b.a b
WARNING: Invalid or expired license. Starting up evaluation mode...
Dec 16, 2015 9:36:04 AM com.groupdocs.viewer.d.b.a b
INFO: For more information, please contact GroupDocs support
Dec 16, 2015 9:36:06 AM com.groupdocs.viewer.handlers.a.e preLoadFiles
INFO: Indexing files. Please wait...
Dec 16, 2015 9:36:06 AM com.groupdocs.annotation.data.connector.db.AbstractDatabaseConnector getConnection
SEVERE: Error during create Sql connection: com.mysql.jdbc.Driver
Dec 16, 2015 9:36:06 AM com.groupdocs.annotation.data.connector.db.AbstractDatabaseConnector getConnection
SEVERE: Error during create Sql connection: com.mysql.jdbc.Driver
ERROR com.groupdocs.annotation.samples.javaweb.IndexServlet: com.groupdocs.annotation.exception.AnnotationException: connectionSource argument cannot be null
Dec 16, 2015 9:36:06 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [IndexServlet] in context with path [] threw exception
java.lang.NullPointerException
at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Dec 16, 2015 9:36:06 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [IndexServlet] in context with path [] threw exception
java.lang.NullPointerException
at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:169)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:232)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)


#6
Hello,

Could you please clarify, did you create custom connector to your Informix data base or only filled the parameters in the application.properties file?

If you only filled the parameters in the application.proprties file, then it's wrong. Because , at the moment we are providing default connectors only for these data base (MSSQL,MySQL,PostgreSQL and SQLite) and only for them you can configure parameters in this file.

In your case you will need to create your custom connector to your data base and configure only this parameter storageType=custom in the application.properties file. For how to create the custom connector please investigate this article .

If you will have more questions please feel free to contact us.

------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#7

I have modified com.groupdocs.annotation.samples.data.connector.CustomDatabaseConnector to use informix jdbc driver, but same exception:

SEVERE: Error during create Sql connection: com.informix.jdbc.IfxDriver
Dec 17, 2015 12:52:01 PM com.groupdocs.annotation.data.connector.db.AbstractDatabaseConnector getConnection
SEVERE: Error during create Sql connection: com.informix.jdbc.IfxDriver
ERROR com.groupdocs.annotation.samples.javaweb.IndexServlet: com.groupdocs.annotation.exception.AnnotationException: connectionSource argument cannot be null
Dec 17, 2015 12:52:01 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [IndexServlet] in context with path [] threw exception
java.lang.NullPointerException
at com.groupdocs.annotation.samples.javaweb.IndexServlet.doGet(IndexServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

#8
Hello ,

Thank you for coming back.

Could you please share with us your changed servlet sample . We will investigate and fix it for you.

We will wait your sample.

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#9

com.groupdocs.annotation.samples.data.connector.CustomDatabaseConnector.java is the only file i have changed. Informix database need more properties to connect to, so i add two more properties in the CONNECTION_STRING. But whatever i change the CONNECTION_STRING, i always get the “connectionSource can’t be null” error.

Here is the file details:
public class CustomDatabaseConnector extends AbstractDatabaseConnector {
private static final String CONNECTION_STRING = “jdbc:informix-sqli://%s:%d/%s:INFORMIXSERVER=%s?user=%s&password=%s&DB_LOCALE=%s”;
private static final String DEFAULT_DATABASE_DRIVER = “com.informix.jdbc.IfxDriver”;

/
* Create database connector
*
* @param dbServer database server
* @param dbPort database port
* @param dbName database name
* @param dbUsername database user name
* @param dbPassword database user password
*/
public CustomDatabaseConnector(String dbServer, int dbPort, String dbName, String dbUsername, String dbPassword) throws AnnotationException {
this(DEFAULT_DATABASE_DRIVER, dbServer, dbPort, dbName, dbUsername, dbPassword);
}

/
* Create database connector
*
* @param dbDriver database driver class name
* @param dbServer database server
* @param dbPort database port
* @param dbName database name
* @param dbUsername database user name
* @param dbPassword database user password
*/
public CustomDatabaseConnector(String dbDriver, String dbServer, int dbPort, String dbName, String dbUsername, String dbPassword) throws AnnotationException {
super(dbDriver, String.format(CONNECTION_STRING, dbServer, dbPort, dbName, “test”, dbUsername, dbPassword, “en_us.utf8”));
}
}


#10
Hello,

Thank you for these details .

We will investigate the issue and when we will have any results you will be notified.

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#11
Hello,

We have checked your case of using Informix database and we can assume that it's not possible at the moment, because the AbstractConnector class doesn't support Informix database driver.

In your use case you should implement your custom database connector via IDatabaseConnector interface. Please investigate our guide for how to do it here and also you can find some samples code of use in our demo examples.

If you will have more questions please feel free to contact us.

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#12

I have created a InformixDatabaseConnector extends AbstractDatabaseConnector, but still get the same error.


#13
Hello,

Could you please share with us your project example with your custom InformixDatabaseConnector . We will investigate it and will help you .

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#14

hi,

public class InformixDatabaseConnector extends AbstractDatabaseConnector {
private String dbDriver;
private String dbConnectionString;
public InformixDatabaseConnector(String dbDriver, String dbConnectionString) throws AnnotationException {
super(dbDriver, dbConnectionString);
}
public IStorageSchemaUpdater getStorageSchemaUpdater() {
return null;
}
}

And i also changed CustomDatabaseConnector
public class CustomDatabaseConnector extends InformixDatabaseConnector {
private static final String CONNECTION_STRING = “jdbc:informix-sqli://%s:%d/%s:INFORMIXSERVER=%s;user=%s;password=%s;DB_LOCALE=%s”;
private static final String DEFAULT_DATABASE_DRIVER = “com.informix.jdbc.IfxDriver”;

public CustomDatabaseConnector(String dbDriver, String dbServer, int dbPort, String dbName, String dbUsername, String dbPassword) throws AnnotationException {
super(dbDriver, String.format(CONNECTION_STRING, dbServer, dbPort, dbName, “test”, dbUsername, dbPassword, “en_us.utf8”));
}
}


Ps. is it safe to keep db access information in application.properties?

#15
Hello,

Thank you for your details.

As I mentioned you in my previous post , that your way isn't correct at the moment, because the AbstractConnector class doesn't support Informix database driver.
Also I shared with you the link on our documentation for custom meta-data Connector. And in this article is described as you can create your custom IConnector interface for database. Basically you will need to create all interfaces that implements IConnector. In our servlet sample you can find the example of implementations for CustomXmlDataConnector .

If you will have more questions please feel free to contact us.

--------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+