4

I'm having a trouble: I've got a GlassFish Server configured in Eclipse. Now, I need to add a project to its classpath: I go to Run Configurations -> Glassfish -> "Glassfish 3.1.2. at localhost" (the current server). Now, as you can see from the image attached, I cannot select any server as it seems there's no server in the dropdown menu.

no server avaiable from dropdown list

I'd like to select the server and then go to "Classpath" and add the project... Anyone can help me?

What sounds strange to me is that when I run my web app, it runs on that server... So why can't I see it from Run Configuration?

Thanks to anyone can help, AN

andreaxi
  • 931
  • 5
  • 15
  • 28

1 Answers1

2

You likely a target runtime configured for GlassFish, but not a server instance. The launch configurations dialog isn't the right place for managing your servers. You need to do this via Servers view. In the Servers view, you can create a new server instance, assign projects to it, start/stop server, publish, etc.

If the Servers view is not visible for you currently, find it via Window -> Show View.

Konstantin Komissarchik
  • 28,879
  • 6
  • 61
  • 61
  • Thanks Konstantin, but if I start from Servers view I cannot find any way to add to the server's classpath a project. Do you know how to do that? – andreaxi Jun 21 '12 at 18:41
  • What exactly do you mean by add project to server's class? Are you trying to publish a WAR? – Konstantin Komissarchik Jun 21 '12 at 18:51
  • No, i want to add it to the **classpath** of the server: if I do that, i can use classes in the project added...If i don't, Glassfish tell me it cannot resolve some classes that are in the project I want to add. – andreaxi Jun 21 '12 at 21:06
  • Modifying the classpath of the server is not the best way to make additional classes accessible to modules you deploy. If you already added this project to your web app's build path, you should see a warning in the problems view regarding classes not being available at runtime. Right click on that warning and follow the quick fixes to tag that dependency for inclusion in your web app. – Konstantin Komissarchik Jun 21 '12 at 21:36
  • By "the problems view" do you mean the "Markers view"? If so, there's no warning or error saying that... How is it possible? Thanks again, Konstantin! – andreaxi Jun 22 '12 at 07:00
  • Ok, neither in Problems View there's something interesting (except some warnings, not related)... What can you suggest? Thanks – andreaxi Jun 22 '12 at 09:11
  • Try this instead... Remove your current reference from web project to java project. Then go to web project's properties. You want the "Deployment Assembly" screen. Then Add -> Project and select your java project. This will add the java project to web project's build path and also specify that it should be included in WEB-INF/lib during web app assembly. – Konstantin Komissarchik Jun 22 '12 at 17:02
  • This is the solution, thanks a lot. I was trying to export as a jar the first project and import it as a jar in the second. Every change I had to create again the jar ad re-import. This prevent to do that, doesn't it? – andreaxi Jun 23 '12 at 08:00
  • Yes. Eclipse will auto-package the jar for you when necessary. – Konstantin Komissarchik Jun 23 '12 at 23:33