Announcement Announcement Module
Collapse
No announcement yet.
Classpath within application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Classpath within application

    I'm new to Spring and I've been assigned the task of incorporating an application (which isn't a true bean - which may be part of my problem) to use activemq.

    Using:
    <bean id="myApp" class="my.package.MyApp" init-method="start">

    does start the application. But the application uses class.getResource("/MyFile.xml");
    to load various data. It fails this because it looks like the classpath used to start activemq does not seem to get down to the application.

    System.out.println("Classpath = " + System.getProperty ("java.class.path"));

    returns --> Classpath = C:activemq-4.0-M4\bin\../bin/run.jar

    I was wondering if there was anything in Spring that would let me pass the classpath down to the application?

    Thx.

  • #2
    Originally posted by rbrush
    But the application uses class.getResource("/MyFile.xml");
    to load various data. It fails this because it looks like the classpath used to start activemq does not seem to get down to the application.
    Why don't you let Spring locate that resource for you?

    Originally posted by rbrush
    I was wondering if there was anything in Spring that would let me pass the classpath down to the application?
    I had a similar problem, where I needed to set the default locale of the JVM.
    I had it like that:

    Code:
      <bean id="localeSetter" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod" value="java.util.Locale.setDefault"/>
        <property name="arguments">
          <list>
            <value>en_DE</value>
          </list>
        </property>
      </bean>
    you can use the same approach to set something else to the env.

    Comment


    • #3
      "C:activemq-4.0-M4\bin\../bin/run.jar" looks a bit weird. Is the backslash after C: actually missing or is that a typo?

      Resides MyFile.xml in the root of run.jar?

      Regards,
      Andreas

      Comment


      • #4
        Originally posted by Andreas Senft
        "C:activemq-4.0-M4\bin\../bin/run.jar" looks a bit weird. Is the backslash after C: actually missing or is that a typo?

        Resides MyFile.xml in the root of run.jar?

        Regards,
        Andreas
        MyFile.xml resides in my own jar (test.jar) - run.jar is the activemq broker. I know my jar is in the initial classpath, else it wouldn't start at all.

        The classpath was a bit of typo - this is copied exactly:

        Classpath = C:\activemq-4.0-M4\bin\../bin/run.jar

        Comment


        • #5
          Fix found

          I got a solution from the activemq forum. Had to use the full path for the class

          Comment

          Working...
          X