Solutions

Multiple databases or data source – Spring+Hibernate+JPA

When you are using mulitple databases or data sources or a remote database and a local database, you will run into following issue.

Expecting 1 but found mulitple data sources

we need to configure a persistence unit manager as follows:

<bean id="PersistenceUnitManager"
		class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
		<property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml">
		</property>
		<property name="dataSources">
			<map>
				<entry key="localDataSource" value-ref="myDataSource" />
				<entry key="remoteDataSource" value-ref="remoteDataSource" />
			</map>
		</property>
		<!-- if no datasource is specified, use this one : default data source definition-->
		<property name="defaultDataSource" ref="myDataSource" />
	</bean>
use persistence unit name while defining your entitymanager as follows:
@PersistenceContext(unitName="yourpersistenceunitnameasdefinedinpersistence.xml")
    private EntityManager em;
It works.

java.lang.NoClassDefFoundError: XMLGregorianCalendarImpl$Parser

I am using Weblogic Server 10.3, during deployment, I am getting this exception. When I deployed last time,  same code has worked well but now showing this error at runtime.

Sometimes this exception disappear after bouncing the server couple of times. I could see xerces-impl.jar in web-inf/lib.

 Solution:

Check whether you have any conflict of jar versions or may be this jar is included by any other jar. If you are sure that there is no conflict, try below steps.

It is nothing wrong with the code or jar or conflict, it happens when we do deployments repeatedly.

1. deploy your application

2. stop your server in case you have admin server where you are deploying your app. In case you have a cluster, stop all managed servers.

3. remove _WL_User folder from tmp directory.

4. restart your application.

Thats it, it works.

java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMod

I read in weblogic forum and found that there is a bug in weblogic 10.3 causing this issue. You can solve this issue by adding hibernate-jpa-2.0-api-1.0.0.Final.jar,  com.oracle.jpa2support_1.0.0.0_2-0.jar and javax.persistence_1.0.0.0_2-0-0.jar in the classpath of the server, i.e., setDomainEnv.sh or setDomainEnv.cmd

In case you are using cluster, add this path to

goto weblogic console>Environment>Servers

1. select each managed server

2. goto Server Start tab

3.  add or paste in classpath, click save.

4. restart your servers.

It works.

Anonymous comments in wordpress

When my users post a comment, it seems as Anonymous but I want to list users name.

Solution:

Some of your users list does not have display name, pls check in DB to make sure that all users have display_name filled in

thumbnails created but not shown

Hi I have a typical problem. I am using Image Manager version 2.3.7 and my wordpress version is 2.0.2.
I am using IE6 sp2.

I am able to upload images. I have seen its creating thumbnails as well. But thumbnails in the image manager
window are shown as names(the way like when image is not available) with X image icon. If i try to preview
images in server, i can see. But when i try to browse(from IIS also), I can not. Image is visible but thumbnails
are not visible.

I tried creating a folder under uploads and kept an image file and tried to browse, I can. When i copy one of the
thumbnail into the same directory and tried to browse, surprisingly system throwing 500: Internal Server Error.

solution:

I came to know that the default values under Image Manager options such thumb directory and thumb prefix not changed by my senior. I have changed them, its working fine. >Gopi


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: