[EJB 3.0] - How to get EnitityManager in SLSB without injection??
by ablevine1
Does anyone know how to get an EntityManager refernce from withing a statelesss session bean without using injection?? I have tried the following but with no success:
| EntityManagerFactory emf = getEntityManagerFactory("MyPersistenceUnitName");
| EntityManager em = emf.createEntityManager();
|
but this just fails with the following exception:
| javax.persistence.PersistenceException: No Persistence provider for EntityManager named PurchaseNotification
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
| at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
| at com.squaretrade.queueing.QueueingEngine.execute(QueueingEngine.java:36)
| at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
| ... 40 more
|
When I use injection it works
| @PersistenceContext(unitName = "MyPersistenceContext")
| EntityManager em;
|
But I need be able to get refernces to EntityManagers for various different perstence units on the fly from within my session bean so injection is not an option. any suggestions would be appreciated
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992358#3992358
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992358
19 years, 4 months
[JBossWS] - wstools and so
by mchamoun
i m having the following error when i try to generate jbossws artifacts
| Running JBossWS wstools for [IPayment]
| directory: C:\DATA\jboss-4.0.5.GA\bin
| command: cmd.exe /C wstools.bat -config C:\DOCUME~1\MIL~1\LOCALS~1\Temp\wstools-config48758.xml -dest C:\workspace1\TESTWS\TESTWS
| ========================================================================="
| .
| WSTools Environment
| .
| JBOSS_HOME: C:\DATA\jboss-4.0.5.GA\bin\\..
| .
| JAVA: C:\Program Files\Java\jdk1.5.0_09\bin\java
| .
| JAVA_OPTS:
| .
| ========================================================================="
| .
| Exception in thread "main" java.lang.NullPointerException
| at java.io.File.<init>(File.java:194)
| at org.jboss.ws.tools.helpers.ToolsHelper.handleWSDLToJavaGeneration(ToolsHelper.java:282)
| at org.jboss.ws.tools.WSTools.process(WSTools.java:138)
| at org.jboss.ws.tools.WSTools.generate(WSTools.java:120)
| at org.jboss.ws.tools.WSTools.main(WSTools.java:61)
|
and this is my wstools-config.xml
| <?xml version="1.0" encoding="UTF-8" ?>
| - <jbos:configuration xmlns:jbos="http://www.jboss.org/jbossws-tools">
| - <jbos:wsdl-java file="C:\DOCUME~1\MIL~1\LOCALS~1\Temp\tempdir48759.tmp\PaymentWS.wsdl" unwrap="true">
| <jbos:mapping file="jaxrpc-mapping.xml" />
| </jbos:wsdl-java>
| </jbos:configuration>
|
|
can someone please help me resolve this error
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992354#3992354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992354
19 years, 4 months
[Messaging, JMS & JBossMQ] - Re: namenotfound exception in JMS Client
by nsv
sorry misunderstood,
i tried without java: but still it doe not work, i get the same error
AlarmMgrConnectionFactory not bound
please see the below code
Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
| properties.put(Context.PROVIDER_URL, "localhost:3099");
| InitialContext ctx = new InitialContext(properties);
| Object obj = ctx.lookup("AlarmMgrConnectionFactory");
But in the server log file i see that AlarmMgrConnectionFactory jndiname is java:AlarmMgrConnectionFactory
below are the lines from the log file
2006-12-09 03:18:37,501 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Binding object 'org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl@c8f0a4' into JNDI at 'java:AlarmMgrConnectionFactory'
| 2006-12-09 03:18:37,501 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory' to JNDI name 'java:AlarmMgrConnectionFactory'
| 2006-12-09 03:18:37,501 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Started jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
| 2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory dependent components: []
| 2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] starting service jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
| 2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] Ignoring start request for service: jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
| 2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] starting service jboss.jca:service=TxCM,name=EventConnectionFactory
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992350#3992350
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992350
19 years, 4 months
[JBoss Portal] - Popup window from portlet?
by ekusnitz
JBoss Portal Version 2.4.1
Did you get Portal from CVS? or download it? download
JBoss AS Version jboss-4.0.5.GA
Database Vendor and Version Oracle 10g
JDBC Connector and Version - N/A
OS Platform Windows XP SP2
JBoss Seam 1.1.CR2
We have an application where we would like to do a popup window from our portlet. We are opening the wndow via javascript like this:
| var url = "/em/pages/em/feedbackPopup.xhtml?controlSetId=" + id;
| var winSettings = "center:yes;resizable:yes;dialogHeight:300px";
|
| window.open(url, null, winSettings);
|
By using the relative address, we want to cirumvent the portlet and call our Seam page directly. However, when we do so, we get the following error:
| 16:39:19,380 ERROR [STDERR] Dec 8, 2006 4:39:19 PM com.sun.facelets.FaceletViewHandler handleRenderException
| SEVERE: Error Rendering View[/pages/em/feedbackPopup.xhtml]
| java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade
| at com.sun.facelets.FaceletPortletViewHandler.createResponseWriter(FaceletPortletViewHandler.java:29)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:527)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| 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:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
So we are in the FaceletViewHandler, which makes sense because it's the one we are using in our /em application for the portlet. I guess it's looking for a RenderResponse when we have a simple HttpServletResonse. But it prevents us from doing what we need to do. Is there a way of doing a simple popup from a portlet?
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992349#3992349
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992349
19 years, 4 months