how to deploy a jar in glassfish so that it gets executed

I have a simple jar file that just writes a integer to a file.
i have checked that the jar works by :
java -jar myApp.jar

I have placed the jar file [with permissions] it in the glassfish/modules folder . but it is not getting executed after i start glassfish.
pvinodpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pvinodpAuthor Commented:
thanks for that link. But i am using spring to call my jar..pleaase helpme to call my jar thru spring in a glassfish container.

I am pasting my jar content here for reference:

1.      $baseDir/META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: root
Build-Jdk: 1.6.0_33


2. $baseDir/META-INF/spring/myApp-beans.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   
   <bean id="auditExecutor" class="org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean">
      <property name="scheduledExecutorTasks">
         <array>
            <ref local="auditPurgeJob"/>
         </array>
      </property>
   </bean>

   <!-- Example configuration of the AuditPurgeJob using the spring executor integration -->
   <!-- Should in theory be configured and managed via the Scheduled Job Service -->
   <bean id="auditPurgeJob" class="org.springframework.scheduling.concurrent.ScheduledExecutorTask">
      <property name="delay" value="1"/>
      <property name="period" value="3"/>
      <property name="timeUnit" value="MINUTES"/>
      <property name="runnable">
         <bean class="com.mycompany.app.App">
         </bean>
      </property>
   </bean>
</beans>

3.  $baseDir/META-INF/spring/myApp-config.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">


</beans>

4.  pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>my-app</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
                <resources>
                        <resource>
                        <directory>${basedir}</directory>
                                <includes>
                                        <include>META-INF/</include>
                                </includes>
                        </resource>
                </resources>
  </build>
</project>


5.   pom.properties

#Generated by Maven
#Tue Oct 15 11:33:33 IST 2013
version=1.0-SNAPSHOT
groupId=com.mycompany.app
artifactId=my-app


6.  App.java
package com.mycompany.app;

import java.io.FileOutputStream;
import java.io.IOException;


public class App implements Runnable {

   public void run(){
     
      FileOutputStream out = null;

      try {
          out = new FileOutputStream("/tmp/outagain.txt");
          int c=1000;
          String suv ="suv";
          while (c > 0) {
             suv = suv+c;
             byte[] bytes = suv.getBytes("UTF-16");
             out.write(c);
              c--;
          }
      }
      catch (IOException ioe){
         System.out.println(ioe.getLocalizedMessage());
      }finally {
          if (out != null) {
              try {
               out.close();
            } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
            }
          }
      }
   }
0
pvinodpAuthor Commented:
I am closing the question . I am having a need to deploy the jar in a bundle format.. I got it working. THanks for your help anyways
0
CEHJCommented:
ok :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.