10 Replies Latest reply on Feb 17, 2012 3:41 PM by gboro54

    Deploy datasource to 7.1...

    gboro54

      I am trying to do the following to deploy a datasource to a managed instance of jboss 7.1...However i get the following exception :

      {code}

      java.lang.NullPointerException

             at org.jboss.as.plugin.deployment.AbstractDeployment.execute(AbstractDep

      oyment.java:214)

             at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi

      Manager.java:490)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa

      ltLifecycleExecutor.java:694)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi

      ecycle(DefaultLifecycleExecutor.java:556)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau

      tLifecycleExecutor.java:535)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan

      leFailures(DefaultLifecycleExecutor.java:387)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen

      s(DefaultLifecycleExecutor.java:348)

             at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi

      ecycleExecutor.java:180)

             at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)

             at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)

             at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)

             at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6

      )

             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

      ava:39)

             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

      orImpl.java:25)

             at java.lang.reflect.Method.invoke(Method.java:597)

             at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)

             at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)

             at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

       

       

             at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

      {code}

       

       

      here is a clip from my pom.xml

       

      {code:xml}

      <plugin>

                                                                  <groupId>org.jboss.as.plugins</groupId>

                                                                  <artifactId>jboss-as-maven-plugin</artifactId>

                                                                  <version>${version.jbossas_7}</version>

                                                                  <executions>

                                                                            <execution>

                                                                                      <id>deploy-driver</id>

                                                                                      <phase>pre-integration-test</phase>

                                                                                      <configuration>

                                                                                                <groupId>com</groupId>

                                                                                                <artifactId>microsoft</artifactId>

                                                                                                <name>sqlserver.jar</name>

                                                                                      </configuration>

                                                                                      <goals>

                                                                                                <goal>deploy-artifact</goal>

                                                                                      </goals>

                                                                            </execution>

                                                                            <execution>

                                                                                      <id>add-datasource</id>

                                                                                      <phase>pre-integration-test</phase>

                                                                                      <configuration>

                                                                                                <address>subsystem=datasources</address>

                                                                                                <enableResource>true</enableResource>

                                                                                                <properties>

                                                                                                          <connection-url>jdbc:sqlserver://test:1433;databaseName=test</connection-url>

                                                                                                          <jndi-name>testDb</jndi-name>

                                                                                                          <enabled>true</enabled>

                                                                                                          <pool-name>testPool</pool-name>

                                                                                                          <user-name>test</user-name>

                                                                                                          <password>test</password>

                                                                                                          <driver-name>sqlserver.jar</driver-name>

                                                                                                </properties>

                                                                                      </configuration>

                                                                                      <goals>

                                                                                                <goal>add-resource</goal>

                                                                                      </goals>

                                                                            </execution>

                                                                  </executions>

                                                        </plugin>

       

      {code}

        • 1. Re: Deploy datasource to 7.1...
          jamezp

          What's version of the plugin are you using?

          • 2. Re: Deploy datasource to 7.1...
            gboro54

            7.1.0.Final

            • 3. Re: Deploy datasource to 7.1...
              jamezp

              Ah, okay thanks. That's a bug and I'll get it fixed.

               

              Back to your main issue though, my guess is that something is wrong about the artifact. Do you have a dependency defined for the com:microsoft:sqlserver?

               

              BTW, if you're on IRC join #jboss if you want to chat about this, I'm jamezp on there.

               

              --

              James R. Perkins

              • 4. Re: Deploy datasource to 7.1...
                gboro54

                The sql server jar deploys...the datasource is never created....

                • 5. Re: Deploy datasource to 7.1...
                  jamezp

                  That error really looks like it's coming from the deployment. The line the NPE is being thrown on is not in the add-resource goal. The problem is because of the NPE we don't know what the error is :-)

                   

                  Is there anything in the server.log?

                   

                  I've also attached the latest snapshot if you'd like to try it. It should get rid of the NPE and hopefully give a better error.

                   

                  Removed the bad plugin JAR Message was edited by: James Perkins

                  • 6. Re: Deploy datasource to 7.1...
                    gboro54

                    Added the snapshot to my local maven reporistory and upgrade the version and get the following exception:

                     

                     

                    {code}

                    Missing:

                    ----------

                    1) org.jboss.as:jboss-as-controller-client:jar:7.1.1.Final-SNAPSHOT

                     

                     

                      Try downloading the file manually from the project website.

                     

                     

                      Then, install it using the command:

                          mvn install:install-file -DgroupId=org.jboss.as -DartifactId=jboss-as-cont

                    roller-client -Dversion=7.1.1.Final-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/fil

                    e

                     

                     

                      Alternatively, if you host your own repository you can deploy the file there:

                     

                     

                          mvn deploy:deploy-file -DgroupId=org.jboss.as -DartifactId=jboss-as-contro

                    ller-client -Dversion=7.1.1.Final-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

                    -Durl=[url] -DrepositoryId=[id]

                     

                     

                      Path to dependency:

                            1) org.jboss.as.plugins:jboss-as-maven-plugin:maven-plugin:7.1.1.Final-S

                    NAPSHOT

                            2) org.jboss.as:jboss-as-controller-client:jar:7.1.1.Final-SNAPSHOT

                     

                     

                    {code}

                    • 7. Re: Deploy datasource to 7.1...
                      jamezp

                      Sorry about that, I should have thought of it. I've attached a new version of the 7.1.0.Final jar witht the fix. Hopefully this one will work.

                      • 8. Re: Deploy datasource to 7.1...
                        gboro54

                        Ok...we have real exception now

                        {code}

                        [ERROR] BUILD ERROR

                        [INFO] ------------------------------------------------------------------------

                        [INFO] Could not execute goal deploy on null. Reason: Could not resolve artifact

                        to deploy com:microsoft

                         

                        {code}

                         

                         

                        Here is the pom snippets

                         

                         

                         

                        {code:xml}

                         



                        <dependency>



                        <groupId>com.microsoft</groupId>



                        <artifactId>sqlserver</artifactId>



                        <version>3.0</version>



                        <scope>test</scope>


                        </dependency>

                        ....

                        ...

                        ...

                         






                        <plugin>






                        <groupId>org.jboss.as.plugins</groupId>






                        <artifactId>jboss-as-maven-plugin</artifactId>






                        <version>${version.jbossas_7}</version>






                        <executions>







                        <execution>








                        <id>deploy-driver</id>








                        <phase>package</phase>








                        <configuration>









                        <groupId>com</groupId>









                        <artifactId>microsoft</artifactId>









                        <name>sqlserver.jar</name>








                        </configuration>








                        <goals>









                        <goal>deploy-artifact</goal>








                        </goals>







                        </execution>







                        <execution>








                        <id>add-datasource</id>








                        <phase>package</phase>








                        <configuration>









                        <address>subsystem=datasources</address>









                        <enableResource>true</enableResource>









                        <properties>










                        <connection-url>jdbc:sqlserver://test:1433;databaseName=test</connection-url>










                        <jndi-name>testDb</jndi-name>










                        <enabled>true</enabled>










                        <pool-name>testDBPool</pool-name>










                        <user-name>test</user-name>










                        <password>test</password>










                        <driver-name>sqlserver.jar</driver-name>









                        </properties>








                        </configuration>








                        <goals>









                        <goal>add-resource</goal>








                        </goals>







                        </execution>






                        </executions>





                        </plugin>




                         

                        {code}

                         

                         

                         

                        Also this is happening after the deployment of the arquillian deployment....What part of the lifecycle would go before the deployment but after starting jboss? Or is there a way to add this before JBoss starts?

                        • 9. Re: Deploy datasource to 7.1...
                          jamezp

                          Ah, got it! You've got the following in your deploy-artifact goal

                           

                          <configuration>
                              <groupId>com</groupId>
                              <artifactId>microsoft</artifactId>
                              <name>sqlserver.jar</name>
                          </configuration>
                          
                          

                           

                          It looks like the following as your dependency

                           

                          <dependency>
                              <groupId>com.microsoft</groupId>
                              <artifactId>sqlserver</artifactId>
                              <version>3.0</version>
                              <scope>test</scope>
                          </dependency>
                          
                          

                           

                           

                          You need to make the groupId and the artifactId match, so you should end up with

                           

                          <plugin>
                              <groupId>org.jboss.as.plugins</groupId>
                              <artifactId>jboss-as-maven-plugin</artifactId>
                              <version>${version.jbossas_7}</version>
                              <executions>
                                  <execution>
                                      <id>deploy-driver</id>
                                      <phase>package</phase>
                                      <configuration>
                                          <groupId>com.microsoft</groupId>
                                          <artifactId>sqlserver</artifactId>
                                          <name>sqlserver.jar</name>
                                      </configuration>
                                      <goals>
                                          <goal>deploy-artifact</goal>
                                      </goals>
                                  </execution>
                                  ...
                              </executions>
                          </plugin>
                          
                          
                          

                           

                          Notice the groupId and the artifcatId match.

                          • 10. Re: Deploy datasource to 7.1...
                            gboro54

                            Nice catch ...now if I can just figure out how to have the ds deploy before the arquillain deployment...