Page 1 of 1

Name [jdbc/web] is not bound in this Context

Posted: Thu Jul 16, 2015 11:36 am
by Timon
Hello

I set up the latest version from the master branch in IntelliJ as described here:http://www.broadleafcommerce.com/docs/core/current/appendix/environment-setup/intellij-setup

I also switched to MySQL as described here:
http://www.broadleafcommerce.com/docs/core/current/tutorials/getting-started-tutorials/switch-to-mysql-tutorial

When I run the tomcat ant task for the site and admin both applications start properly, the database tables have been generated and when I go to e.g. http://localhost:8080 it works fine.

But when I try to deploy the e.g. site:war exploded via the tomcat server in IntelliJ I get this exception:

Code: Select all

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webDS': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/web] is not bound in this Context. Unable to find [jdbc].
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
   ... 87 more
Caused by: javax.naming.NameNotFoundException: Name [jdbc/web] is not bound in this Context. Unable to find [jdbc].


Any idea what I am missing?

Re: Name [jdbc/web] is not bound in this Context

Posted: Thu Jul 16, 2015 10:37 pm
by blondeMatrix
Hi,

On the face of it it appears that Broadleaf cannot locate the JNDI resource(s). Were these previously defined in the standalone Tomcat's context.xml, or Broadleaf's own context.xml (site and admin)? Did you set the database connection parameters in setenv.sh/bin, or hardcode them in Broadleaf's build properties?

I likewise was unsuccessful in running Broadleaf via IntelliJ's bundled Tomcat instance. But exporting the WARs to a standalone Tomcat instance was successful. Incidentally, did you need to download and run the below files when initially building your database?

load_admin_menu.sql
load_admin_permissions.sql
load_admin_roles.sql

Regards,

Chris.

Re: Name [jdbc/web] is not bound in this Context

Posted: Sat Jul 18, 2015 10:34 am
by Timon
Hello Chris

Thank you very much for your reply.

They were defined in the Broadleaf context.xml files.
I set the database connection parameters in the setenv.sh file.

I was also able to run the admin and site war files on a standalone Tomcat by copying them into the webapps folder.

I was not aware of the mentioned sql files.
Where do I find them and what information do they contain?

Even with the apps up and running I see an exception in the log file:

Code: Select all

org.hibernate.exception.SQLGrammarException: Table 'broadleaf.blc_system_property' doesn't exist


Is there another sql script I miss?

BR
Timon

Re: Name [jdbc/web] is not bound in this Context

Posted: Sun Jul 19, 2015 5:25 am
by blondeMatrix
Hello Timon,

Firstly, I must warn you that I am new to Broadleaf myself. But I may have crossed a few bridges already that you are yet to encounter. Very happy to share what I've learned so far.

They were defined in the Broadleaf context.xml files.


This is fine, and I did the same. Broadleaf should therefore discover the JNDI source regardless of whether you run it from a standalone instance of Tomcat, or that bundled with IntelliJ IDEA.

I set the database connection parameters in the setenv.sh file.


The environment variables you set will be available to standalone Tomcat, but I'm not so sure about IntelliJ (bundled) Tomcat. The Broadleaf guide directs us to pass these variables via IntelliJ IDEA's Tomcat configuration window. Perhaps try this if you think there may be a problem here.

I was also able to run the admin and site war files on a standalone Tomcat by copying them into the webapps folder.


I was having no success running Broadleaf until I did exactly this. :-)

I was not aware of the mentioned sql files.
Where do I find them and what information do they contain?


They are necessary for building and populating various tables that Broadleaf requires in order to run. Evidently these three necessary scripts are not included in the Broadleaf distribution, and I've been unable to get an explanation why (refer my earlier posts in this same forum).

Scripts available here: https://github.com/BroadleafCommerce/Br ... fig/bc/sql

Even with the apps up and running I see an exception in the log file:


Seems to confirm that you are missing tables created and populated by the above SQL scripts.

Hope you have success. Feel free to drop me a line if you decide to persevere with Broadleaf, and would like to collaborate with another Broadleaf newbie. :-D

Regards,

Chris (ChrisFromTimon@christopher.net.nz)