cancel
Showing results for 
Search instead for 
Did you mean: 

encountering a problem with db.create

sebastian_s
Champ in-the-making
Champ in-the-making
Hello,

I am trying to use Activiti with SQL-server. For one of the first steps I prepared a create and a drop-script for SQL-server. I placed them in the approbiate locations insinde the activiti-engine.jar. In the setup-directory I created a file called build.mssql.properties and changed from h2 to mssql.

When trying to use the target db.create I get a NPE and I don't know why. I am not that confident with ant and I am wondering if the sql-file could not be found or if there's another reason for NPE being thrown.


C:\activiti-5.0.alpha1\setup>ant db.create
Buildfile: build.xml
     [echo] Activiti home = ..
     [echo] Activiti version = 5.0.alpha1

internal.classpath.libs:

db.create:
      [sql] Executing resource: org/activiti/db/create/activiti.mssql.create.sql


BUILD FAILED
java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:61)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLE
xec.java:774)
        at org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000(SQLExec.
java:706)
        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:449)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 1 second

I am using java6:

C:\activiti-5.0.alpha1\setup>java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

and ant 1.7.1:

C:\activiti-5.0.alpha1\setup>ant -version
Apache Ant version 1.7.1 compiled on June 27 2008

When I change back to h2 everything is fine.

Any help is appreciated

Sebastian
3 REPLIES 3

jeff1
Champ in-the-making
Champ in-the-making
hi, sebastian.
have a look at the method stack:

at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
at org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLExec.java:774)

then dive into the source code, you will find the NP is caused by missing resource.
it's really probable because of the file bellow is NOT found:

org/activiti/db/create/activiti.mssql.create.sql

try /org/activiti/db/create/activiti.mssql.create.sql to replace org/activiti/db/create/activiti.mssql.create.sqladd up '/' and try again. because if without the '/' it stands for relative path to the somewhat class(maybe SQLExec)

sebastian_s
Champ in-the-making
Champ in-the-making
Thanks for the hint. I had a problem with the classpath. I solved it by putting the scripts in a jar-file. Afterwards it was fine. Smiley Happy

jeff1
Champ in-the-making
Champ in-the-making
yes, it's caused by missing resource in classpath, alternatively first, an unmatched path is given, second, the resource is even not exsit in classpath, third, wrong classloader.
anyway, cheers.