Two EJB's, separate JARS?

Hi,
I have a MDB, consuming messages from a Q, a Java Bean and a Stateless Session Bean.
The MDB has a message sent to it, consumes the message, calls the Bean and the bean then passes the Remote interface of the EJB back to the MDB.
I have packaged and deployed this like so:
first jar: MDB and Java Bean;
second jar: Session EJB.
I call the session ejb from the Bean like so:
Context ctx = getInitialContext();
Object objRef = ctx.lookup("java:comp/env/IntellectSessionRemote");I get this error, caught from the NamingException thrown in the above code:
Javax.Naming.NameNotFound Exception: Unable to resolve comp/env/IntellectSessionRemote/ Resolved: comp/env Unresolved: IntellectSessionRemote ; remaining name ' ' in ejb
Any ideas/help??/
I am deploying on Weblogic 6.1, in development mode.
Cheers
T

Hi again,
I am confused still about a couple of things:
1) Should I be deploying the EJB's in seperate JAR's?
2) It is my Bean class, not MDB, that is doing the
Object objRef = ctx.lookup("java:comp/env/ejb/IntellectSessionRemote");lookup, therefore why do i put the reference to the jndi name of the Session EJB in the deplotment descriptor of the MDB?
I tried putting the ejb-ref tag in the ejb-jar.xml file and now get the following error when the server starts:
In ejb-jar.xml the EJB 'consumer' contains an invalid eb-link in ejb-ref 'ejb/IntellectSession'. No ejb with ejb-name 'IntellectSession' could be found.Any ideas on this one????
Cheers
T

Similar Messages

  • Local references and EJBs in separate jars

    Hi
    I have trouble in getting local references when the EJBs are built in separate jar files. I am using the <ejb-link> in the <local-ejb-ref>. But I could not get reference to the EJB's local reference.
    Please let me know if there is any documentation that tells about getting local references and having the EJBs in separate jar files.
    Thanks

    Greetings,
    Hi
    I have trouble in getting local references when the
    EJBs are built in separate jar files. I am using theThere are a number of reasons why this may be happening and without more specific information it is difficult to say which you are encountering... In any case, the fact that your beans are in separate jars is not, by itself, the issue. It is worth noting, however, that Local references may only be used when both components (referencer and referencee) are co-located within the same VM instance and perhaps this little fact may shed some light on your problem??
    <ejb-link> in the <local-ejb-ref>. But I could not get<ejb-link> should point to the actual JNDI binding name, sans root nomenclature (java:comp/env/), but with full sub-context (ejb/myapp/.../MyLocalBean), of the referenced bean.
    reference to the EJB's local reference.Perhaps it goes without saying (but just to be sure :)... of course, your referenced bean must actually have Local interfaces associated with it.
    Please let me know if there is any documentation
    that tells about getting local references and having
    the EJBs in separate jar files.Both the J2EE tutorial and the EJB 2.0 spec. have the relevant information. :) However, I've already listed the requirements above: supplied local interfaces, co-located components, and correct link reference.
    I hope this helps.
    ThanksRegards,
    Tony "Vee Schade" Cook

  • Problem deploying related EJBs in separate JARs

    I have 2 entity EJBs, User and Address, in separate JAR files. The User bean
    has business methods to get and set its related address as follows:
    void setAddressPK(AddressPK newAddress) throws java.rmi.RemoteException;
    AddressPK getAddressPK() java.rmi.RemoteException;
    When I try and load User.jar in the EJB Deployment tool it complains that it
    can't find the AddressPK class. However, I can get round this by explicitly
    adding Address.jar to the classpath.
    When I actually deploy and use the User bean I do NOT need Address.jar on
    the classpath, although I do get warnings during deployment.
    So my question is how do I package and deploy related EJBs. I don't want to
    have to have all my EJBs in the same JAR, nor do I want to have the same
    classes in more than one JAR. Is what I'm doing correct - am I supposed to
    have Address.jar on the classpath? And what about an utility classes that
    are shared between EJBs - where do I put those?
    Thanks in advance,
    Steve.

    I resolved the problem be making sure that my deployment
    jars don't appear in my servlet classpath....
    Jason
    Jeff Wang <[email protected]> wrote in message news:[email protected]...
    In general, if two beans are related (i.e. you can not compile one
    without the other being on the classpath) and they are both deployed
    they should be in the same jar file. If you do not deploy one of them,
    then the undeployed bean can be in the weblogic.class.path with no
    problem.
    I suspect that you are getting a ClassCastException because you have the
    deployment jars in your weblogic.class.path (or java classpath.) Remove
    them, and see if the error is resolved.
    Jeff Wang
    WLCS 2.0 Software Engineer
    Jason Rosenberg wrote:
    Does the same apply for beans of different types? In other words, do
    I need to have an entity bean and a session bean which wraps the entity
    bean in the same jar file?
    I am having a problem accessing a session bean from a JSP servlet. I get
    the dreaded ClassCastException. I don't get this problem, however, if
    I access the session bean directly from a stand-alone java client. It's
    only when I access the session bean via JSP....
    Any ideas?
    Jason
    Jeff Wang <[email protected]> wrote in message news:[email protected]...
    What you should have in the .jar files are:
    the home (say it is called <bean>home.class)
    the remote (say it is called <bean>.class)
    the impl (say it is called <bean>impl.class)
    These are the only ones that should be in the .jar file. (not even the
    PK should be there, for an entity bean.) All the support classes should
    be in weblogic.class.path If you have cross jar dependencies,
    unfortunately, you will have to specify the jar in the
    weblogic.class.path... However, this is not a good idea, as you will
    have 2 class files in memory. At the very least, you will not be able
    to do hot deploy. Depending on your code, you'll have a "class cast
    exception <bean> can not be casted to an object of <bean>" (Something
    like that, I don't have the exact error in front of me.) In your
    example it is probably better to put User and Address in the same jar.
    Jeff Wang
    WLCS 2.0 Software Engineer
    Steve Ward wrote:
    I have 2 entity EJBs, User and Address, in separate JAR files. The User bean
    has business methods to get and set its related address as follows:
    void setAddressPK(AddressPK newAddress) throws java.rmi.RemoteException;
    AddressPK getAddressPK() java.rmi.RemoteException;
    When I try and load User.jar in the EJB Deployment tool it complains that it
    can't find the AddressPK class. However, I can get round this by explicitly
    adding Address.jar to the classpath.
    When I actually deploy and use the User bean I do NOT need Address.jar on
    the classpath, although I do get warnings during deployment.
    So my question is how do I package and deploy related EJBs. I don't want to
    have to have all my EJBs in the same JAR, nor do I want to have the same
    classes in more than one JAR. Is what I'm doing correct - am I supposed to
    have Address.jar on the classpath? And what about an utility classes that
    are shared between EJBs - where do I put those?
    Thanks in advance,
    Steve.

  • Servlet accessing an ejb in separate jar

    Don't know if this is possible??
    I have deployed interest.jar ejb...client is working..
    I'm trying to access ejb/interest through the interestservlet.war.
    The problem I'm having is setting up the web.xml & jboss-web.xml
    to reference the deployeed interest ejb on the jboss server. The
    servlet works fine if it's in the same interest.ear package.
    The reason for this is to deployee ejb.jar once and change the servlet look for each different install.

    actually, it's pretty easy. It took me a while because I couldn't find documentation on web.xml configuration. Everything is moving along fine.

  • How to deploy 2 EJB's in separate jars

    Hi,
    I have successfully deployed 2 session ejb's in the same jar file, i.e. with one ejb-jar.xml and one weblog-ejb-jar.xml. And get get the ejb's to communicate with each other.
    Now I want to be able to compile and deploy the 2 ejb's in separate jar files as part of an ear file.
    My method so far is this:
    I have split the ejb-jar.xml file into two, for each ejb, and also the weblogic-ejb-jar.xml file into two for each ejb.
    I then compiled the ejb source files and packaged each ejb up with its respective deployment descriptors into two separate .jar files.
    I then want to run weblogics ejbc on each .jar file in turn so that the resultant .jar files (with newly created stubs/skels) can be packaged into an .ear to be easily deployed into weblogic.
    I try and run the ejbc command on the first of the .jar files and i get the error:
    ERROR: Error from ejbc:
    In ejb-jar.xml, the EJB 'SessClient' contains an invalid ejb-link in ejb
    -ref 'ejb/SessLogHome'. No EJB with ejb-name 'IntellectStateless.jar#SessLog' co
    uld be found.
    ERROR: ejbc found errors
    My ejb-jar.xml file for this ejb is:
    <ejb-jar>
      <enterprise-beans>
        <session>
          <ejb-name>SessClient</ejb-name>
          <home>intellectsession.sessiontwo.SessClientEntHome</home>
          <remote>intellectsession.sessiontwo.SessClientEnt</remote>
          <ejb-class>intellectsession.sessiontwo.SessClientEntBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
          <ejb-ref>
            <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <home>intellectsession.stateless.SessLogHome</home>
            <remote>intellectsession.stateless.SessLog</remote>
            <ejb-link>IntellectStateless.jar#SessLog</ejb-link>
          </ejb-ref>
        </session>
      </enterprise-beans>
      <assembly-descriptor>
        <container-transaction>
          <method>
         <ejb-name>SessClient</ejb-name>
         <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>and both of my .jar files are in the same directory when I run the ejbc command.
    I'm sure this can be done but I just think i'm not doing it in the right order maybe??
    Anyway pointers will be gr8ly appreciated.
    Cheers
    T

    Okay here is the solution to how to achieve the problem I encountered above:
    I am compiling my ejb.jar files using the weblogic.ejbc compiler, obviously I am deploying on weblogic here.
    This section:
    <ejb-ref>
      <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
    <home>intellectsession.stateless.SessLogHome</home>
      <remote>intellectsession.stateless.SessLog</remote>
      <ejb-link>IntellectStateless.jar#SessLog</ejb-link>
    </ejb-ref>must have JUST the <ejb-link/> tag removed from the ejb-jar.xml file. And then the weblogic-ejb-jar.xml file MUST look like this:
    <weblogic-ejb-jar>
        <weblogic-enterprise-bean>
            <ejb-name>SessClient</ejb-name>
            <reference-descriptor>
              <ejb-reference-description>
                <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
                <jndi-name>SessLog</jndi-name>
              </ejb-reference-description>
            </reference-descriptor>
            <jndi-name>SessClient</jndi-name>
        </weblogic-enterprise-bean>
    </weblogic-ejb-jar>Note the <refererence-descriptor> tag as the important part.
    After these changes, the 2 ejb.jar files can be compiled using the weblogic.ejbc tool, thus supplying the stubs/skels, and then the resultant two ejb.jar files can be added to the EAR file and deployed to weblogic.
    Result: 2 ejb's in separate jars, in one EAR file, talking to each other.
    T

  • Share persistence.xml file between two EJB modules in EAR

    Hello, everybody!
    First of all, I would like to say that I already posted this question in another forum:
    [http://community.jboss.org/thread/154128?tstart=0]
    But as I haven't got any answer from there and this issue is very crucial to me I'm posting it here too in the hope that I get an answer. So, here it goes:
    I have two EJB modules in an EAR module. I would like to know how to share a single persistence.xml file with these two EJB modules. If I replicate the persistence.xml file in the two EJB modules, the EAR project deploys ok, but of course that's not what we want. If I remove the persistence.xml file from any of the EJB projects, the EAR doesn't deploy properly. I'm stuck with this. I've already tried many kind of configurations but none worked. I really would like to have some help with this issue to proceed working. This is my EAR structure:
    solicitacoes-ejb.jar       (EJB session beans)
    solicitacoes-dao.jar       (EJB interfaces)
    solicitacoes-dao-jpa.jar   (EJB session beans)
    solicitacoes-ejbClient.jar (entities and EJB interfaces)
    solicitacoes-web.war
    META-INF/This is my application.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <application
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
    version="5">
        <display-name>solicitacoes-ear</display-name>
        <module>
            <ejb>solicitacoes-ejb.jar</ejb>
        </module>
        <module>
            <ejb>solicitacoes-dao-jpa.jar</ejb>
        </module>
        <module>
            <web>
                <web-uri>solicitacoes-web.war</web-uri>
                <context-root>solicitacoes</context-root>
            </web>
        </module>
    </application>If I remove the persistence.xml file from one of the EJB modules, let's say solicitacoes-dao-jpa.jar, I get this error when deploying the EAR file:
    ... 39 more
    Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@28359170{vfs:///C:/jboss-6.0.0.20100429-M3/server/default/deploy/solicitacoes-ear.ear/solicitacoes-dao-jpa.jar/}
    at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107) [:1.0.2-alpha-1]
    at org.jboss.ejb3.Ejb3Deployment.resolvePersistenceUnitSupplier(Ejb3Deployment.java:778) [:1.3.1]
    at org.jboss.ejb3.EJBContainer.resolvePersistenceUnitSupplier(EJBContainer.java:1517) [:1.3.1]
    at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:130) [:1.3.1]
    ... 43 moreI need help with this issue. As you could see, the EJB container doesn't like to see an EJB module without a persistence.xml file. This is clearly a dumb decision though. I agree with it if there was only one EJB module in an EAR. But the container should have been smart enough to require only one persistence.xml file in an EAR module with more than one EJB module, and share that persistece context with the whole EAR.
    Acting the way it is acting now, the container forces us to duplicate the persistece.xml file and kill our application modularity. This is clearly wrong. I've already tried to put the entity classes and persistence.xml file in the lib directory of the EAR, but it didn't work either. The container needs to have the persistence.xml file in both EJB modules.
    I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision. Please if some of you know how to solve this, took a little time to tell me how. I would be very grateful.
    Thank you in advance.
    Marcos

    Dear Mr. gimbal2,
    In another occasion I would not reply to such a 'helpful' answer like the one you gave me (yes, it is undoubtedly an answer because that's how you classified it in the beginning of your reply), but as today I have plenty of time here in my job, for this week we're not working full time as usual, I decided to reply to it.
    You have to completely overhaul your attitude.I really didn't know I was taking so personal on this issue to have to 'completely overhaul my attitude'. Thank you for pointing that out.
    In stead of calling the technology dumb, admit to yourself that perhaps you don't understand it properly and that your ideas of what is correct design perhaps is a little lacking. I didn't call the technology dumb because I stated very clearly that I don't know for sure if it is working this way. I said in the last paragraph:
    +"I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision."+
    So, I let implicit the fact that the technology or the implementation of the technology is dumb only if it doesn't allow this possibility. Regarding the fact that your said that I should
    admit to myself that perhaps I don't understand it properly, where did I stated in my question that I understand it completely? It's clear in the last paragraph that I don't. If I'm asking that's because I have doubts. Maybe my ideas of what is correct is wrong, and that's why I'm here in this forum. But everyone with a good sense knows that what I propose in this discussion is by no means a wrong design decision. Where is it a sin to have more than one EJB module in a EAR and a persisntece.xml file shared for the whole EAR? Does everyone that has more than one EJB module in an EAR module need to connect to more than one database? Is it wrong to want to have your DAO implementation in a separate EJB module in order to make deployment easy and also changes, if you later want to replace that implementation with another one without affecting
    the other modules? I don't think that a design decision that seeks this is lacking. I don't think that Java EE today is a dumb technoloby, but everyone knows that before it gets to the present level, it was a technology known to have made big dumb decisions that the community latter corrected, with ideas like O/R mapping (Hibernate), dependency injection (Spring), Struts and lots of other examples that we all know. No one can deny this and lots of wrong things will continue to be fixed in later releases.
    Maybe when you rise yourself back to that level, you open yourself up again to thinking in correct solutions in stead of trying to hammer through your own poorly chosen one.To be sincere, I see you took very personal about this issue. You really shows to be someone that has no respect to other people and you judge them too. I must say that I got surprised by the way you answered my post. I didn't expect to get such sarcastic answer to what I asked. I personally don't act this way. If I can't help a person, I also don't try to ridicularize him.
    Marcos

  • Weblogic 12c JSF2 and EJB3.1 using CDI injection , in separate jar files

    I am trying to inject a stateless EJB and  managed Bean of JSF2 into a CDI managed controller.
    That means using @inject replace @EJB of EJB and @Named of CDI replace @ManageBean in JSF2 ,  EJB3.1 and JSF2 in separate jar files.
    At result,My  test  gets the following Exception in  weblogic 12c。
    If EJB in separate files and Managed Bean of JSF in WEB-INF/classes not separte file, then no problem.
    weblogic.management.DeploymentException:
         at weblogic.application.internal.BaseDeployment.throwAppException(BaseDeployment.java:123)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:239)
         at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:48)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:96)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:229)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ISaleInfoService] with qualifiers [@Default] at injection point [[field] @Inject private com.hylandtec.hystone.showcase.web.SaleInfoBean.saleInfoService]
         at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:258)
         at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:105)
         at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:125)
         at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:324)
         at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:309)
         at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:361)
         at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:105)
         at com.oracle.injection.integration.CDIAppDeploymentExtension.prepare(CDIAppDeploymentExtension.java:60)
         at weblogic.application.internal.flow.AppDeploymentExtensionFlow.prepare(AppDeploymentExtensionFlow.java:23)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
         at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:48)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:96)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:229)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Edited by: user8823518 on 2012-3-12 上午12:49

    This is a Weblogic 12.1.1 bug (a patch is available), explained here:
    http://docs.oracle.com/cd/E24329_01/doc.1211/e26593/issues.htm#BCFGBBBE
    extract:
    If a WAR file has two embedded bean deployment archive JARs (that is, JARs that contain META-INF/beans.xml), an UnsatisfiedDependencyException occurs if a class in one JAR contains an @Inject that is of a type that is defined in the other JAR.
    Workaround
    +Download and install patch 13563205. Enter this value in the Patch Number Search field on the Patches & Updates tab of My Oracle Support.+

  • NoClassDefFoundError extending class in separate JAR

    I have a class Foo which gets called from my servlet (extends HttpServlet) class. Both Foo and the servlet class are located in WEB-INF/classes and are deployed as part of the war file. Class Foo extends class Bar, which is a different .jar file located in the /WEB-INF/lib directory of the webapp. When I attempt to create an instance of Foo, I get the following exception:
    java.lang.NoClassDefFoundError: /general/client/common/beans/Bar
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1267)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at server.DBServlet.createFoo(DBServlet.java:236)
         at server.DBServlet.processInput(DBServlet.java:333)
         at server.DBServlet.doGet(DBServlet.java:154)
         at server.DBServlet.doPost(DBServlet.java:205)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    I'm running this on Windows, and found if I added the classpath the the jar file where the Bar class is located, that it worked fine. But my expectation is that the jar file should have been found because it is in the /WEB-INF/lib dir. There is a line the Tomcat docs that says:
    "Last, any JAR containing servlet API classes will be ignored by the classloader. All other class loaders in Tomcat 5 follow the usual delegation pattern."
    So maybe I need to do something special to load the Bar class, or there's something strange about the way the classes and jars are being loaded that I don't fully understand. I was able to instantiate the Bar class directly from w/in my servlet class, I just can't create an instance of the Foo class that is in /WEB-INF/classes along with the servlet class. So I'm not convinced that the Bar class or associated jar file isn't being loaded.
    I don't want to have to set the classpath explicitly, so I'm looking for advice on why I'm getting this exception and how best to dynamically load the classes I need.
    Thanks.
    ab.

    Thanks for hanging in there so far. Here's the specifics if you want to try to re-create this.
    I have a webapp, which contains the class DBServlet:
    package com.hm.dhca.server;
    public class DBServlet extends HttpServlet
    // Stuff
         public void processInput()
              Foo foo = new Foo();
    The webapp also contains the class Foo:
    package com.hm.dhca.common;
    import com.general.client.common.beans.Bar;
    public class Foo extends Bar
         public Foo()
              super();
              System.out.println("Foo");
    Both of the classes are located in webapps\DHCA\WEB-INF\classes...
    The Bar class is in a separate jar called HMJCommon.jar in the webapps\DHCA\WEB-INF\lib dir.
    Class Bar looks like this:
    package com.general.client.common.beans;
    public class Bar
         public Bar()
              System.out.println("Bar");
    DBServlet creates an instance of Foo as:      
    Foo foo = new Foo();
    Which throws the Exception:
    java.lang.NoClassDefFoundError: com/general/client/common/beans/Bar
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1267)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at com.hm.dhca.server.DBServlet.processInput(DBServlet.java:236)
         at com.hm.dhca.server.DBServlet.doGet(DBServlet.java:154)
         at com.hm.dhca.server.DBServlet.doPost(DBServlet.java:205)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Clues:
    1. All three classes exist in the locations specified above - I have checked this manually.
    2. Within DBServlet, I can create an instance of Bar. But I cannot create an instance of Foo without the exception.
    3. If I move the Foo class from package com.hm.dhca.common to package com.hm.dhca.server (same package as DBSerlvet), everything works fine.
    4. If I modify Tomcat's classpath to include the HMJCommon.jar, it works fine (as previously discussed).
    Theory:
    I have a vague theory that what is happening is that two different webappclassloaders are loading the Foo and Bar classes, for whatever reason. As a result, they can't see each other, because neither is up the hierarchy tree from the other.
    This does not explain how I can instantiate Bar from DBServlet, but not Foo.
    Hope this helps. I think I've corrected previous mistake w/ removing too much from package naming. I'm resorting to the workaround in clue #3 for the moment. But it's not the correct solution, and it's showing that I don't really understand what's going on here.

  • Ejbs in multiple jar files

    Question:
    Can ejb in one jar file can call another ejb (available in another jar file)? Second ejb is using local interfaces.
    Regards,
    Viral

    Yes, if both ejb-jars are packaged within the same .ear file. A web component can also access the local interface of an ejb if the two modules are packaged within the same .ear file.
    --ken
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • I have two libraries on separate computers. If i turned itunes match on in both computers would the two libraries merge? So if my iphone normally syncs with my laptop would i still only get the iphones library or would i get both as one?

    I have two libraries on separate computers. If i turned itunes match on in both computers would the two libraries merge? So if my iphone normally syncs with my laptop would i still only get the iphones library or would i get both as one?

    Yes, the two libraries should merge. However, you need to turn on match on one computer and let it finish before adding the second library.
    Once you turn march on n your phone then you don't sync it with iTunes, but the merged library will show up on the phone. If you don't turn on match on your phone and continue to sync then all of the music from both libraries should be available to sync to it.
    The only bit I can't confirm is what happens if you try to sync music to the phone which isnt actually downloaded into iTunes. Im not in a position to test that, but maybe someone else can help.

  • Not able to update single file in a non ejb Module related jar

    Hey all,
    I have depoyed my j2ee application <b>.ear</b> on NW webAS .
           This application apart from having all the ejb Modules related jar, <b>also has a jar which has all my properties files</b> being accessed by my application.
    Very often is it required by me to update these files and restart the application. However i couldnot find a way to update these single files.
    When i select by deployed application.ear and click <b>Single File Update</b> feature provided by SAP in visual Admin, it shown only ejb modulerelated jar. It dosent show my jar containing properties file.
    I have to redeploy my application again everytime i change a small properties file.
    Please let me if there is a way to update these sngle files

    Hi,
    >
    Vikram D Salvi wrote:
    > MOVE-CORRESPONDING ZSTRUC_CM TO I_TAB.                                                                            not working
    >
    > UPDATE ZTEST_CM FROM ZSTRUC_CM.                                                                                not working
    Instead of the move statement you need to use the append work area to internal table statement. you need to have the same structure for the work area and the internal tbale.
    Then use the modify data base table from internal table statement.
    Regards
    Ansari

  • Loading separate JAR files.

    Hello.
    I have an application that loads functionality from separate jar files so that the application has a "hot deploy" feature. This means that the application reloads a certain functionallity if a new jar is deployed to that folder. This also means that the jars containing this functionality must be in a separate forlder than the jars for the application framework, or the system would try to load this as a functionallity as well.
    In my JNLP file, I load the whole application framework at startup, but none of the functionality jars as these are loaded after the application has logged the user in and so on. I use URLClassLoader to load the funtionality classes but in these classes, I import from the allready loaded framework, and the functionalities I try to load throw an excaption that they do not find the classes in the framework.
    Any ideas as to how the externally loaded jars can find classes loaded into the framework? This works perfectly well when I don't use web start, so there must be some class loading issues I am not aware of.
    Thank you.
    -r

    OK, I am making some progress, but now I have a different problem: Some of the framework for loading was written by someone else and I would really like access to the debug information it prints without having to rewrite a lot to print it all to files. Is there any way to get access to everything that is being printed on System.out from web start. Been looking around but I can't find anything on the subject.

  • Deploying third party EJB 3.0 jar in web application

    I have a web application which calls services provided by EJB 3.0 beans packaged in third party jar. How do a configure the web application project to deploy the beans to the embedded OC4J container when I run the application? The jar file is reference by the project, and I have a META-INF/application.xml referencing those jar files as EJB modules. I've set the EJB Version property to 3.0, but the Annotated EJB 3.0 Bean Classes list remains empty, presumably because I have no beans defined in the sources of the application. When running the project, the oc4j container warns that the EJB module contains no beans. I'd like to deploy the beans in the jar file, but can't figure out how.
    Thanks,
    Steve
    JDeveloper 10.1.3.4
    Windows Vista
    Edited by: user10375549 on Oct 29, 2009 6:38 AM - Fixed typo.

    I don't think this technique will work. I added a META-INF/ejb-jar.xml file to the application, and added a <session> section for one of the EJB 3.0 beans from my third party jar. I specified values for <ejb-name>, <ejb-class>, and <session-type> hoping the rest of the configuration would be determined from the annotations in the class. When the server starts, this warning message is displayed:
    Oct 30, 2009 12:06:41 PM com.evermind.server.ejb.logging.EJBDeploymentMessages warningSessionBizInterfaceNotDefined
    WARNING: \[current-workspace-app: ... \] - The session bean does not has at least one business interface defined for client access. The bean is not accessiable and usable at runtime.
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 11042 ms.
    \[sic\]
    EJB 3.0 beans are not required to define business interfaces, as they are supposed to be generated by the container.
    Good idea, but still cannot deploy beans from the third party EJB 3.0 jar referenced by my project to the embedded OC4J container. Still investigating.
    Thanks,
    Steve
    By the way, I have been able to use your technique to deploy EJB 2.1 beans from third party jars in other projects, just not EJB 3.0 beans that do not provide ejb-jar.xml deployment descriptors, nor business interfaces.
    Edited by: user10375549 on Oct 30, 2009 9:51 AM - Added relevant comment regarding technique described for solving problem. It works for EJB 2.1 beans but not EJB 3.0 beans.

  • How to Deploy the third party EJB 3.0 jar in web application

    I have a web application which calls services provided by EJB 3.0 beans packaged in third party jar. How do a configure the ViewController project to deploy the beans to the weblogic server when I run the application rather than deploy the EJB ear as a stand application to the server?
    The jar file has already referenced by the project. In the "EJB Module" of project properties I've set the EJB Version property to 3.0, but the Annotated EJB 3.0 Bean Classes list remains empty, presumably because I have no beans defined in the sources of the application. When running the project the EJB jar did not deploy automatically. Is there something wrong? How can I achive this goal?
    Best Wishes~
    ELeven.Xu
    IDE: JDeveloper 11g (11.1.1.2.0)
    OS: Linux

    I don't think this technique will work. I added a META-INF/ejb-jar.xml file to the application, and added a <session> section for one of the EJB 3.0 beans from my third party jar. I specified values for <ejb-name>, <ejb-class>, and <session-type> hoping the rest of the configuration would be determined from the annotations in the class. When the server starts, this warning message is displayed:
    Oct 30, 2009 12:06:41 PM com.evermind.server.ejb.logging.EJBDeploymentMessages warningSessionBizInterfaceNotDefined
    WARNING: \[current-workspace-app: ... \] - The session bean does not has at least one business interface defined for client access. The bean is not accessiable and usable at runtime.
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 11042 ms.
    \[sic\]
    EJB 3.0 beans are not required to define business interfaces, as they are supposed to be generated by the container.
    Good idea, but still cannot deploy beans from the third party EJB 3.0 jar referenced by my project to the embedded OC4J container. Still investigating.
    Thanks,
    Steve
    By the way, I have been able to use your technique to deploy EJB 2.1 beans from third party jars in other projects, just not EJB 3.0 beans that do not provide ejb-jar.xml deployment descriptors, nor business interfaces.
    Edited by: user10375549 on Oct 30, 2009 9:51 AM - Added relevant comment regarding technique described for solving problem. It works for EJB 2.1 beans but not EJB 3.0 beans.

  • Packages in separate Jars causes classpath error

    For the purposes of easy-updating and allowing developers to work on one part of a system without interfering with others, I have created separate Jar files for the main packages in my application. So;
    com.me.pack1 is in Pack1.jar
    com.me.pack2 is in Pack2.jar
    An ant build takes care of building and packaging these up. The Jar files have the correct directory structure i.e.;
    jar $ $JAVA_HOME/bin/jar tf /users/jmcparla/jar/Pack1.jar
    META-INF/
    META-INF/MANIFEST.MF
    com/
    com/me/
    com/me/pack1/
    com/me/pack1/MainClass.class
    jar $ $JAVA_HOME/bin/jar tf /users/jmcparla/jar/Pack2.jar
    META-INF/
    META-INF/MANIFEST.MF
    com/
    com/me/
    com/me/pack2/
    com/me/pack2/OtherClass.classHowever when I run it;
    jar $ $JAVA_HOME/bin/java -cp /users/jmcparla/jar/Pack2.jar -jar /users/jmcparla/jar/Pack1.jar
    Entered main
    Created MainClass instance
    Exception in thread "main" java.lang.NoClassDefFoundError: com/me/pack2/OtherClass
            at com.me.pack1.MainClass.main(MainClass.java:13)The classes are;
    MainClass.java
    package com.me.pack1;
    import com.me.pack2.OtherClass;
    public class MainClass
        public static void main(String[] args)
            System.out.println("Entered main");
            new MainClass();
            System.out.println("Created MainClass instance");
            new OtherClass();
            System.out.println("Created OtherClass instance");
    }OtherClass.java
    package com.me.pack2;
    public class OtherClass
    }and the build file is;
    build.xml
    <project name="JarProblem" default="buildJars" basedir=".">
      <property name="classdir" value="classes"/>
      <target name="compile" depends="clean" description="compile the code">
          <mkdir dir="${classdir}"/>
          <javac debug="on" debuglevel="vars,lines,source" srcdir="."
                 destdir="${classdir}" encoding="ISO-8859-1">
          </javac>
      </target>
      <target name="buildJars" depends="compile" description="build the jar files">
        <antcall target="buildPack2"/>
        <antcall target="buildPack1"/>
      </target>
      <target name="buildPack2" description="build the Pack2 jar">
        <tstamp>
          <format property="time" pattern="hh:mm aa dd/MM/yyyy"/>
        </tstamp>
        <jar destfile="Pack2.jar" update="false">
          <fileset dir="${classdir}">
            <!-- Only include the package we're building -->
            <include name="com/me/pack2/*"/>
          </fileset>
          <manifest>
            <attribute name="Built" value="${time}"/>
          </manifest>
        </jar>
      </target>
       <target name="buildPack1" description="build the Pack1 jar">
        <tstamp>
          <format property="time" pattern="hh:mm aa dd/MM/yyyy"/>
        </tstamp>
        <jar destfile="Pack1.jar" update="false">
          <fileset dir="${classdir}">
            <!-- Only include the package we're building -->
            <include name="com/me/pack1/*"/>
          </fileset>
          <manifest>
            <attribute name="Main-Class" value="com.me.pack1.MainClass"/>
            <attribute name="Built" value="${time}"/>
          </manifest>
        </jar>
      </target>
      <target name="clean" description="clean up the compiled source files">
        <delete verbose="false" failonerror="false">
          <fileset dir="${classdir}"/>
        </delete>
      </target>
    </project>The build completes with no problems. So why can't the java command see OtherClass?

    johnmcparlald wrote:
    However when I run it;
    jar $ $JAVA_HOME/bin/java -cp /users/jmcparla/jar/Pack2.jar -jar /users/jmcparla/jar/Pack1.jar
    Entered main
    Created MainClass instance
    Exception in thread "main" java.lang.NoClassDefFoundError: com/me/pack2/OtherClass
    at com.me.pack1.MainClass.main(MainClass.java:13)
    I can't help you with ant but I can tell you that the command you entered looks wrong. If you use the -jar option with the java command, the only classpath that is used is the one specified by the Class-Path entry in the manifest - other classpaths are ignored.
    So you either need to leave off the -jar, include the Pack1.jar file and specify the main class, or include the Class-Path: Pack2.jar entry in the manifest. (At least, it looks to me like there is no Class-Path in the manifest.)

Maybe you are looking for

  • New Computer- iTunes

    I have a computer (#1) with my wifes itunes account already set up. I want to move my itunes account from another computer (#2) including my playlists, downloaded and purchased music from another computer to her computer. Can you have multiple accoun

  • I cannot view a PDF file with the script in Adobe Garamond Pro on my iPad.  Can anyone help?

    I cannot view a PDF file written using Adobe Garamond Pro font on an iPad.  Can anyone help?

  • Oracle 8i and WindowsXP Pro

    Hello Sir, I am an OTN member. After OTN registration I received an Oracle 8i CD. That CD is for WindowsNT & Windows2000. Now I have WindowsXP Professional on my PC. Oracle 8i is not installed properly on this plateform. Is there any PATCH for Oracle

  • Resource related  billing -reg

    hi My bunsiness process is like 1.Quotation Creation, 2.Sales Order creation with ref to Quotation, 3. Resource related billing( A Debit memo request is creating with ref to Sales Order) 4.Debit Memo creation with ref to debit memeo request. In above

  • How can I print my purchase history?

    How can I print my purchase history?