facebook

Debug server – source jars with Maven

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #316037 Reply

    christweekie
    Member

    Hi

    I am running the Weblogic server from within MyEclipse. The web app deployment in Weblogic points at my “target” folder in MyEclipse because this is a Maven-organised project.

    I have created a custom server project deployment and added to it the projects being used so I can debug my own code OK. However, when I step into external libraries I am having a problem – source jars for third parties aren’t being found. I click on Java Library and choose “Maven managed dependencies”. I then get a message telling me to “Use Maven Project Settings to configure maven dependency resolution”. The Maven Project Settings is clickable so I click it but nothing happens. So where can I do that ? I have had a look around project properties and can’t see it.

    I also tried adding a Classpath variable (with M2_HOME) but that didn’t work.

    All my source files are downloaded with maven and when I debug my unit tests the source JARs are found automatically.

    How can I make this work ? I could go and pick up all the source files one by one as external references from my maven repository but this is a bit cumbersome and there are a lot of JARS !

    Thanks

    Chris

    #316051 Reply

    If I good understand You just would like to add third parties dependencies to Your maven project .
    You can to right click on pom.xml and Open it with Maven Pom Editor and then You can click on the tab Dependencies
    and add dependencies in Dependencies Window.

    #316052 Reply

    christweekie
    Member

    Hi

    No – I am completely OK with adding dependencies in Maven. I have them all downloaded and, as I mentioned, the source JARs are there too. As my message says, I have no difficulty with the source jars when debugging unit tests.

    I have a problem when running my server in debug mode – it won’t find the source jars that are in my maven repository. This isn’t a question aboout Maven, it is a question about debuguing an app server. Please re-read my question.

    Thanks

    Chris

    #316142 Reply

    Brian Fernandes
    Moderator

    Chris,

    Could you explain how you deploy your application and start the server? The standard way is to use our deployment wizards and then start the server in the Server view (or it could start automatically if you choose the “Debug As” option). Are you doing this or using Maven commands or some other technique to deploy?

    What sort of project is this exactly, could you paste the contents .project file here? We’d also like to take a look at your pom.xml if possible, could you paste that here too or send both files via email to support@genuitec.com ATTN Brian with a link to this thread?

    I would just like to clarify – all external dependencies mentioned in your pom.xml file (essentially all JARs referenced by your project) do not have source when debugging, correct? Or, are these dependencies of dependencies – JARs that may not be directly referenced in your pom.xml.

    #316157 Reply

    christweekie
    Member

    Hi Brian

    Thanks for the reply. I have a workaround for this (that I don’t like) of adding the source JARs as I need them from external archive where I point them at my M2 repository. This works and proves the point that my source JARs are all downloaded.

    The server was added in MyEclipse ->Servers where I configured a Weblogic 10.x server by giving it the paths and weblogic user and password. So I can run or debug the server from within MyEclipse, no problem.

    In terms of the project, it seems to know it is a Maven project because I can right click and do Maven/Clean or right click on the POM and add a dependency or something via the menu option “Maven4MyEclipse”.

    However, when I try Maven / Test or something other than Clean, I get this

    [INFO] — maven-surefire-plugin:2.4.3:test (default-test) @ survey-assessment-web —
    [INFO] Surefire report directory: C:\Documents and Settings\sa_faulkner\My Documents\workspace-myeclipse\surveyass\survey-assessment-web\target\surefire-reports
    org.apache.maven.surefire.booter.SurefireExecutionException: Unable to find class to create suite ‘org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite’; nested exception is java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite; nested exception is org.apache.maven.surefire.testset.TestSetFailedException: Unable to find class to create suite ‘org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite’; nested exception is java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite
    org.apache.maven.surefire.testset.TestSetFailedException: Unable to find class to create suite ‘org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite’; nested exception is java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite
    java.lang.ClassNotFoundException: org.apache.maven.surefire.junit4.JUnit4DirectoryTestSuite
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:103)
    at org.apache.maven.surefire.Surefire.instantiateObject(Surefire.java:255)
    at org.apache.maven.surefire.Surefire.instantiateSuite(Surefire.java:305)
    at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:207)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
    at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 3.015s
    [INFO] Finished at: Tue Apr 19 10:28:27 BST 2011
    [INFO] Final Memory: 2M/5M

    So this means something is wrong with my Maven plugin but I haven’t got to the bottom of this. So unfortunately I run my maven targets from a command line.

    I’d rather not use the command line, obviously, but it doesn’t hamper me too much. I didn’t expect that this would interfere with the debugging of the server.

    Like I say, the unit tests also work fine and find the source files. So I expected that debugging the server would also be able to find the source JARs.

    Here is the .project. As you can see, we generated it outside of MyEclipse.

    <projectDescription>
    <name>survey-assessment-web</name>
    <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
    <projects>
    <project>survey-assessment-ejb</project>
    </projects>
    <buildSpec>
    <buildCommand>
    <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
    <triggers>full,incremental,</triggers>
    <arguments>
    <dictionary>
    <key>LaunchConfigHandle</key>
    <value><project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch</value>
    </dictionary>
    </arguments>
    </buildCommand>
    <buildCommand>
    <name>org.eclipse.jdt.core.javabuilder</name>
    </buildCommand>
    <buildCommand>
    <name>org.eclipse.wst.validation.validationbuilder</name>
    </buildCommand>
    </buildSpec>
    <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
    </projectDescription>

    Chris

    #316201 Reply

    Usually if this is a Maven project there would be an entry in classpath <classpathentry kind=”con” path=”org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER”/> .file
    and
    <buildCommand>
    <name>org.maven.ide.eclipse.maven2Builder</name>
    <arguments>
    </arguments>
    </buildCommand>
    …..
    <nature>org.maven.ide.eclipse.maven2Nature</nature>
    in .project file

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Debug server – source jars with Maven

You must be logged in to post in the forum log in