Marko
Marko

Reputation: 159

glassfish v3 classpath settings

I'm developing j2ee app on glassfish v3 which will remotely call EJB deployed on jboss 5 app server. For this to work, my app has to have jboss client jars in class path. I managed to do this by packaging client jar files with my application, but this expends size by aprox 10mb, thus uploading app becomes an issue.

How can I put these jars elsewhere so that gf picks them up so I dont need to hold them in my app?

Upvotes: 5

Views: 12670

Answers (4)

tsmets
tsmets

Reputation: 91

For jar's this is OK but for property files it is something else. It tends to be harder unless you put them in the WAR (which means you cannot update them without a full redeploy).

I tried to put the xxx.properties in the config folder & adapting the following domain.xml line

 <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="${com.sun.aas.instanceRoot}/MY_VALUE" classpath-suffix="">
      ...
 </java-config>

with MY_VALUE taking the following values :

  1. config
  2. config/
  3. config/xxx.properties

Trying the same with the classpath-suffix did not help either.

Requesting the web-app to display the classpath with the following line :

String path = System.getProperty("java.class.path");
LOG.info("Classpath is : '" + path + "'.");

did show that the values were picked up ... but the property-file was never accessible from the ClassLoader.getResourceAsInputStream()

Upvotes: 1

software.wikipedia
software.wikipedia

Reputation: 719

Option 1: You can take care of this during the GF3 Deployment using the libraries option. This is what GF3 deploy screen says.

A comma-separated list of library JAR files. Specify the library JAR files by their relative or absolute paths. Specify relative paths relative to instance-root/lib/applibs. The libraries are made available to the application in the order specified.

In case you are using command line for deploying, please use --libraries option with asadmin command.

This may not be the best option since you need to take care of it every time a un-deploy is done. However, in case of redeployment this setting should be retained.

Option 2: Put them in the Glassfish domainname/lib directory. It will be automatically picked up and available to all your apps in same domain after restart.

Upvotes: 0

objectified
objectified

Reputation: 262

In your Glassfish domain's domain.xml you can use the classpath-suffix attribute of the java-config tag to point to locations that should be part of Glassfish's classpath for that particular domain.

Upvotes: 1

Zack Marrapese
Zack Marrapese

Reputation: 12080

You could put them in the server's classpath if necessary. Go to the domain's lib directory.

Upvotes: 1

Related Questions