[jboss-user] [EJB 3.0] - Re: @PersistenceUnit on private javax.persistence.EntityMana
JGF1
do-not-reply at jboss.com
Thu Mar 6 18:14:27 EST 2008
"ALRubinger" wrote : Nope...your exception is complaining about a lack of default persistence unit. Please take a look at http://trailblazer.demo.jboss.com/EJB3Trail/persistence
|
Have taken a look at this. But now I have a different problem:
Here is my persistence.xml
| persistence>
| <persistence-unit name="stkcmp">
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto"
| value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
Here is the the updated StockList bean, with exception & unitName to tie in with xml file above:
| package beans;
|
| import beans.Stock;
| import javax.persistence.PersistenceContext;
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
|
| @Stateless
| public class StockListBean implements StockList {
|
| // The reference to the entity manager
| @PersistenceContext(unitName="stkcmp")
| private EntityManager _manager;
|
| // The public business methods. These must be coded in the
| // interface also
|
| public String getStock(String ticker) throws StockException {
| Stock stock = _manager.find(Stock.class, ticker);
| if (stock == null) {
| throw new StockException();
| }
| return stock.getName();
| }
|
| public void addStock(String ticker, String name) throws StockException {
| Stock stock = _manager.find(Stock.class, ticker);
| if (stock != null) {
| throw new StockException();
| }
| _manager.persist(new Stock(ticker, name));
| }
|
| public void updateStock(String ticker, String name) throws StockException {
| Stock stock = _manager.find(Stock.class, ticker);
| if (stock == null) {
| throw new StockException();
| }
| stock.setName(name);
| }
|
| public void deleteStock(String ticker) throws StockException {
| Stock stock = _manager.find(Stock.class, ticker);
| if (stock == null) {
| throw new StockException();
| }
| _manager.remove(stock);
| }
| }
|
Here is the error log:
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] Copying file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3 -> C:\apps\jboss-4.2.2.GA\server\all\tmp\deploy\tmp56278StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] using deployer MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.ejb3.EJB3Deployer] looking for nested deployments in : file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.DeploymentInfo] createLoaderRepository from config: LoaderRepositoryConfig(repositoryName: JMImplementation:service=LoaderRepository,name=Default, repositoryClassName: null, configParserClassName: null, repositoryConfig: null)
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3 at f1bb78, cl=org.jboss.mx.loading.UnifiedClassLoader3 at b6be69{ url=file:/C:/apps/jboss-4.2.2.GA/server/all/tmp/deploy/tmp56278StockListApp.ejb3 ,addedOrder=0}
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3 at f1bb78, cl=org.jboss.mx.loading.UnifiedClassLoader3 at b6be69{ url=file:/C:/apps/jboss-4.2.2.GA/server/all/tmp/deploy/tmp56278StockListApp.ejb3 ,addedOrder=0}
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] Adding org.jboss.mx.loading.UnifiedClassLoader3 at b6be69{ url=file:/C:/apps/jboss-4.2.2.GA/server/all/tmp/deploy/tmp56278StockListApp.ejb3 ,addedOrder=0}
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] found 0 subpackages of file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] Watching new file: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.deployment.MainDeployer] create step for deployment file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,265 DEBUG [org.jboss.ejb3.EJB3Deployer] create, StockListApp.ejb3
| 2008-03-06 23:00:47,296 DEBUG [org.jboss.ejb3.EJB3Deployer] Deploying: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,296 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| 2008-03-06 23:00:47,296 DEBUG [org.jboss.ejb3.Ejb3Module] Creating jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| 2008-03-06 23:00:47,343 DEBUG [org.jboss.ejb3.Ejb3AnnotationHandler] found EJB3: ejbName=StockListBean, class=beans.StockListBean, type=STATELESS
| 2008-03-06 23:00:47,406 ERROR [org.jboss.ejb3.entity.PersistenceXmlLoader] Error parsing XML: XML InputStream(1) Content is not allowed in prolog.
| 2008-03-06 23:00:47,406 DEBUG [org.jboss.ejb3.Ejb3Module] Initialization failed jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| org.xml.sax.SAXParseException: Content is not allowed in prolog.
| at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
| at org.jboss.ejb3.entity.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:91)
| at org.jboss.ejb3.entity.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:104)
| at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:535)
| at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:329)
| at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.create(Unknown Source)
| at org.jboss.system.ServiceController.create(ServiceController.java:330)
| at org.jboss.system.ServiceController.create(ServiceController.java:273)
| at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy33.create(Unknown Source)
| at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:492)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy34.create(Unknown Source)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy9.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
| 2008-03-06 23:00:47,406 WARN [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| org.xml.sax.SAXParseException: Content is not allowed in prolog.
| at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
| at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
| at org.jboss.ejb3.entity.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:91)
| at org.jboss.ejb3.entity.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:104)
| at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:535)
| at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:329)
| at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.create(Unknown Source)
| at org.jboss.system.ServiceController.create(ServiceController.java:330)
| at org.jboss.system.ServiceController.create(ServiceController.java:273)
| at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy33.create(Unknown Source)
| at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:492)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:76)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy34.create(Unknown Source)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy9.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
| 2008-03-06 23:00:47,437 DEBUG [org.jboss.deployment.MainDeployer] Done with create step of deploying StockListApp.ejb3
| 2008-03-06 23:00:47,437 DEBUG [org.jboss.deployment.MainDeployer] Begin deployment start file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.ejb3.EJB3Deployer] start application, deploymentInfo: org.jboss.deployment.DeploymentInfo at fe1c38ab { url=file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3 }
| deployer: MBeanProxyExt[jboss.ejb3:service=EJB3Deployer]
| status: Starting
| state: START_DEPLOYER
| watch: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| altDD: null
| lastDeployed: 1204844447265
| lastModified: 1204844447265
| mbeans:
| , short name: StockListApp.ejb3, parent short name: null
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.system.ServiceController] Ignoring start request for service: jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| 2008-03-06 23:00:47,453 INFO [org.jboss.ejb3.EJB3Deployer] Deployed: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: StockListApp.ejb3
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,453 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Watch URL for: file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3 -> file:/C:/apps/jboss-4.2.2.GA/server/all/deploy/StockListApp.ejb3
| 2008-03-06 23:00:47,453 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Incomplete Deployment listing:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| State: FAILED
| Reason: org.xml.sax.SAXParseException: Content is not allowed in prolog.
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: jboss.j2ee:service=EJB3,module=StockListApp.ejb3
| State: FAILED
| Reason: org.xml.sax.SAXParseException: Content is not allowed in prolog.
|
Seems to be some sort of XML parsing error.
Can't see why this is, since all I did was modify name
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134705#4134705
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134705
More information about the jboss-user
mailing list