Fixed in master. One issue fixed: the maven-sql plugin only executes the last 
sqlCommand, so I've moved all the custom sql commands to a file and it's loaded 
by the developer profile, deploydb activator.
This fixes the NPE exception as well and adds system, admin accounts and users 
for developers only. Change, comment if necessary.

https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=commit;h=2bbbdbf58b40b6a5dbd9b010db89e5c934a69433
https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=commit;h=f940c566abda1a31c7364c975b28868251ef03ca

Regards.

________________________________________
From: Rohit Yadav [rohit.ya...@citrix.com]
Sent: Sunday, November 04, 2012 12:15 AM
To: cloudstack-dev@incubator.apache.org
Subject: RE: [BLOCKER] Database development fails to create admin user

Alright, so at least the bug is confirmed. So some reason on your environment, 
it's not able to find com.cloud.test.DatabaseConfig.
Check that you've defined your $CATALINA_HOME (which worked for me as I have my 
old ant libs deployed at that path), it's failing to find the classpaths.
Simply edit the deploy-db-dev.sh around line no. 122, comment out: #java -cp 
$CP com.cloud.test.DatabaseConfig $*  (this just checks database config.).

But this is just a workaround, we should fix it.

________________________________________
From: Charles Moulliard [ch0...@gmail.com]
Sent: Saturday, November 03, 2012 10:45 PM
To: cloudstack-dev
Subject: Re: [BLOCKER] Database development fails to create admin user

The workaround that you suggest does not work for me on a MACBOOK (MacOS
Lion) with last code version (master of git)

Here are the commands used

mvn -P developer clean install
mvn -P developer -pl developer -Ddeploydb

RedHat-MacBook:incubator-cloudstack chmoulli$ cd developer/target/db
RedHat-MacBook:db chmoulli$ sh deploy-db-dev.sh server-setup.xml
Recreating Database cloud.
Recreating Database cloud_usage
CP is
./:/conf:/usr/share/java/mysql-connector-java.jar:/webapps/client/WEB-INF/lib/*.jar:/lib/*.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
com/cloud/test/DatabaseConfig
Caused by: java.lang.ClassNotFoundException: com.cloud.test.DatabaseConfig
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


On Sat, Nov 3, 2012 at 6:03 PM, Charles Moulliard <ch0...@gmail.com> wrote:

> I have done a test using a LINUX  machine where I don't have an issue with
> maven mysql plugin and get a NPE while running the mngt server. In this
> case, we cannot log on to the web site using admin/password
>
> mvn clean install -P developer
> mvn -P developer -pl developer -Ddeploydb
> mvn -P developer -pl tools/devcloud -Ddeploydb
>  mvn -pl :cloud-client-ui jetty:run
>
> ERROR [cloud.servlet.CloudStartupServlet] (main:) Exception starting
> management server
> java.lang.NullPointerException
> at
> com.cloud.server.ManagementServerImpl.enableAdminUser(ManagementServerImpl.java:3605)
> at com.cloud.servlet.CloudStartupServlet.init(CloudStartupServlet.java:50)
>  at javax.servlet.GenericServlet.init(GenericServlet.java:241)
> at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
>  at
> org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
>  at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:736)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
>  at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
>  at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
> at
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
>  at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
>  at
> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
>  at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
>  at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at org.mortbay.jetty.Server.doStart(Server.java:224)
>  at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
>  at
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
>  at
> org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
> at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
>  at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>  at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>  at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>  at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>  at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>  at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>  at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> 2012-11-03 17:58:27.435:WARN:/client:unavailable
> javax.servlet.ServletException
>  at
> com.cloud.servlet.CloudStartupServlet.init(CloudStartupServlet.java:57)
> at javax.servlet.GenericServlet.init(GenericServlet.java:241)
>  at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
> at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
>  at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:736)
>  at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
>  at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
> at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
>  at
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
>  at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
>  at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
>  at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
>  at org.mortbay.jetty.Server.doStart(Server.java:224)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
>  at
> org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
>  at
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
> at
> org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
>  at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
> at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>  at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>  at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>  at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>  at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
>  at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>  at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> 2012-11-03 17:58:27.445:INFO::Started SelectChannelConnector@0.0.0.0:8080
>
> When I start the script to deploy I get another error :
>
> cmoulliard@cmoulliard-Latitude-E6510~/MyRepositories/incubator-cloudstack $ 
> mvn -P developer,deploysvr -pl
> tools/devcloud -Ddeploysvr
> [INFO] Scanning for projects...
> [INFO]
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Apache CloudStack Developer Tools 4.1.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-remote-resources-plugin:1.3:process (default) @
> cloud-devcloud ---
> [INFO]
> [INFO] --- maven-site-plugin:3.1:attach-descriptor (attach-descriptor) @
> cloud-devcloud ---
> [INFO]
> [INFO] --- exec-maven-plugin:1.2.1:exec (default) @ cloud-devcloud ---
> Traceback (most recent call last):
>   File "../marvin/marvin/deployDataCenter.py", line 435, in <module>
>     deploy.deploy()
>   File "../marvin/marvin/deployDataCenter.py", line 418, in deploy
>     self.loadCfg()
>   File "../marvin/marvin/deployDataCenter.py", line 394, in loadCfg
>     apiKey, securityKey = self.registerApiKey()
>   File "../marvin/marvin/deployDataCenter.py", line 334, in registerApiKey
>     listuserRes = self.testClient.getApiClient().listUsers(listuser)
>   File
> "/home/cmoulliard/MyRepositories/incubator-cloudstack/tools/marvin/marvin/cloudstackAPI/cloudstackAPIClient.py",
> line 327, in listUsers
>     response = self.connection.make_request(command, response)
>   File
> "/home/cmoulliard/MyRepositories/incubator-cloudstack/tools/marvin/marvin/cloudstackConnection.py",
> line 171, in make_request
>     result = self.make_request_without_auth(commandName, requests)
>   File
> "/home/cmoulliard/MyRepositories/incubator-cloudstack/tools/marvin/marvin/cloudstackConnection.py",
> line 102, in make_request_without_auth
>     self.connection = 
> urllib2.urlopen("http://%s:%d/client/api?%s"%(self.mgtSvr,
> self.port, requestUrl))
>   File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
>     return _opener.open(url, data, timeout)
>   File "/usr/lib/python2.7/urllib2.py", line 400, in open
>     response = self._open(req, data)
>   File "/usr/lib/python2.7/urllib2.py", line 418, in _open
>     '_open', req)
>   File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
>     result = func(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
>     return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
>     raise URLError(err)
> urllib2.URLError: <urlopen error [Errno 111] Connection refused>
>
> Regards,
>
>
>
> On Sat, Nov 3, 2012 at 5:54 PM, Charles Moulliard <ch0...@gmail.com>wrote:
>
>> Will make a test and come back to you.
>>
>>
>> On Sat, Nov 3, 2012 at 5:50 PM, Rohit Yadav <rohit.ya...@citrix.com>wrote:
>>
>>> Can you confirm after a clean install/build with latest master, you get
>>> NullPointerException while running mgmt server which fails to start the api
>>> server?
>>> What I posted as a workaround requires you to build and mvn install. But
>>> we need to confirm if it's just me or do we really have this issue?
>>>
>>> Regards.
>>> ________________________________________
>>> From: Charles Moulliard [ch0...@gmail.com]
>>> Sent: Saturday, November 03, 2012 9:49 PM
>>> To: cloudstack-dev
>>> Subject: Re: [BLOCKER] Database development fails to create admin user
>>>
>>> Get the following exception :
>>>
>>> RedHat-MacBook:incubator-cloudstack chmoulli$ cd developer/target/db
>>> RedHat-MacBook:db chmoulli$ sh deploy-db-dev.sh server-setup.xml
>>> Recreating Database cloud.
>>> Recreating Database cloud_usage
>>> CP is
>>>
>>> ./:/conf:/usr/share/java/mysql-connector-java.jar:/webapps/client/WEB-INF/lib/*.jar:/lib/*.jar
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> com/cloud/test/DatabaseConfig
>>> Caused by: java.lang.ClassNotFoundException:
>>> com.cloud.test.DatabaseConfig
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>
>>>
>>> On Sat, Nov 3, 2012 at 2:47 PM, Rohit Yadav <rohit.ya...@citrix.com>
>>> wrote:
>>>
>>> > I'm frequently getting NPE while starting mgmt server. The old ant
>>> build
>>> > system would create admin and system users while deploydb-ing. For
>>> maven,
>>> > we call custom rules that the mysql plugin which then applies various
>>> sql
>>> > files. I checked while this creates the system user but only when mgmt
>>> > server is run, it won't create the admin user for me therefore when I
>>> try
>>> > to run my mgmt server I get NPE from enableAdminUser(). Can anyone
>>> confirm
>>> > this? I've opened an issue for this (
>>> > https://issues.apache.org/jira/browse/CLOUDSTACK-441).
>>> >
>>> > Hoping this is not my local env. which is causing the issue, how
>>> should we
>>> > fix it? A solution would be to reuse the setup/db/deploy-db-dev.sh
>>> which
>>> > deploys database for developers using the setup/db/server-setup.xml
>>> both of
>>> > which end up in developer/target when one does: mvn -P developer -pl
>>> > developer  -Ddeploydb So, just use a exec plugin to set this up?
>>> >
>>> > This worked for me:
>>> > mvn clean install -P developer
>>> > cd developer/target/db
>>> > sh deploy-db-dev.sh server-setup.xml
>>> >
>>> > Regards.
>>>
>>>
>>>
>>>
>>> --
>>> Charles Moulliard
>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>
>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>


--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Reply via email to