Using Eclipse, I have configured one Java EE project to include in its class path the JBoss 7.1 Runtime.
(I did this with the "Add Library" button in "Project properties" -> "Java build path" -> "Libraries").
I use Maven to build the project and "normally" this works fine.
However, when I debug this application the Java EE source classes are not available. Just in case I took a look in the JBoss runtime but apparently the sources are not there. My main question is: Could someone please tell me what is the best way to add the Java EE sources to my Eclipse project so they will be available when debugging?
Also, if I am working with Maven is fine to add the Java EE libraries as the JBoss Runtime, as I am currently doing in my project? or it is considered a better approach to declare the dependency on Java EE in the project POM instead?
I started to wonder if the JBoss runtime approach was the "correct" way to add the Java EE binary classes, since strangely enough Maven from time to time fails compiling the application since it cannot see anymore the Java EE classes. I solve this deleting the JBoss Runtime from the build path (in the Eclipse project configuration) and adding them again. Fortunately, this compilation does not happen often, so I have been able to work doing this workaround until now.
Thanks for any feedback.
Related
I have maven based project with following structure:
main_project
module_webproject
module_java_proj_1
module_java_proj_2
module_java_proj_3
... ...
Everything compiles and packages fine with command line maven goals execution. I need to setup this project into eclipse environment for developers with tomcat deployment. Anyone know setup instructions?
Also, i am looking into tomcat hot deploy for debugging capabilities.
I have tried mvn eclipse:eclipse, this does only creation of .project and .classpath files. But projects directories are not treated as java or web projects.
Answer from following forum some what helps...
[Running Maven project on Tomcat from Eclipse
There can be a few reasons why you don't see the project in the Add/Remove projects dialog for Tomcat. Verify the following:
You have m2e installed (http://eclipse.org/m2e/download/)
You have m2e-wtp installed (http://www.eclipse.org/m2e-wtp/download/)
Your Maven project imported as a Dynamic Web Application. Look for a Deployment Descriptor entry when you expand the project, it should be somewhere in the first few entries. It is the second one down for me on Eclipse Juno. Not there? It's probably not a web app. Go back and verify 1 & 2, then remove and re-import your project.
Make sure that your web application is not too new for the version of Tomcat that you are using. Right-click the project and go to Properties > Project Facets. Look for Dynamic Web Module and check the version. If this version is too new for your Tomcat version, Eclipse won't let you add it. For instance, your Dynamic Web Module version is 3.0 and you're using Tomcat 6.
Looking for a clean way to export a NetBeans Java Web Project (Java EE) to Eclipse.
Already tried importing the war file, but it outputs many errors. I think because EJB object is not contained there.
Netbeans project has a connection with PostgreSQL, and Glassfish server, everything installed on my Windows PC. It's using the EJB module, and it features a REST implementation, with JPA persistance.
Using Netbeans 7.2 and Eclipse IDE 1.5 (latest)
Here is a view of the Netbeans project:
Below is the project resulted from the import of the war file (generated by Netbeans) in Eclipse.
Which would be a clean way to do this?
I can also hear ideas about importing it to IntelliJ Idea.
Solution took long, but here are the basic steps:
Create empty EAR Project In Eclipse, add 2 modules, EJB and Web Module. Then added JPA facets to the EJB project. Imported src folders. Then exported the EAR Project to to JBoss (changed Glassfish, no particular reason).
Basically 1 project in Netbeans is equivalent to 3 projects in Eclipse in this case.
Prepare to get your hands dirty.
Netbeans uses Ant build scripts by default. These scripts cannot be directly converted to work with Eclipse.
The way I did it was to create a Maven project in Netbeans and copy all source files from the Ant project to the Maven project. Eclipse provides a Maven plugin which enables you to work with Maven projects. Maven projects (if set up correctly) tend to be IDE independent.
You could try to create new project in Eclipse, and choose "Create project from existing source". Then point src folder from NetBeans project. You probably will need to organize your REST services etc by yourself, but I think that is the way.
I am trying to setup a new Netbeans project with JPA. The Java SDK version is 1.5.0_22-b03 and J2EE version is J2EE 1.4.I am using TOPLINK Essentials for JPA.
Going by javadoc javax.transaction.UserTransaction interface comes with J2EE 1.4.
Then why it's not able to find javax.transaction.UserTransaction?
The JPA 1.0 specification is meant to cater to Java EE 5 containers and not J2EE 1.4 containers (unless the same also support EJB 3.0 like the erstwhile OC4J containers from Oracle). Likewise JPA 2.0 caters to Java EE 6 containers.
I would suggest using Netbeans with Java EE 5 or Java EE 6, instead of heading for a wild goose chase on getting your JPA 1.0/2.0 provider to work amicably with a J2EE 1.4 container. This isn't merely about placing some JARs in your compile time classpath; your runtime classpath will require classes that are available only in a Java EE 5/6 container.
Either you have an incorrect classpath or you are missing a required jar. What are you using to build?
You have not correctly included the j2ee-1.4.jar in your project classpath. Otherwise you can reference to it. Perhaps you meet problem in setting classpath of your java project in netbeans.
Please check your jar to ensure it is correctly downloaded.
Maybe this is an old question but since no other answer has been posted, I post what I was able to do to make it work.
I found a file at:
C:\Program Files (x86)\NetBeans 8.1\java\modules\ext\hibernate4
Right-click your project >Libraries >Add jar > find your Netbeans installation directory...
usually => C:\Program Files (x86)\NetBeansXXX
find java\modules\ext\hibernate4 and choose jboss-transaction-apixxxxx.jar
hope it helps everyone else,
I've just installed Eclipse Indigo for EE and Java EE 6 SDK/JRE from Sun. I need all those to compile a 3rd party Java project using the "javax.*" classes. What I cannot understand how to reach those classes?
How can I import or otherwise connect to "javax.*" classes inside Eclipse?
They're in the Java EE implementation. In other words, they're in the application server. For example, Glassfish, JBoss AS, Tomcat, etc.
In Eclipse, just integrate the target server in Servers view and associate the dynamic web project with it. You can select it during dynamic web project creation wizard:
or afterwards via Targeted Runtimes in project's properties:
Once associated the project with the application server, Eclipse will do all the necessary magic to make those classes available during compiletime. To verify it, the associated server should be listed as Library in project's Build Path property:
Note once again, you don't need to change/fiddle anything in there! If you did some attempts beforehand while shooting in the dark in order to "fix" this problem, then you should make sure that you've undone it all, or things may still go wrong.
See also:
How do I import the javax.servlet API in my Eclipse project?
Make sure you have all the settings in preferences set. Go to 'Window' -> 'Preferences' and then check the 'Installed JREs', point it to your newest and greatest jre within downloaded jdk. If that doesn't work, download jdk and eclipse Java EE again and start from scratch. Also make sure you have a java and javac added to your PATH (either on Linux or Windows)
I'm trying to include a project within another project as EE Dependency in Eclipse.
For some reason, the project I want to include is not displayed in the list of possible projects.
How does Eclipse decide which projects to use there?
Thanks!
WTP 1.5 (Eclipse 3.2+) introduced support for J2EE module dependencies for plain Java projects, external JARs, JARs in the workspace etc. This is controlled at the level of the Enterprise Application, rather than at the level of an EJB project or a Web Project.
Therefore, if you have a plain Java Project that you cannot add as a dependency to an EJB project, you can have this resolved by creating an Enterprise Application Project containing the EJB, and then adding the Java Project as a Java EE module dependency to the Enterprise Application. Once this is done, the Java Project is available as a Java EE module dependency for the EJB project.