fuser -n tcp portAlternatively, you can use netstat:
netstat -nlp | grep port
For a while I would see the following exception at random times in logs while using JPA in Spring.:
org.springframework.transaction.CannotCreateTransactionException:Turns out the
Could not open JPA EntityManager for transaction;
nested exception is javax.persistence.PersistenceException:
Exception [TOPLINK-28013] (Oracle TopLink Essentials - 2.1 (Build 60 (11/17/2008))):
oracle.toplink.essentials.exceptions.EntityManagerSetupException
Exception Description: Attempted to deploy PersistenceUnit [harborPU]
while being in the wrong state [Undeployed].
Close all factories for this PersistenceUnit.
org.springframework.dao.InvalidDataAccessApiUsageException:Therefore, I had to call the method from within the class using the DAO that made the call to the method involved in the transaction.
Attempting to execute an operation on a closed EntityManager.;
nested exception is java.lang.IllegalStateException:
Attempting to execute an operation on a closed EntityManager.
I wonder if this has something to do with my transaction setup:
<bean id="entityManagerFactory"If you have any insight, please leave a comment :).
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
<property name="database" value="MYSQL"/>
<property name="showSql" value="true" />
<!-- set to true if you want the vendor to create the database for you on startup -->
<property name="generateDdl" value="false" />
</bean>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<!-- interface to my DAO
<aop:advisor pointcut="execution(* *..MyDaoService.*(..))" advice-ref="txAdvice"/>
</aop:config>
$ sudo mount -t smbfs -o username=myWindowsLogin,password=myWindowsPassword,uid=prystasj,gid=prystasj,file_mode=000,dir_mode=000 //myWindowsBox/share /shareThe answer was to install smbfs.
mount: wrong fs type, bad option, bad superblock on //prystash-j.mycompany.org/share,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
$ dmesg | tail
...
[19838.333431] smb_fill_super: missing data argument
...
$ sudo apt-get install smbfsUnfortunately, as myself or root, I'm not able to write anything to /share from my Linux host, but I can read just fine.
$ sudo mount -t smbfs -o username=myWindowsLogin,password=myWindowsPassword,uid=prystasj,gid=prystasj,file_mode=000,dir_mode=000 //myWindowsBox/share /share
$ sudo ls -ld /shareWill have to investigate more later.
d--------- 1 prystasj prystasj 0 2009-02-02 15:41 /share
# Location of your Mule installation.Then I finally got what I was looking for in my mule.log and was able to attach to port 5005 in Eclipse:
wrapper.java.additional.1=-Dmule.home="%MULE_HOME%"
wrapper.java.additional.1.stripquotes=TRUE
wrapper.java.additional.2=-Dmule.base="%MULE_BASE%"
wrapper.java.additional.2.stripquotes=TRUE
# Javaagent for certain load time weavers
wrapper.java.additional.3=-javaagent:/opt/mule-2.1.1/lib/user/spring-agent-2.5.3.jar
# Debug remotely, the application will wait for the external debugger to connect.
# original line:
# wrapper.java.additional.4=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
wrapper.java.additional.4=-Xdebug
wrapper.java.additional.5=-Xnoagent
wrapper.java.additional.6=-Djava.compiler=NONE
wrapper.java.additional.7=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
--> Wrapper Started as Daemon
------------------------------------------------------------------------
The JVM is being launched with a debugger enabled and could possibly be
suspended. To avoid unwanted shutdowns, timeouts will be disabled,
removing the ability to detect and restart frozen JVMs.
------------------------------------------------------------------------
Launching a JVM...
Listening for transport dt_socket at address: 5005
Starting the Mule Server...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
$ mysqldump -uroot -ppassword mydb > mydb.mysqlTo recreate the database:
$ mysqladmin -uroot -ppassword drop mydb
$ mysqladmin -uroot -ppassword create mydb
$ mysql -uroot -ppassword mydb < mydb.mysql
$ sudo cpan ppI got this error:
/usr/bin/ld: cannot find -lperlI saw a suggestion to install libperl-dev, but I had that package already up-to-date.
collect2: ld returned 1 exit status
make[1]: *** [par] Error 1
make[1]: Leaving directory `/home/prystasj/.cpan/build/PAR-Packer-0.982-zX8GIO/myldr'
make: *** [subdirs] Error 2
SMUELLER/PAR-Packer-0.982.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
lrwxrwxrwx 1 root root 15 2009-01-23 15:28 /usr/lib/libperl.so -> libperl.so.5.10To:
lrwxrwxrwx 1 root root 15 2009-01-23 15:28 /usr/lib/libperl.so -> libperl.so.5.10.0I was able to install pp:
$ which pp
/usr/local/bin/pp
The relevant MySQL for the table:
<entity class="Foo" name="Foo" access="FIELD">
<table name="Foo"/>
<attributes>
<id name="id">
<column name="ID" nullable="false"/>
<generated-value strategy="SEQUENCE"/>
</id>
...
</table>
</entity>
CREATE TABLE FOORegardless of whether or not the id property was null or not, it was not updated after the following call to persist():
(
ID INT NOT NULL AUTO_INCREMENT,
...
PRIMARY KEY(ID)
)
Foo foo = new Foo();
getJpaTemplate().persist(foo);
if (logger.isDebugEnabled())
logger.debug(foo.getId()) // null
Foo foo = new Foo();I'm not sure why the flush() was necessary. A similar issue is also discussed here: Spring Forums Post.
getJpaTemplate().persist(foo);
getJpaTemplate().flush();
if (logger.isDebugEnabled())
logger.debug(foo.getId()) // outputs the assigned id