• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NbetBeans: Basic Maven actions applied with the Java EE 7 tutorial examples.

 
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

The Java EE 7 Tutorial (the two Oracle books) has three final examples, which need to be deployed with Maven.
The book assumes that the examples work just out of the box. But..

The first example, Dukes bookstore does work. It's a simple WAR application with JSF.

The second example, Dukes tutoring doesn't work. Is a little more complicated WAR and JAR application together in an EAR folder.
I right clicked the EAR file in Netbeans and build the app with dependencies.

I got the following error:


I've checked the pom.xml (the relevant bit):

What could be wrong is the ${glassfish.home} var. Does anyone know where i can reset this var? In the error, the location is wrong compared with the actual location.
Hopefully this solves the issue.

The third example, Dukes Forest doesn't work as well. Is the most comlete application with Entities in a sepperated JAR, EJB container and three WAR apps.

The building with dependencies is succesfull. How as my ${glassfish.home} seems to be wrong? It must be declared in the app itself then? The pom.xml is exactly the same.

Now when running one of the WAR's (i.e. dukes-store) i get:

The groupid is for each subproject of the AER file: org.glassfish.javaeetutorial.
So what could i be missing?

So my two main Maven questions are:
1. (Second example) How can i set the ${glassfish.home} var right? And is this actually the reason for the error?
2. (third example) How can the app be build succesfully, missing dependecies? Wasn't the org.glassfish.javaeetutorial:dukes-payment:war:7.0.5 package local?

Hopefully with some help i can get the examples working and get to learn more about Jave EE and Maven.
Thanks!

Peter,
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added "NetBeans" to the subject. I don't know how to set the property in NetBeans, but that's definitely the root of your problem.
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.) Generally you set properties in maven using the properties tag (directly inside the project tag)



2.) If the artifact with id entities is not a submodule of the project that builds the war then you need to build the entities artifact first before building the war project.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example 2
I was able to reset the maven location in netbeans.
The error remained the same.
After re reeding the error something got my attention:



This means the glassfish server location is wrong. Knowing the actual location.

Now in netbeans services adding a new glassfish instance with the correct parameters. The error still remains the same with the unupdated glassfish location.

So the off-topic question would be. How can i have the application to run with the correct server being refreshed.
The on-topic question would be: How can i set Maven correct with the correct server and packages without Netbeans, with commandline (bash)? This would be my preferable solution as i would rather work in a terminal than in a netbeans gui.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked if the glassfish.home property has been set in any of your poms (including parent poms)? If not set you should try setting it as I explained above. Sorry I don't have the tutorials you are trying to run so I can't verify if the property is defined.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've modified the pom.xml and the path was succesfully changed. The error remained the same, with the correct glassfish parameters.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which error remained?
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This one:
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/Users/peter/Applications/glassfish4/bin/asadmin$ soesn't seem right. Maybe you should set the property ${glassfish.executables.suffix} to .exe. Is there a /Users/peter/Applications/glassfish4/bin/asadmin.exe file in that location?
Also, if on windows you might need to have the path including the drive e.g C:/Users/...
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm on a Mac.

asadmin is a shell script.
The asadmin command runned in the terminal succesfully.
I tried it to check path and permission.

If anyone would like to have the examples (installing glassfish updatetool):
I added the glassfish installation path and a child path to system variables:

glassfish-installation/bin/
glassfish-installation/glassfish/bin/


Or you could just go to glassfish-installation/bin/

Then in a terminal type updatetool.
After installing retype updatetool to start.
Then in the updatetool's gui -> Java ee 7 sdk
Select Available Updates.
From the list select Java ee tutorial.
Click install
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My mistake: the asadmin location was also a system variable.
So me running the asadmin command in the terminal in the right location wasn't actually confirming the right location. Being able to succesfully run the command from anywhere 8-).
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But i do know that this location is correct (pwd command) :

/Users/peter/Applications/glassfish4/bin/

The ${glassfish.executables.suffix} could be either .bat or .sh
Those are the two asadmin files in the location.

I just got one step further i guess:


There are three dom files

dukes-tutoring EAR
dukes-tutoring-common JAR
dukes-tutoring-war WAR

previously i only poster the main EAR dom.xml

The only part not working is dukes-tutoring-war.


This is it's respective dom.xml file:

Hopelully this helps solving.
Why would exec-maven-plugin not work?

Thanks a lot!

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The No such file or directory error suggests that the command is not being found. You have <executable>${glassfish.home}/bin/asadmin$</executable> in your xml. The asadmin$ part looks weird. Should that not be asadmin.sh instead of having a $?
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Both locations are correct.
I have tried all possible extensions.

After rereding the error i found:

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you see my reply above?
The line that says

<executable>${glassfish.home}/bin/asadmin$</executable>


is most likely incorrect. That $ should not be at there. You probably tried to remove the suffix property but left the $ there by mistake.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i seen it and carefully removed the $.

The error remained, the link in the error explaines that is might be cuased by wrong plugin configuration.
So i'm searching for the org.codehaus.mojo:exec-maven-plugin:1.2.1:exec package i guess.
Is there a default location for maven plugins?

 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does the full error message say now?
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should ~/Applications/glassfish4/bin/asadmin not be ~/Applications/glassfish4/bin/asadmin.sh?
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried it, same error:


 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think i'm one step further now.

I removed in the WAR's pom.xml:

I got an relative path warning after that:
I changed the path in the AER's pom :


And now i have this error:


The link explains to contact the package maintainer.

Where can i find this package? org.codehaus.cargo: (cargo-maven2-plugin:1.4.4)
Where can i configure them?
Am i missing the bigger "Maven" picture?
Why is an out of the box application from Oracle not running?
I must be missing something?

Just sharing the process of solving the problem and learning from it .
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I reset the Java sdk 7 location in Netbeans:
webpage

But it did not help reconfiguring the glassfish server.
The book explains to point at the Java EE 7 SDK.
extracting the java_ee_sdk-7u1.zip results in a glassfish file.
Pointing at this location should be correct.
Still same error. The location was already correct.

I guess this is the most relevant bit of the error:


And I was able to find the location of the Maven package:
Users/peter/.m2/repository/org/codehaus/cargo

I think i found something again:
Stackoverflow
The oracle "examples" have one main pom.xml file. Where all projects dom.xml cascade from.
I was only able to see the main pom.xml file in the filesystem not with Netbeans opening the "examples".
The book didn't wright about this.

The "examples" pom.xml file.

I think i found something.

Hopefully I can solve this issue now.

 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After filling in the Grandfather pom.xml
I got this error:


Significant bit:

After setting the password in /Users/peter/Applications/glassfish4/glassfish/domains/password.properties

I got:

After reading the log file:

I got stuck i guess.
I haven't got a clue in just srarting the Oracle examples.
Idea anyone?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic