[Beginners Corner] - Re: A new understanding of ClassLoaders...
by mbabauer
This is were my confussion lies.
In my example I have 4 units:
- HG-DataAccess.jar, which has the DOAs (model) and a spring context called componentContext.xml defining the "parent" context for Spring, and a beenRefFactory.xml that setups up the DataSources and all the hibernate stuff, in the root.
- HG-Service.jar that defines some service util classes (controller)
- HG-Service.war, which is the WAR stuff, and has a web.xml that uses the ContextLoaderListener to bootstrap the Spring stuff. This is done using an Spring context locally to build the requred stuff from the HG-Service.jar and the HG-Service.war, as well as defining the parent context as classpath:componentContext.xml
- HG.ear which comprises some combination of the above.
Upon deploy, the WAR kicks off the web.xml, which in tern loads the ContextLoaderListener, which then loads the local applicationContext.xml (local to the WAR) and the componentContext.xml (which is defined as "classpath:componentContext.xml", and should be found). I have tried putting HG-DataAccess.jar in the EAR, in the Server lib, and in the JBoss lib. No matter where I put it, I get the folliowing spewage:
13:00:07,109 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
| 13:00:07,117 ERROR [ContextLoader] Context initialization failed
| org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
| Caused by:
| java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
| at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)
| ...
Hence the confussion. If the WAR did indeed have visibility to the EAR, server lib, and JBoss lib, any one of the above combinations would not throw this error since anyone one of them would be visible *from* the WAR, which would then find the aformentioned componentContext.xml in the classpath.
When I put the HG-DataAccess.jar into the WAR, it loads just fine, but that defeats the whole "shared library" excercise.
My next step, I think, will be to add a dummy service to load the HG-DataAccess.jar's Spring context, have it put the classes that need to be shared in JNDI, and then pull them out on the WAR side from JNDI. This is not what I consider ideal.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020738#4020738
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020738
19Â years, 2Â months
[JBoss Seam] - Re: persist() / remove() at end of long running conversation
by mgombocz
Hi,
I have similar problems, so I did further tests based on
- JBoss AS 4.0.5.GA
- Seam CVS nightly build of 02/18/2007 (based on 1.1.6.GA)
- Hibernate as (preconfigured) JPA provider
My initial situation is the same like the one of m_hess (using SMPC and flushMode=FlushModeType.MANUAL):
anonymous wrote : Hi,
|
| I´m experimenting with Seam Managed long running atomic conversations right now. I succesfully managed to have changes made to existing entities get flushed when the @End method is called. This works fine so far and is conform to my understanding of a Seam Managed Transaction using @Begin and @End Annotations.
|
| My next step was to create a new entity during that conversation. To attach the new instance to the entityManager I´m using persist() (side note: tried merge() as well, no difference). What puzzles me, is that immediately when em.persist(myNewInstance) is called, an insert is happening (used the debugger to confirm this).
|
| I tested some more, and so far I can say, that it´s only the insert that is happening at the time persist() is called. When I have also made changes to the already existing entities in the same conversation, they are still correctly updated at the end of the conversation, not before.
I tested 2 scenarios:
1) Using @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) on relevant methods
The Entity's @Id field is annotated with @GeneratedValue (i.e. by default: strategy=AUTO).
After calling persist() no immediate SQL INSERTs are performed (-->correct).
BUT, by calling the method which calls flush() it causes an exception:
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Long, got class org.hibernate.action.DelayedPostInsertIdentifier
2) Using @GeneratedValue (strategy = GenerationType.SEQUENCE, ...) on Entity objects
By using Sequences SQL INSERTs will performed after calling flush(). No @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) annotation is required (-->very good).
BUT, not all RDBMS systems, like e.g. MySQL, support sequences. :-(
re. 1) Has anybody made the same experience or do I something wrong?
re. 2) Are there other ways that are supported by all RDBMS or at least MySQL?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020737#4020737
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020737
19Â years, 2Â months
[Clustering/JBoss] - Re: HAJNDI.list() broken on JBoss 4.0.X?
by schaefera
I am using an external context 'org.jboss.naming.ExternalContext' which federates in the JNDI context of a remote JBoss AS. Because I am using HA-JMS on that remote JBoss AS I need to use the HAJNDI rather than a local JBoss Naming Server because I do not know which server does actually host the HA-JMS at that time. Here is my external context defintion:
| <mbean code="org.jboss.naming.ExternalContext"
| name=":service=ExternalContext,jndiName=external/context" >
| <attribute name="JndiName">external/context</attribute>
| <attribute name="Properties">
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=host1:1100,host2:110
| </attribute>
| <attribute name="InitialContext">javax.naming.InitialContext</attribute>
| <attribute name="RemoteAccess">true</attribute>
| </mbean>
|
In addition JNDIView MBean has an entry at the bottom that should list the entries in the HAJNDI but it is always empty because HAJNDI.list() is returning an empty list.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020732#4020732
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020732
19Â years, 2Â months