EJB 3.0 and Spring

Hi I have created a new EJB 3.0 project using NetBeans that I am deploying to Sun Application Server 9.1. I would like to use Spring with this project. I have used Spring in the past with Web Applications and know how to configure Spring to load the ApplicationContext.xml on startup by specifying the ContextLoaderListener in the Web.xml.
Is there a similar way I can configure Spring to load when the Application Server starts and loads the EAR. I don't have a WAR file for this project so can't use the ContextLoaderListener.
Thanks for you help.
Jim

I would like to call your attention to the fact that building a Spring ApplicationContext is not only through the spring configuration file. If you go through the sping documentation, you will find that you can build a context without using the xml file.
For instance, we chose to use spring to do some AOP functionality, in an ejb project (chose in instead of ejb3 introspection) and we don' t have a single spring xml file in out source tree.
Regards,
Michael

Similar Messages

  • JDev 10.1.2 and Spring 1.2.3: Incredibly slow OC4J startup

    I have JDev 10.1.2 which runs many non-Spring apps in the embedded OC4J without incident.
    But after an app that uses Spring Framework 1.2.2 or 1.2.3 is added to a Workspace, attempting to run any application, spring-using or not, in that workspace results in an incredibly long startup time for OC4J, typically 160-220 seconds during which JDeveloper becomes unresponsive and the CPU use rises to 100%.
    After JDeveloper becomes responsive again, here are the displayed contents of the OC4J server window:
    [Starting OC4J using the following ports: HTTP=65001, RMI=65002, JMS=65003.]
    /home/kt/jdevhome/system10.1.2.0.0.1811/oc4j-config>
    /usr/java/j2sdk1.4.2_07/bin/java -server -classpath
    /home/kt/lib/java/jdev1012/j2ee/home/oc4j.jar:/home/kt/lib/java/jdev1012/jdev/lib/jdev-oc4j.jar
    -Xverify:none -Ddisable.checkForUpdate=true -Xrs -Doracle.j2ee.dont.use.memory.archive=true
    -Doracle.j2ee.http.socket.timeout=500 -Doracle.dms.sensors=NONE
    -Doc4j.jms.usePersistenceLockFiles=false com.evermind.server.OC4JServer -config
    /home/kt/jdevhome/system10.1.2.0.0.1811/oc4j-config/server.xml
    [waiting for the server to complete its initialization...]
    05/09/01 12:25:38 Auto-deploying SSAC (New server version detected)...
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 189824 ms.
    Target URL -- http://172.17.50.60:65001/bafg/brs/index.jsp
    05/09/01 12:25:38 Oracle Application Server Containers for J2EE 10g (10.1.2.0.0) initialized
    This problem occurs using JDev 10.1.2 on several workstations. One workstation is FC4, the others are WinXP. We are using j2sdk1.4.2_07 to compile/run on FC4 and the bundled 1.4.2_04 on Windows.
    Once the OC4J is started, JDeveloper and applications appear to work fine with no noticable differences in speed. Also, once deployed to an Oracle App Server 10g (w/OC4J 10.1.2), there is no noticable difference in startup time for applications on that server.
    Again, I would emphasize that the problem affects all applications in the workspace, not just the one that uses Spring. And if I remove the Spring application from the workspace, OC4J starts quickly again for the other applications. Also, running applications in a one workspace is not impacted by a Spring app in a different workspace.
    Any ideas?

    Use Oracle JDeveloper 10.1.3.2 that has both EJB 3.0 and Portlet development support.
    JDev 10.1.2 doesn't support JDK 5.0 out of the box so you'll probably have problems with the annotations of EJB 3.0.

  • Integration of Weblogic Server 10.3 and Spring 2.5

    Hello.
    I read that Weblogic 10.3 supports a Spring extension which allows Web component creation using Spring framework.
    http://e-docs.bea.com/wls/docs103/programming/spring.html#wp1079570
    Has anybody tried this?
    In particuar, documentation says:
    "Enable the Spring extension by setting the <component-factory-class-name> element to org.springframework.jee.interfaces.SpringComponentFactory. This element exists in EJB, Web, and application descriptors."
    Which descriptor for a Web application? web.xml? weblogic.xml? I tried both but I received validation errors.
    Can anyone explain this part a little better?
    Regards
    Davide

    I've been trying to get this to work... No luck as of yet...
    My problem now is that I get this exception when I don't have pitchfork-1.0-m5.jar on the my domains classpath.
    <30.mar.2009 kl 17.37 CEST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
    java.lang.ClassNotFoundException: org.springframework.jee.spi.PitchforkUtilsImpl
    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:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    Truncated. see log file for complete stacktrace
    However if I put it on wls calsspath I get a AbstractMethodError:
    <30.mar.2009 kl 12.59 CEST> <Warning> <EJB> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception was:
    java.lang.AbstractMethodError: org.springframework.jee.intercept.CachingAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(Lorg/springfr
    amework/aop/framework/Advised;Ljava/lang/reflect/Method;Ljava/lang/ClassLjava/util/List;.
    java.lang.AbstractMethodError: org.springframework.jee.intercept.CachingAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(Lorg/springfra
    mework/aop/framework/Advised;Ljava/lang/reflect/Method;Ljava/lang/ClassLjava/util/List;
    I've tried various tips found http://forum.springframework.org/showthread.php?t=38361 and also tried setting the “component-factory-class-name” tag in weblogic-ejb-jar.xml and weblogic-application.xml but still get ClassNotFoundException.
    Gaute

  • Application deployment order with weblogic-ejb-jar.xml and jndi-name

    I have two applicatation working on Weblogic server v. 10.3.6.
    First of them creating one ejb stateless bean and creates JNDI maping for it (in weblogic-ejb-jar.xml file):
    <weblogic-enterprise-bean>
         <ejb-name>ConfigMenegerBean</ejb-name>
         <stateless-session-descriptor>
         <stateless-session-descriptor>
              <business-interface-jndi-name-map>
              <business-remote>package.ConfigurationSessionRemote</business-remote>
              <jndi-name>ConfigMeneger</jndi-name>
              </business-interface-jndi-name-map>
         </stateless-session-descriptor>
         <enable-call-by-reference>true</enable-call-by-reference>
         <jndi-name>ConfigMeneger</jndi-name>
    </weblogic-enterprise-bean>
    Second appication have to refer for this bean by JNDI using spring been lookup :
    <jee:jndi-lookup id="configManager" jndi-name="ConfigMeneger"/>
    I changed deployment order parameter for both apllication(first=100 and second=500) in order to first app start first and share bean by jndi to another application. Unfortuantelly I got an error :
    javax.naming.NameNotFoundException: Unable to resolve 'ConfigMeneger'. Resolved ''; remaining name 'ConfigMeneger'
    How can I configure deployment order that first application make jndi mapping for bean, before the second application will use it ?

    Ok in a way I have solved my problem (even if I am not completely satisfied by the way on how to proceed...). So thanks to message "JBuilder7.0 and Weblogic6.1" on EJB sun forum :
    http://forum.java.sun.com/thread.jsp?thread=285735&forum=13&message=1255488
    I have tried the following actions (mentionned in the other forum messages):
    - To preserve changes to weblogic*.xml, the safest way is to change the ejb-borland.xml.
    (I am not sure that I have applied this advice correctly, because I suppose that syntax is not similar in weblogic file or borland file).
    And you can MANUALLY update the weblogic file in your JAR archive.
    1. Open the EJB JAR file in Winzip and extract the weblogic-ejb-jar.xml file, so that a copy exists in your
    project directory.
    2. Open this file (in Notepad), add the WebLogic specific information, and then save the file.
    3. Now, when you are finished with the build cycle and are ready to deploy, you may open the EJB jar file
    and swap in the weblogic-ejb-jar.xml file."
    Good Luck.

  • Problem with "package-info.java" using EJB 3.0 and OC4J

    Hi all.
    I already posted this question on JDeveloper forum, but didn't get any answer,
    so I'll try posting here.
    Anyway, I'm new both to JDeveloper and J2EE,
    so I'm trying out examples for EJB 3.0, and I got stuck at "Use Security Annotations with EJB 3.0"
    (http://www.oracle.com/technology/tech/java/oc4j/ejb3/howtos-ejb3/howtoejb30security/doc/how-to-ejb30-security-ejb.html).
    Example code is working perfectly, if one builds it using Ant, but I'm importing all examples into JDeveloper (or at least I'm trying to :))
    JDeveloper can't build file "package-info.java" containing following code:
    @javax.annotation.security.SecurityRoles(roleNames={"superuser", "user"})
    package oracle.ejb30;I'm getting following output in "Compiler - Log" window:
    Error(2,1): 'class', 'interface', or 'enum' expected.
    Help much appreciated...
    platform used:
    Windows XP SP2
    JDeveloper Studio (Version 10.1.3, Build 3412)
    JDK 1.5_06
    OC4J 10.1.3 developer preview 4 (standalone version)

    Since you're using EJBs, you can use JTA and can skip the getTransaction() calls. If you want to use getTransaction().begin() and commit(), then make sure that your EntityManager is resource-local. The configuration for this is in persistence.xml. Set a transaction-type of RESOURCE_LOCAL rather than JTA.

  • Ejb 3.0 and JDeveloper

    If I drag and drop tables with One to one mapping in an ejb diagram in JDeveloper (one table have having the foreign key as the primary key). If I create ejb 2.1 beans it makes makes a One To One mapping between the entity beans created and if I drop them as ejb 3.0 it makes a OneToMany mapping. this is what I get for the same tables.
    for ejb 2.1
    <ejb-relation>
    <ejb-relation-name>Envincidents - Incidents</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Envincidents has one Incidents</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Envincidents</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>incidents_incidentsId</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Incidents may have one Envincidents</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Incidents</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>
    for ejb 3.0
    Envincidents
    @Id
    @ManyToOne(targetEntity="mypackage.Incidents")
    @JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
    public Incidents getIncidents() {
    return incidents;
    public void setIncidents(Incidents incidents) {
    this.incidents = incidents;
    Incidents
    @OneToMany(targetEntity="mypackage.Envincidents")
    @JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
    public Collection<Envincidents> getEnvincidentsCollection() {
    return envincidentsCollection;
    public void setEnvincidentsCollection(Collection<Envincidents> envincidentsCollection) {
    this.envincidentsCollection = envincidentsCollection;
    public Envincidents addToEnvincidentsCollection(Envincidents envincidents) {
    getEnvincidentsCollection().add( envincidents );
    envincidents.setIncidents( this );
    return envincidents;
    public Envincidents removeFromEnvincidentsCollection(Envincidents envincidents) {
    getEnvincidentsCollection().remove( envincidents );
    envincidents.setIncidents( null );
    return envincidents;
    this causes the following problem.
    Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
    NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
    ified read-only.
    which I have already reported.
    I know this is a minor inconvenience and I can hand edit the entity beans and make them one to one for ejb 3.0. But would be to good advantage to have a consistent "dropping of tables" for ejb 2.1 and 3.0. So one can have a similar behavior of entity beans created from tables using ejb 2.1 and 3.0.

    I guess this could be desirable if migrating from ejb 2.1 to 3.0 if one has already designed the database.
    Dev

  • Ejb 3.0 and webservices

    Hello everybody?
    Does everybody know if i can create a web service from an ejb 3.0 stateless session inside jdeveloper 10 g 10.1.3 (using a wizard for example)?
    Thank you

    It's almost too easy to need a wizard - try this:
    Trhough your project properties add the JSR-181 Web Service library
    In your session bean type @Web (at the top of the class or above a method) and you'll be prompted to import javax.jws.WebMethod (using Alt-Enter) then you can select the appropriate tag (@WebService for all methods to be published, @WebMethod at the individual method level, etc.)
    Then deploy your EJB as normal and voila! See the deployed EJB and Web Service
    Rgds
    Susan

  • Weblogic 10.3TP, JAX-WS and Spring integration

    Hi all
    We are using JAX-WS and Spring (2.0.6) and our target platform will be Weblogic 10.3. We would like to benefit from Spring injection in our web service classes. However I cannot get it to work. I follow the instructions described here: [url https://jax-ws-commons.dev.java.net/spring]https://jax-ws-commons.dev.java.net/spring and I use version 1.7 of jaxws-spring
    When deploying the sample project I get the following error:
    2007-12-06 09:28:42,238 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
    org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'com.sun.xml.ws.transport.http.servlet.SpringBinding' defined in ServletContext resource [WEB-INF/applicationContext.xml]:
    Cannot create inner bean '(inner bean)' of type [org.jvnet.jax_ws_commons.spring.SpringService] while setting bean property 'service';
    nested exception is org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name '(inner bean)': FactoryBean threw exception on object creation;
    nested exception is java.lang.ClassCastException: org.jvnet.jax_ws_commons.spring.SpringService$ContainerWrapper cannot be cast to weblogic.wsee.jaxws.WLSContainer
    Caused by:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': FactoryBean threw exception on object creation;
    nested exception is java.lang.ClassCastException: org.jvnet.jax_ws_commons.spring.SpringService$ContainerWrapper cannot be cast to weblogic.wsee.jaxws.WLSContainer
    Caused by:
    java.lang.ClassCastException: org.jvnet.jax_ws_commons.spring.SpringService$ContainerWrapper cannot be cast to weblogic.wsee.jaxws.WLSContainer
            at weblogic.wsee.jaxws.framework.policy.WSDLGeneratorExtension.start(WSDLGeneratorExtension.java:113)
            at com.sun.xml.ws.wsdl.writer.WSDLGeneratorExtensionFacade.start(WSDLGeneratorExtensionFacade.java:67)
            at com.sun.xml.ws.wsdl.writer.WSDLGenerator.generateDocument(WSDLGenerator.java:353)
            at com.sun.xml.ws.wsdl.writer.WSDLGenerator.doGeneration(WSDLGenerator.java:276)
            at com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:427)
            at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:196)
            at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
            at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:333)
            at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:45)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:1236)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1207)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219)
    ...It sounds like JAX-WS - Spring integration is not supported in Weblogic 10.3TP.
    Has anyone been able to get the sample project working?
    Does anyone know if the final version of Weblogic 10.3 will have JAX-WS Spring injection support?
    Thanks
    Dries

    anybody can help?
    thanks

  • Need Help in JNDI Datasource using tomcat and spring

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    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 com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    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 com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

  • Ejb-jar.xml and orion-ejb-jar.xml configuration issue

    Chris,
    We have an application that uses the Oracle 10g Application Server and WebSphere MQ v5.3 w/ fixpack 9.
    Our application is a J2EE messaging system which essentially consists of Message Driven Beans, the EJB
    realization of the J2EE Java Message Service (JMS) API. Our application has Message Driven Beans which
    listen to queues and send messages to queues -- a simple messaging system. Currently we can listen to queues, but
    cannot send messages to queues in the Oracle 10g Application Server environment.
    Any J2EE application server has its own implementation of Java Naming Directory Interface (JNDI) API that
    deployed J2EE applications utilize to lookup resources such as Data Sources, JMS Destinations (i.e. MQ Queue),
    JMS QueueConnectionFactories (i.e. MQ QManagers).
    Our application uses the 3rd party JMS Provider, WebSphere MQ.
    MQ ships with a JMSAdmin tool which allows one to create JMS administered objects (i.e. objects a java
    application searches for in some JNDI directory) that reside in some JNDI context. We create a JNDI context for
    MQ resources, queues and QManagers. We configure the MQ provided
    JMSAdmin tool with two property name/value pairs:
    PROVIDER_URL=file:/opt/mqm/JNDI-Directory
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    A resultant .bindings file is created in /opt/mqm/JNDI-Directory which represents our JDNI context
    containing our JMS administered objects. A standalone java application that needs to directly access this
    JNDI context can simply conduct a JNDI lookup on the following context: "java:comp/resource/MQSeries/". An
    example of how a standalone application would lookup a JMS administered object named "qNumber1" would be to
    lookup "java:comp/resource/MQSeries/qNumber1". This lookup would result in the standalone java application
    having a JMS reference to an MQ Queue.
    There is a major difference in how an enterprise EJB application deployed into a J2EE Container (Oracle 10g App Server)
    conducts a JNDI lookup on a 3rd party resource such as MQ as a JMS Provider. A typical EJB application deployed
    into a J2EE container as an .ear (enterprise archive) file has implicit access to the application server's own
    JNDI context. This JNDI context is usually "java:comp/env/". Looking up the Application Server's own Data Source or
    it's own JMS Resources is easy. An application that needs references to these Application Server provided resources
    simply conducts a lookup for "java:comp/env/jms/someQ" or "java:comp/env/jdbc/myDataSource".
    The problem we face is mapping our MQ JNDI context to the Oracle App Server's own JNDI context. We believe this is
    accomplished through mappings defined in both the ejb-jar.xml (EJB Descriptor) and the application server specific
    counterpart, orion-ejb-jar.xml. Note that Oracle 10g Application Server uses the popular orion J2EE container for
    hosting J2EE enterpise applications.
    Our Message Driven Beans (MDBs)currently listen to the Queue at the JNDI location "prodQ". Our problem is that we cannot
    get our MDB to send messages to any queues. Note that the MQ implementation of the queues and Queue Managers work
    flawlessly with standalone java applications. It's safe to say that the MQ objects are working.
    We are looking for a solid example of how the ejb-jar.xml and the orion-ejb-jar.xml map 3rd party JMS provider
    JNDI locations to the App Server's JNDI context.
    Below is how we have attempted to configure our own ejb-jar.xml and orion-ejb-jar.xml:
    ejb-jar.xml begin >>>>>>>>>>>>>>><?xml version = '1.0' encoding = 'UTF-8'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <display-name>Production Message Driven Bean</display-name>
    <enterprise-beans>
    <message-driven>
    <display-name>prodMdb</display-name>
    <ejb-name>prodMdb</ejb-name>
    <ejb-class>message.handler.AIDMSMessageConsumerBean</ejb-class>
    <transaction-type>Bean</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>
         <resource-ref>
    <res-ref-name>prodQCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
         <resource-ref>
    <res-ref-name>prodQ</res-ref-name>
    <res-type>javax.jms.Queue</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
                   <resource-ref>
    <res-ref-name>prodR</res-ref-name>
    <res-type>javax.jms.Queue</res-type>
    <res-auth>Application</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    <<<<<<<< ejb-jar.xml end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    begin orion-ejb-jar.xml >>>>>>>>>>>>>>>>>>>>>>>>>>><orion-ejb-jar>
    <enterprise-beans>
    <message-driven-deployment name="prodMdb" connection-factory-location="java:comp/resource/MQSeries/prodQCF" destination-location="java:comp/resource/MQSeries/prodR">
              <resource-ref-mapping location="prodQ" name="prodQ">     
                   <lookup-context location="java:comp/resource/MQSeries/" >
                        <!-- <context-attribute name="java.naming.factory.initial"
                             value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
                   </lookup-context>
              </resource-ref-mapping>
              <resource-ref-mapping location="prodR" name="prodR">     
                   <lookup-context location="java:comp/resource/MQSeries/" >
                        <!-- <context-attribute name="java.naming.factory.initial"
                             value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
                   </lookup-context>
              </resource-ref-mapping>
         </message-driven-deployment>
    </enterprise-beans>
    </orion-ejb-jar>
    <<<<<<<<< end orion-ejb-jar.xml <<<<<<<<<<<<<<<<<<<<<<<<

    If you look at the contents of a deployment plan (Plan.xml) when you have it generated
    <deployment-plan ...>
      <module-override>
        <module-name>ejb.jar</module-name>
        <module-type>ejb</module-type>
        <module-descriptor external="true">
          <root-element>weblogic-ejb-jar</root-element>
          <uri>META-INF/weblogic-ejb-jar.xml</uri>
        </module-descriptor>
        <module-descriptor external="false">
          <root-element>ejb-jar</root-element>
          <uri>META-INF/ejb-jar.xml</uri>
        </module-descriptor>
        <module-descriptor external="true">
          <root-element>persistence-configuration</root-element>
          <uri>META-INF/persistence-configuration.xml</uri>
        </module-descriptor>
        <module-descriptor external="false">
          <root-element>persistence</root-element>
          <uri>META-INF/persistence.xml</uri>
        </module-descriptor>
      </module-override>
    </deployment-plan>You can see which files can be external and which can be not. The weblogic-ejb-jar.xml can be external
    but in this case you need a deployment plan to point weblogic to the file. The ejb-jar.xml cannot be
    external (see external=false)
    The benefit of storing the weblogic-ejb-jar.xml is that your administrator can fine tune certain
    configurations by using a deployment plan, instead of having to extract the contents from the jar file
    and then repackage it again.
    No need to worry about a clustered environment, you can place the jar and the deployment plan
    on the server where the admin server is located, when you deploy an application you deploy it to
    the cluster and everything is taken care off.
    More information on deployment plans can be found here: http://download.oracle.com/docs/cd/E11035_01/wls100/deployment/config.html

  • Looking up Identical EJB both locally and remotely

    prior to posting this request, i have read and
    attempted multiple solutions to this problem
    suggested in the forums to no avail.
    if i have the same EAR, which contains both
    an EJB Component and a WAR, deployed to multiple
    servers, is it possible to look up an EJB both
    locally and remotely?
    for instance, on the server performing the lookup,
    EJB A is deployed. i successfully look it up
    via the following call:
    InitialContext context = new InitialContext();
    Object ref = context.lookup(name);
    return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
    subsequently, i try to lookup the same ejb
    on a remote server by performing the following
    calls:
    Properties environment = new Properties();
    environment.put("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
    environment.put("java.naming.provider.url",
         "ormi://remoteserver:23791/application");
    environment.put( "java.naming.security.principal", "user");
    environment.put( "java.naming.security.credential", "password");
    jndiContext = new InitialContext(environment);
    Object ref = context.lookup(name);
    return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
    however, i either receive an authentican exception, saying "user"
    doesnt have access to allication "application", or a null pointer
    exception int the RMIInitialContext.
    on my local application, i have defined my ejbs in the web.xml
    as defined by the spec. the ejb component is marked as remote="false"
    in my orion-application.xml as well.
    the version of oc4j is 1.0.2.2.1.
    any directinon on this would be greatly appreciated.
    thanks,
    ted rice

    as a follow up to my own question, using a application
    client, outisde of the web application i can
    successfully look up my ejbs locally and remotely.
    however, from within the web application, i constantly
    receive a ClassCastException.
    if no one can tell me how to resolve this, could someone
    let me know if they have in fact looked up the
    same EJB, both deployed locally and remotely, from the
    same web application.
    thanks,
    ted

  • Difference between ejb 3.0 and hibernate

    Hi, I'm new at ejb 3.0 and I've read a little about Hibernate too, but there's one thing I don't understand. Could you tell me what's the difference between using ejb 3.0 and Hibernate, both of them are for persistence, and What about toplink?

    Hi, I'm new at ejb 3.0 and I've read a little about Hibernate too, but there's one thing I don't understand. Could you tell me what's the difference between using ejb 3.0 and Hibernate, both of them are for persistence, and What about toplink?

  • JDev 1013 BUG? EJB, CMR, DTO and session facade.

    I've created two CMP Entity EJB's, CourseEJB and PupilEJB, and defined a M:N relationship between them. A course has many pupils and vice versa. Each bean has only two attributes, id (Long, part of PK) and name (String) for simplicity.
    1. Generated DTO's for the two beans won't compile
    I get error on:
    public void addcourseEJBLocalDTO(courseEJBLocalDTO courseEJBLocalDTO)
    coursesDTO.add(courseEJBLocalDTO);
    courseEJBLocalDTO.setPupilsDTO(this);
    and:
    public void addPupilEJBLocalDTO(PupilEJBLocalDTO pupilEJBLocalDTO)
    pupilsDTO.add(pupilEJBLocalDTO);
    pupilEJBLocalDTO.setCoursesDTO(this);
    because JDev has created definitions of the setCoursesDTO function like this:
    public void setCoursesDTO(Collection<courseEJBLocalDTO> coursesDTO)
    this.coursesDTO = coursesDTO;
    and ditto for the setPupilsDTO method, taking a Collection as argument too.
    I can fix this code manually, but next step, generating a session Facade with added methods for handling the entity beans isn't exactly any better...
    One M:N relation is pretty basic, am I doing something wrong here?
    Message was edited by:
    jonmarti

    Forgot to add, running on 1013

  • Flash builder 4  compatible   myeclipse and  spring

    Hi ,
    i  did a project  using  flex 3 , spring 2.5 and  myeclipse 6.6  ,  i want to migrate it  to new  flash builder 4 .
    can some one  explain  what are "compatible  versions of  myeclipse  and  spring " for flash builder  4

    WSDL is not on public domain.
    Sending contents of wsdl
    <? 
    xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.4-b01-. -->

    definitions targetNamespace="http://webservice.flexsampleservlet.u0.deere.com/" name="CustomerWS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.flexsampleservlet.u0.deere.com/" xmlns="http://schemas.xmlsoap.org/wsdl/">
    <types>
    <xsd:schema>
    <xsd:import namespace="http://webservice.flexsampleservlet.u0.deere.com/" schemaLocation="CustomerWS_schema1.xsd"/>
    </xsd:schema>
    </types>
    Is import of xsd supported by flex webservice connection wizard
    Destination is configured correctly as I can make call to webservice using destination configured in LCDS from flex application

  • Can EJB 1.1 and EJB  2.0 Coexists ?

    Can EJB 1.1 and EJB 2.0 Coexists.
    We have an Application in EJB 1.1. We want to shift to EJB2.0.
    Do we need to change all the EJBs in one go or can we change one by one, the 2 versions existing together in the same EAR file ? We are using Weblogic 6.1.

    Migrating from Enterprise JavaBeansTM (EJBTM )1.1 to 2.0
    http://developer.java.sun.com/developer/technicalArticles/ebeans/ejbmigrate/

Maybe you are looking for

  • Satellite A200 does not play DVDs won't play

    I'm a first time user on this forum so hello to everyone. My problem is that my (Vista-running) A200 Satellite will not play DVDs. When I try I get the following message: "Windows Media Player cannot play DVD video. You might need to adjust your Wind

  • Not able to import BP from R3 to B1

    Hi, I  have followed the documents provided and successsfully set the landscape and now when i'm trying to send some Customers from R3 to B1 i'm not having any data transfer and the sad part is that i dont have an error msg too in the error inbox too

  • Search not returning desired result

    I am looking for a message in the Application Server/Portal Applications forum with the title "created new fields in form". I know this is the title because I printed out the message a while back. I wanted to go back to it to see if any further posts

  • Safari only prints blank pages

    Anyone help with Safari printing issue? It will only print blank pages, on my PC, although all other apps print just fine. I have the latest Safari version.

  • Shared DataSource

    Now that SSDT BI has been released for 2014 for a while, is it possible for a single shared DataSource to be referenced/used across SSRS Projects?  If not, why has this functionality been added yet?  With all the power and functionality of Visual Stu