Adding @grabresolver and @grab to schema connect script

User c1ce6b3d19

14-11-2012 21:22:20

I tried to add @grabresolver and @grab code on top of the Schema connect/disconnect script.  


 


@GrabResolver(name = 'foo', root = 'http://somePlace')

@Grab(group = 'bar', module = 'test', version = '1.0')

import org.openide.NotifyDescriptor
import org.openide.DialogDisplayer
...
on_connect {  schema,user ->
... 

 


I then disconnected and tried to reconnect.


This is the error I got.  Now I am unable to connect to the schema to even remove the code!!


 


 


java.lang.IllegalStateException: parseScript() was not called yet?


at com.google.common.base.Preconditions.checkState(Preconditions.java:149)


at com.im.ijc.groovy.GroovyScriptHandler.callClosureByName(GroovyScriptHandler.java:107)


at com.im.ijc.scripting.api.Script.callClosureByName(Script.java:79)


at com.im.df.impl.db.sprovider.RunInitScriptState.proceedToNextState(RunInitScriptState.java:63)


at com.im.df.impl.db.sprovider.ProxyState.proceedToNextState(ProxyState.java:57)


at com.im.df.impl.db.sprovider.SchemaProviderImpl.proceedToNextState(SchemaProviderImpl.java:124)


at com.im.ijc.core.api.util.SchemaInitManager.startInit(SchemaInitManager.java:245)


at com.im.ijc.core.api.util.SchemaInitManager.access$000(SchemaInitManager.java:55)


[catch] at com.im.ijc.core.api.util.SchemaInitManager$1.run(SchemaInitManager.java:87)


at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)


at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)


Jon

 

ChemAxon e189db4705

14-11-2012 23:08:02

Hi Jon,


unfortunately when the script is broken then schema cannot continue in connecting to DB. This is how it is implemented now. We will improve the error handling here for the next version.


I'm afraid you need to connect to database directly and remove the script from table. What database type do you use now? I just reproduced exactly your issue and fixed it on Derby. I used RazorSQL universal database GUI console to fix it, but you can use any database console which allows you to edit one value in DB.


The steps are following:



  1. Exit IJC

  2. Connnect to the database using console (in the case of derby be careful to use correct version. In IJC 5.11 we have Derby 10.8. Also maybe make a backup of whole project)  (picture step1)

  3. Find IJC_SCHEMA table and load the data

  4. Find the broken schema row - it has SCHEMA in GENERIC_TYPE column. If you have multiple schema in the same database then please use ITEM_ID column value which must be the same which you have in .ijs file

  5. Go to ITEM_VALUE column and open editor for it (picture step2)

  6. You will see xml document which contains the script. Remove whole element for extra-attributes (picture step3)

  7. Commit the change to database. Disconnect the DB console. (If you use Derby please make sure that db.lck file doesn't exist - I had some problems now that probably RazorSQL didn't delete it correctly. This file is a lock preventing two JVM to run derby in embedded mode in the same time.)

  8. Now you can connect to schema again in IJC


Let me know if it fixes the problem.


I'm sorry for troubles. We will definitely improve the editor support for schema init script (validation) and also will do better error handling when it fails during schema connect/disconnect.


Regards,


Petr

User c1ce6b3d19

14-11-2012 23:28:30

Deleting the <xtra-props> worked.  


Success.  


 


Thanks,


Jon