facebook

Configure jrun4 in myEclipse 5.5.1 GA

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

    Hi All,

    I have searched the forum, but I was not able to find the answer to my question. Here goes:

    I would like to set up jrun4 server in myEclipse just like a Tomcat plugin. I would like to avoid deploy or copy files into jrun server if possible.

    This is what I did:

    1) Set up a typical myEclipse java project
    c:/sandbox/app1
    /src
    /classes
    /web/web-root/index.jsp
    /web/web-root/WEB-INF/web.xml

    The jars for this project are under
    <classpathentry exported=”true” kind=”var” path=”MAVEN_REPO\spring\jars\spring-2.0.1.jar”></classpathentry>
    <classpathentry exported=”true” kind=”var” path=”MAVEN_REPO\commons-discovery\jars\commons-discovery-0.4.jar”></classpathentry>
    <classpathentry exported=”true” kind=”var” path=”MAVEN_REPO\log4j\jars\log4j-1.2.8.jar”></classpathentry>

    2) Create a jrun server in Jrun admin
    Configure its deployment dir to c:/sandbox/app1/web

    3) Create a jrun server in myEclipse
    preference..app server..jrun..jrun4.x

    4) Start jrun server in myEclipse

    Everything seems fine except that the jars in my project classpath are not present, for example, the log4j jar and spring jar. Thus some servlets can not be initialized.

    Solutions:

    1) Copy all the jars to jrun lib directory. I am sure this would work, but it defeats the whole purpose of setting jrun up within Eclipse, in my view. I would like to have the tomcat plugin experience

    2) I tried to add the jars to the jrun class path, but somehow the values are lost once I exit the window:
    preference..app server..jrun..jrun4.x..launch..create launch configuration..classpath.. add projects or add external jars
    I can add them, but the modified values are not saved once I exit the window

    Any advice? I felt this must be a common question. However, maybe not many people are using jrun4..

    Your help is appreciated.

    Chang-QIng
    United Healthcare

    #273545 Reply

    See error below when the server (laww) is started: Could not pre-load servlet: spring

    Starting Macromedia JRun 4.0 (Build 106363), laww server
    08/06 10:01:57 info JRun Naming Service listening on *:2909
    08/06 10:01:58 info No JDBC data sources have been configured for this server (see jrun-resources.xml)
    08/06 10:01:58 info JRun Web Server listening on *:8101
    08/06 10:01:58 warning Deployer Service failed to deploy file:/C:/sandbox/laww_EAP_CERT_REL/webtier/CVS/
    * Unrecognized deployment: file:/C:/sandbox/laww_EAP_CERT_REL/webtier/CVS/
    08/06 10:01:59 info Deploying web application “Live and Work Well” from: file:/C:/sandbox/laww_EAP_CERT_REL/webtier/docs/
    08/06 10:01:59 user JSPServlet: init
    08/06 10:01:59 info org.springframework.web.servlet.DispatcherServlet
    08/06 10:01:59 error Could not pre-load servlet: spring
    08/06 10:01:59 info Deploying enterprise application “JRun 4.0 Internal J2EE Components” from: file:/C:/JRun4/lib/jrun-comp.ear
    08/06 10:01:59 info Deploying EJB “JRunSQLInvoker” from: file:/C:/JRun4/lib/jrun-comp.ear
    08/06 10:02:00 info Deploying enterprise application “Flash Remoting EAR” from: file:/C:/JRun4/lib/flashgateway.ear
    08/06 10:02:00 info Deploying web application “Flash Remoting” from: file:/C:/JRun4/lib/flashgateway.ear
    08/06 10:02:00 user JSPServlet: init
    08/06 10:02:00 user FlashGatewayServlet: init
    Server laww ready (startup time: 7 seconds)

    #273548 Reply

    Riyad Kalla
    Member

    Everything seems fine except that the jars in my project classpath are not present, for example, the log4j jar and spring jar. Thus some servlets can not be initialized.

    Actually the application server connector doesn’t pickup the project classpath and use it, you need to add those JARs under Window > Prefs > MyEclipse > App Servers > JRun > JRun 4.x > Paths, and click the “Add” button next to “Append to classpath”. Then you should be all set.

    #273549 Reply

    Thanks. It worked after I appended spring jar to the classpath. It is now complaining other classes not found, and that makes sense.

    However, what I wanted to achieve is to avoid manually add jars like this for many reasons.

    1) My class path is already defined, why cannt it be re-used for jrun4 server? Adding/defining jars one by one is cumbersome and error prone
    2) The jars are added/defined to the jrun4 server, however, I need to run multiple servers on my machine. Do I have to add-remove-add jars when I switch to a different server?

    Maybe I started this on the wrong direction. Can you please recommend a way that allows me to
    1) start/stop jrun4 from myEclipse
    2) do not have to manually define individual jar files for the jrun4 class path?

    I appreaciate your help.

    Changqing Zhou
    United Healthcare

    Starting Macromedia JRun 4.0 (Build 106363), laww server
    08/06 10:57:09 info JRun Naming Service listening on *:2909
    08/06 10:57:10 info No JDBC data sources have been configured for this server (see jrun-resources.xml)
    08/06 10:57:10 info JRun Web Server listening on *:8101
    08/06 10:57:10 warning Deployer Service failed to deploy file:/C:/sandbox/laww_EAP_CERT_REL/webtier/CVS/
    * Unrecognized deployment: file:/C:/sandbox/laww_EAP_CERT_REL/webtier/CVS/
    08/06 10:57:10 info Deploying web application “Live and Work Well” from: file:/C:/sandbox/laww_EAP_CERT_REL/webtier/docs/
    08/06 10:57:10 user JSPServlet: init
    08/06 10:57:10 user spring: init
    – Initializing servlet ‘spring’
    – JDK 1.4+ collections available
    – FrameworkServlet ‘spring’: initialization started
    08/06 10:57:11 user Loading WebApplicationContext for Spring FrameworkServlet ‘spring’
    – Loading XML bean definitions from ServletContext resource [/WEB-INF/cert-servlet.xml]
    – Bean factory for application context [WebApplicationContext for namespace ‘spring-servlet’]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [certRequestFamilyController,familyListManager,certSummaryController,certSummaryManager,certRequestSubmitController,submitRequestManager,certInquiryCompleteController,acroFillController,acroFormBean,appointmentPrepareController,certConfirmationPrintController,messageSource,secureTicketInterceptor,unSecureTicketInterceptor,urlMapping,viewResolver]; root of BeanFactory hierarchy
    – 16 beans defined in application context [WebApplicationContext for namespace ‘spring-servlet’]
    – Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [certRequestFamilyController,familyListManager,certSummaryController,certSummaryManager,certRequestSubmitController,submitRequestManager,certInquiryCompleteController,acroFillController,acroFormBean,appointmentPrepareController,certConfirmationPrintController,messageSource,secureTicketInterceptor,unSecureTicketInterceptor,urlMapping,viewResolver]; root of BeanFactory hierarchy}
    – Context initialization failed
    org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.uhc.ubh.laww.cert.controller.FamilyListController] for bean with name ‘certRequestFamilyController’ defined in ServletContext resource [/WEB-INF/cert-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.uhc.ubh.laww.cert.controller.FamilyListController
    Caused by:
    java.lang.ClassNotFoundException: com.uhc.ubh.laww.cert.controller.FamilyListController
    at jrunx.util.JRunURLClassLoader.findClass(JRunURLClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:78)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:70)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:177)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:317)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1008)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1036)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165)
    at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:689)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:395)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:308)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:252)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:221)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationService.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.java:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    08/06 10:57:11 error Could not pre-load servlet: spring
    [1]java.lang.ClassNotFoundException: com.uhc.ubh.laww.cert.controller.FamilyListController
    at jrunx.util.JRunURLClassLoader.findClass(JRunURLClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:78)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:70)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:177)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:317)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1008)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1036)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165)
    at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:689)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:395)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:308)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:252)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:221)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationService.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.java:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    [0]org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.uhc.ubh.laww.cert.controller.FamilyListController] for bean with name ‘certRequestFamilyController’ defined in ServletContext resource [/WEB-INF/cert-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.uhc.ubh.laww.cert.controller.FamilyListController
    Caused by: java.lang.ClassNotFoundException: com.uhc.ubh.laww.cert.controller.FamilyListController
    at jrunx.util.JRunURLClassLoader.findClass(JRunURLClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:78)
    at jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:70)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:177)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:317)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1008)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isBeanClassMatch(AbstractBeanFactory.java:1036)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165)
    at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:689)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:395)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:328)
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:308)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:252)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:221)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at jrun.servlet.WebApplicationService.loadServlet(WebApplicationService.java:1200)
    at jrun.servlet.WebApplicationService.preloadServlets(WebApplicationService.java:791)
    at jrun.servlet.WebApplicationService.postStart(WebApplicationService.java:293)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:711)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:242)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:430)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:891)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    08/06 10:57:11 info Deploying enterprise application “JRun 4.0 Internal J2EE Components” from: file:/C:/JRun4/lib/jrun-comp.ear
    08/06 10:57:11 info Deploying EJB “JRunSQLInvoker” from: file:/C:/JRun4/lib/jrun-comp.ear
    08/06 10:57:11 info Deploying enterprise application “Flash Remoting EAR” from: file:/C:/JRun4/lib/flashgateway.ear
    08/06 10:57:12 info Deploying web application “Flash Remoting” from: file:/C:/JRun4/lib/flashgateway.ear
    08/06 10:57:12 user JSPServlet: init
    08/06 10:57:12 user FlashGatewayServlet: init
    Server laww ready (startup time: 5 seconds)

    #273579 Reply

    Riyad Kalla
    Member

    Changqing Zhou,
    Let me clarify a few things that may make this easier to trouble shoot.

    In most cases, your build classpath cannot be used as your runtime classpath. For example, you will have the J2EE libraries in your build path, so you can compile servlets, EJBs, JSPs and so on. However, when you run your app server, you don’t want to include the libraries from your build path because the application server already provides those libraries to you in it’s own /lib directory.

    So the problem is that when you run a project, you need to include some libraries (Spring, Hibernate, etc.) but exclude the ones that the app server already provides. This is why when you deploy your project, MyEclipse will package up all the required libraries for you in your project, and send them out to the app server for your web app. That way when you run your app server, it loads everything under /lib for the server, then loads all the *additional* libs under your project’s WEB-INF/lib directory and then your project runs fine.

    So to answer your question #2 above, you need to deploy your project to JRun, and you should be fine.

    #273593 Reply

    Riyad,

    I agree with your view in principle, although I miss the feature from Tomcat plugin that allows you to add/remove jars from your project classpath for the app server class path. The add/remove function is to dela wit the ejb, servlet jars like you mentioned.

    It is good to confirm this from you – I know I am not missing something obvious. I will go with the deploy or ant copy options for the jars.

    Thanks for your response. It is very helpful.

    Changqing

    United Healthcare

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Configure jrun4 in myEclipse 5.5.1 GA

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