This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235638 - no maven java library project type
Summary: no maven java library project type
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB Project (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-07 10:34 UTC by cdavis
Modified: 2014-08-21 11:56 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cdavis 2013-09-07 10:34:40 UTC
Adding a session bean to maven enterprise application project requires a maven Java library project into which to place the interface artifact(s) but there is no such project type in maven project templates.  The message in the wizard is:


"There is no suitable project available into which Remote interface could be stored. An open Maven-based Java Class Library project is required."
Comment 1 Stanislav Aubrecht 2013-09-09 07:12:40 UTC
Not sure where this belongs, please reassign as appropriate, thanks.
Comment 2 Martin Janicek 2013-09-09 08:29:22 UTC
Cdavis could you please describe step by step how to reproduce the problem? For example:

1. Create Maven EAR project
2. Create session bean on some kind of project
etc.

Thanks in advance!
Comment 3 cdavis 2013-09-09 12:38:43 UTC
(In reply to Martin Janicek from comment #2)
> Cdavis could you please describe step by step how to reproduce the problem?
> For example:
> 
> 1. Create Maven EAR project
> 2. Create session bean on some kind of project
> etc.
> 
> Thanks in advance!

1)  Create a maven enterprise application project
2)  Attempt to add a session bean to the ejb project.  Either stateless or stateful with a remote interface

You will get the message in red as soon as you select the "remote" interface option.  An enterprise project requires a Java library project to place the remote interface in so that it can be defined on both client and server.
Comment 4 Martin Janicek 2013-09-09 13:57:41 UTC
Thanks, the message is provided by j2ee.core module. Not really sure what is the exact purpose and how it should be improved --> reassigning
Comment 5 cdavis 2013-09-09 15:04:40 UTC
(In reply to Martin Janicek from comment #4)
> Thanks, the message is provided by j2ee.core module. Not really sure what is
> the exact purpose and how it should be improved --> reassigning

I "think" the solution is just to create an new maven project type "java library".  I experimented a bit over the week-end with using a maven archtype to create a java library project but nothing I tried worked.

Thanks for passing this along to somebody who knows what to do!
Comment 6 Martin Janicek 2013-09-09 16:22:29 UTC
(In reply to cdavis from comment #5)
> I "think" the solution is just to create an new maven project type "java
> library".  

Such solution doesn't make much sense because Maven does not provide this type of project. You can simply set your packaging to "jar", but in this case the problem is most probably just the message which someone copy-pasted from Ant based project type and not updated with respect to the Maven.
Comment 7 David Konecny 2013-09-09 23:49:52 UTC
The point is that Remote EJB interface must be defined in a different jar then one which contains the EJB implementation. That way any client of this Remote EJB which needs to use it and which needs to compile against the interface can do so.

Martin, could you just rename the message to say eg. "...An open Maven-based Java Application project is required. Or a project producing jar packaging."? Or something like that. Thanks.
Comment 8 Martin Janicek 2013-09-10 08:05:23 UTC
Ye sure, thanks for the explanation
Comment 9 Martin Janicek 2013-09-10 08:46:02 UTC
Davide I have changed the message (web-main #6e54c61c9e8c).

Still not sure how to use the wizard (in both Ant/Maven) to not show the message, but I guess it's just because I'm no doing it correctly.
Comment 10 cdavis 2013-09-11 00:07:36 UTC
(In reply to Martin Janicek from comment #9)
> Davide I have changed the message (web-main #6e54c61c9e8c).
> 
> Still not sure how to use the wizard (in both Ant/Maven) to not show the
> message, but I guess it's just because I'm no doing it correctly.

We're still going to have to have a maven controlled java library project to hold the remote interface no matter what the message says or does not say.  The message is correct that we have to open a maven controlled java library in order to have a place to put the remote interface.  Changing the message will not change the necessity.  We need a maven controlled java library project type.
Comment 11 Martin Janicek 2013-09-11 07:37:16 UTC
(In reply to cdavis from comment #10)
> We need a maven controlled java library project type.

And what exactly do you mean by this speaking in terms of Maven? From what I understand you need a simple Maven Java application with "jar" packaging, or?...
Comment 12 cdavis 2013-09-11 09:14:38 UTC
(In reply to Martin Janicek from comment #11)
> (In reply to cdavis from comment #10)
> > We need a maven controlled java library project type.
> 
> And what exactly do you mean by this speaking in terms of Maven? From what I
> understand you need a simple Maven Java application with "jar" packaging,
> or?...

A java class library is a collection of classes like the JDK itself.  It is not an application...there is no class with a "main" method. Go to File -> New Project -> Java.  You will see clearly there is a java application project and a java class library project.  We need a java class library project that is maven controlled to hold the remote interface(s) and all the data object definitions for a maven enterprise project type.  When using RMI or EJB the objects that move across the wire must be defined indentically (i.e. same serial values).  The only effective way to do that is to place them in a common class library that is included in the classpath on both server and client.

Go to File -> New Project -> Java EE and create an Enterprise Application.  On the third step of the wizard you will be asked to select the server, version and whether to create a web or EJB or both modules.  Select the EJB module.  Then select the ejb project that was just created, right click and select New -> Session Bean.  Select the "Remote" interface and you will be asked to select the java library to hold the remote interface.  That is the piece that is missing when creating a session bean for a maven enterprise project.
Comment 13 cdavis 2013-09-14 22:23:44 UTC
(In reply to Martin Janicek from comment #11)
> (In reply to cdavis from comment #10)
> > We need a maven controlled java library project type.
> 
> And what exactly do you mean by this speaking in terms of Maven? From what I
> understand you need a simple Maven Java application with "jar" packaging,
> or?...

I created a directory for my project and created within it a maven java application.  I then deleted the default class with "main" method and ended up with a maven java application project with "jar" packaging.  I then created a maven enterprise application and in the ebj module I tried to add a session bean.  When I clicked the "remote" interface button the combo box appeared but it did not have anything in it.  i.e. a maven java project with jar packaging is NOT the same as a maven controlled java library.

I verified two things:  changing the message does not fix the problem, and, what a session bean added to a maven enterprise application needs is not the same as a java application with jar packaging.
Comment 14 blatheron 2013-10-22 23:03:55 UTC
Has a work around been identified? Will I have to not use Maven?
Comment 15 cdavis 2013-10-23 13:36:49 UTC
(In reply to blatheron from comment #14)
> Has a work around been identified? Will I have to not use Maven?

Something seems to have changed because the combobox now (7.4) will allow you to create the remote interface class in a Maven netbeans module project.  So, while I hope it's not a workaround, I think the issue is fixed.  There are other "gotchas" with Maven, however.  Be sure you do the tutorials on the web site before you go too far unless you already know Maven.
Comment 16 prashanthk 2014-01-03 21:07:37 UTC
(In reply to cdavis from comment #15)
> (In reply to blatheron from comment #14)
> > Has a work around been identified? Will I have to not use Maven?
> 
> Something seems to have changed because the combobox now (7.4) will allow
> you to create the remote interface class in a Maven netbeans module project.
> So, while I hope it's not a workaround, I think the issue is fixed.  There
> are other "gotchas" with Maven, however.  Be sure you do the tutorials on
> the web site before you go too far unless you already know Maven.

Hi,

Can you reproduce this again. I mean can you start a clean maven javaee project and add stateless session bean with remote interface. I am still getting the error message "There is no suitable project available into which Remote interface could be stored..."

The env details I am using are below

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 17 cdavis 2014-01-04 22:53:16 UTC
What worked form me was to create a Maven NB Module to serve as a library to both client and server applications.  Then create a Maven Enterprise Application.  When you add the session bean it should let you put the interface in the first created module.

If this does not work then there has been a regression.  If so, try the current daily build and if it still does not work report back here.


(In reply to prashanthk from comment #16)

> Hi,
> 
> Can you reproduce this again. I mean can you start a clean maven javaee
> project and add stateless session bean with remote interface. I am still
> getting the error message "There is no suitable project available into which
> Remote interface could be stored..."
> 
> The env details I am using are below
> 
> Product Version: NetBeans IDE 7.4 (Build 201310111528)
> Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
> Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
> Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
> System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 18 prashanthk 2014-01-07 14:51:23 UTC
Thanks Davis, Your suggestion works for me.  


(In reply to cdavis from comment #17)
> What worked form me was to create a Maven NB Module to serve as a library to
> both client and server applications.  Then create a Maven Enterprise
> Application.  When you add the session bean it should let you put the
> interface in the first created module.
> 
> If this does not work then there has been a regression.  If so, try the
> current daily build and if it still does not work report back here.
> 
> 
> (In reply to prashanthk from comment #16)
> 
> > Hi,
> > 
> > Can you reproduce this again. I mean can you start a clean maven javaee
> > project and add stateless session bean with remote interface. I am still
> > getting the error message "There is no suitable project available into which
> > Remote interface could be stored..."
> > 
> > The env details I am using are below
> > 
> > Product Version: NetBeans IDE 7.4 (Build 201310111528)
> > Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
> > Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
> > Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
> > System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 19 blatheron 2014-01-11 01:38:01 UTC
The description for a netbean module has this info: 

NetBeans Platform-format module built using Maven. May be added as a dependency to a Platform-based application. (Can also be run standalone or in a "suite", in which case ${netbeans.installation} must be configured; this run mode should not be used for production code.)

How would you use it for production?

Also CDavis I sent info on postgresql and Ldap to your personal Email. Did you get it?

Thanks in advance
Comment 20 possel 2014-08-21 11:56:25 UTC
Is this bug supposed to be fixed in version 8.0? I still get the described erratic behaviour when i attempt to create some session bean with a remote interface - i cannot select any maven project to put the remote interface classes into (tried to create some maven application module, both as a standalone project and a module inside the main J2EE project, neither worked for me...)