Topic
  • 15 replies
  • Latest Post - ‏2012-05-18T12:16:36Z by SystemAdmin
SystemAdmin
SystemAdmin
570 Posts

Pinned topic [Solved] SQL Adapter deployment failing when using training samples...

‏2012-03-07T17:17:57Z |
Hi,

I am attempting to make use of the sample solutions... specifically the module_05_1_SQL_Adapter.zip. When I attempt to deploy the adapter, I get the following errors in the console:

2012-03-07 17:10:34 Adapter deployment failed
2012-03-07 17:10:34 Could not resolve placeholder 'training-jndi-name'

The relevant section of my SQLAdapter.xml file is as follows:

<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>\${training-jndi-name}</dataSourceJNDIName>
</connectionPolicy>

And my worklight.properties looks as follows:

training-jndi-name=\${custom-db.1.jndi-name}
custom-db.1.relative-jndi-name=jdbc/worklight_training
custom-db.1.driver=com.mysql.jdbc.Driver
custom-db.1.url=jdbc:mysql://localhost:3306/worklight_training
custom-db.1.username=root
custom-db.1.password=XXXX

So, to be clear, the only thing that I have modified in these files is to specify the correct password for the root user on the DB. I am sure that I am missing something really basic... can anyone tell me what it is?

Thanks in advance for your help.
  • IdanAdar
    IdanAdar
    288 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-08T07:52:57Z  
    Hello,

    Change the username and password for the custom db both to "Worklight".
    I believe this should solve your issue.
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-15T15:20:42Z  
    Hi,

    Thanks for your response. I have tried specifying a username and password of "Worklight", as shown below, and I am still getting the error.

    
    training-jndi-name=$
    {custom-db.1.jndi-name
    } custom-db.1.relative-jndi-name=jdbc/worklight_training custom-db.1.driver=com.mysql.jdbc.Driver custom-db.1.url=jdbc:mysql:
    //localhost:3306/worklight_training custom-db.1.username=Worklight custom-db.1.password=Worklight
    


    The console output in eclipse is as follows:

    
    [2012-03-15 15:14:41] Thu Mar 15 15:14:41 GMT 2012 [2012-03-15 15:14:41] Starting adapter deployment on Worklight Server [2012-03-15 15:14:41] Deploying adapter: SQLAdapter [2012-03-15 15:14:41] Server host: localhost [2012-03-15 15:14:41] Server port: 8080 [2012-03-15 15:14:41] Adapter deployment failed [2012-03-15 15:14:41] Could not resolve placeholder 'training-jndi-name'
    


    I have also ensured that the Worklight user has all of the relevant priveleges within MySQL.

    Any other thoughts on this issue?
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-19T16:34:41Z  
    Hi,

    Is anyone able to add anything here? I am unable to work my way through various tutorials/samples without the ability to deploy a SQL Adapter.

    Thanks.
  • IdanAdar
    IdanAdar
    288 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-20T06:49:05Z  
    Sorry for the late reply. Please try the following.

    In your adater's XML, instead of:
    
    <dataSourceJNDIName>$
    {training-jndi-name
    }</dataSourceJNDIName>
    
    Use:
    
    <dataSourceJNDIName>$
    {custom-db.1.jndi-name
    }</dataSourceJNDIName>
    

    In addition,
    Make sure the Worklight user has permissions for the training database.
    Also Make sure to replace/update the worklight.properties of your Worklight Server with the one provided in the example.
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-30T15:31:36Z  
    Hi Idan,

    Many thanks for your response... my adapter is now deployed to the server. But I still get an error if I try to invoke it... the error that comes back is as follows:

    {
    "errors": ,
    "info": [],
    "isSuccessful": false,
    "warnings": []
    }

    Obviously, the JDBC driver class and connection URL are both specified in the worklight.properties (shown below for clarity) file so I am not sure why it is unable to find them. Any thoughts?

    custom-db.1.driver=com.mysql.jdbc.Driver
    custom-db.1.url=jdbc:mysql://localhost:3306/worklight_training
  • IdanAdar
    IdanAdar
    288 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-03-30T15:44:20Z  
    Yes. I was actually mistaken. :)

    Please try this in the adapter XML:
    
    <dataSourceJNDIName>$
    {jndi-env-prefix
    }/jdbc/worklight_training</dataSourceJNDIName>
    
    Please also make sure that you have copied the contents of worklight.properties and have put them in your own server copy of worklight.properties (and restarted the server after applying this).

    This time, it should successfully deploy, invoke and get a response.
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-14T13:03:24Z  
    Hey,

    I was looking for help on this particularly tutorial and get to this very stage, but I still had another problem and the thread ended! Here's what I got after making your last suggested change:

    {
    "errors": ,
    "info": [],
    "isSuccessful": false,
    "warnings": []
    }

    Can you please advise what else I need to change? Thank you!
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-14T13:26:01Z  
    Furthermore, I don't think the sql executed properly last time, which may explain my problem. I am now seeing this message:

    {
    "errors": ,
    "info": [],
    "isSuccessful": false,
    "warnings": []
    }

    I thought I had allowed all permissions but it seems that is not the case. How do I ensure all permissions are available?
  • IdanAdar
    IdanAdar
    288 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-14T17:09:58Z  
    That really depends on the software you use to access your database, but it should entail to simply choose all operations possible for the worklight_training database, for the Worklight user.
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-16T20:52:17Z  
    Hi Idan,

    I am getting the same issue which *creighst * was facing.

    {
    "errors": ,
    "info": [],
    "isSuccessful": false,
    "warnings": []
    }

    I have done everything and even the changes suggested in this thread but still this issue remains.

    I have granted all privileges to WorkLight user , see in below snaps.

    Global
    http://forum.worklight.com/download/file.php?mode=view&id=54&sid=c0b5c9138a36b947bec93b95883218e0

    WorkLigh Training DB

    http://forum.worklight.com/download/file.php?mode=view&id=55&sid=c0b5c9138a36b947bec93b95883218e0

    Please guide me what I am missing or some other changes I have to do?

    Thanks
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-17T16:17:42Z  
    I'm facing the same problem still, I'm not very experienced with SQL databases and so I'm not sure how to correct the problem.

    AAhad, what SQL browser are you using there? I've been doing everything from the cmd line and it's not exactly easy!

    Idan, any help would be super :)
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-17T21:28:29Z  
    Hi creighst,

    I am using SQLYog. Its a GUI tool to work with MySQL.

    Get it downloaded from here http://code.google.com/p/sqlyog/downloads/list

    After installation when you run it, it will ask you to create a new connection, simply provide the root user password which you had entered while installing MySQL server. Then it will show you all of the DBs.

    Well, lets see when we can get out of this SQL Adapter issue :roll:

    Thanks
  • IdanAdar
    IdanAdar
    288 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-18T06:58:27Z  
    The username should be "Worklight", not "WorkLight". Make sure you get that right.

    There is not make assistance I can give here.
    You should have two databases - one of Worklight's, and one "worklight_training" which you create using the supplied script in the relevant training module. You then make sure to given the Worklight user all permissions and you should be set to go.
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-18T07:56:56Z  
    Hey,

    Thanks for the tip AAhad, this GUI is VERY helpful! :)

    As for this example, after granting the Worklight user all permissions, the SQL Adapter works no problem. I have done EXACTLY what you did AAhad in your screenshots and it works for me. I hope you resolve the issue ASAP!
  • SystemAdmin
    SystemAdmin
    570 Posts

    Re: [Solved] SQL Adapter deployment failing when using training samples...

    ‏2012-05-18T12:16:36Z  
    Well, lately I resolved the issue. :D

    There was a typo when I entered username/password in the server settings file. I had entered *worklight *- all letters in lower case :( and basically it was searching for a wrong user name that was NOT present on the DB. The DB has a user name with *Worklight * (W in caps only, other in small).

    anyway, good to see it working....

    thanks...