我绝对同意glassfish logs,jdbc/legacy__pm
是无效的资源。在Enterprise项目及其模块中的任何地方都没有提到这样的文件,甚至文本。但是,有一个jdbc/legacy
资源。我不太清楚Netbeans fails to deploy the project的原因。
EJB模块的glassfish-resources.xml
文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_legacy_jdbcPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3306"/>
<property name="databaseName" value="legacy"/>
<property name="User" value="jdbc"/>
<property name="Password" value="password"/>
<property name="URL" value="jdbc:mysql://localhost:3306/legacy?zeroDateTimeBehavior=convertToNull"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="jdbc/legacy" object-type="user" pool-name="mysql_legacy_jdbcPool"/>
</resources>
EJB模块的persitence.xml
文件:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="EnterpriseLegacyJDBC-ejbPU" transaction-type="JTA">
<jta-data-source>jdbc/legacy</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>
企业应用程序正确构建为EAR:
post-compile:
compile:
pre-dist:
do-dist-without-manifest:
Skipped because property 'has.custom.manifest' set.
do-dist-with-manifest:
Setting project property: dist.jar.dir -> /home/thufir/NetBeansProjects/EnterpriseLegacyJDBC/dist
Created dir: /home/thufir/NetBeansProjects/EnterpriseLegacyJDBC/dist
fileset: Setup scanner in dir /home/thufir/NetBeansProjects/EnterpriseLegacyJDBC/build with patternSet{ includes: [] excludes: [] }
Building jar: /home/thufir/NetBeansProjects/EnterpriseLegacyJDBC/dist/EnterpriseLegacyJDBC.ear
adding directory META-INF/
adding entry META-INF/MANIFEST.MF
adding directory lib/
adding entry EnterpriseLegacyJDBC-ejb.jar
adding entry EnterpriseLegacyJDBC-war.war
adding entry lib/RemoteEJB.jar
adding entry lib/javaee-web-api-7.0.jar
No Implementation-Title set.No Implementation-Version set.No Implementation-Vendor set.
Location: /home/thufir/NetBeansProjects/EnterpriseLegacyJDBC/nbproject/build-impl.xml:249:
post-dist:
dist:
BUILD SUCCESSFUL (total time: 19 seconds)
具有以下结构:
thufir@dur:~$
thufir@dur:~$ jar -tf NetBeansProjects/EnterpriseLegacyJDBC/dist/EnterpriseLegacyJDBC.ear
META-INF/
META-INF/MANIFEST.MF
lib/
EnterpriseLegacyJDBC-ejb.jar
EnterpriseLegacyJDBC-war.war
lib/RemoteEJB.jar
lib/javaee-web-api-7.0.jar
thufir@dur:~$
我想手动部署,但是don't quite know where to put the RemoteEJB
JAR文件。
答案 0 :(得分:0)
我在使用>>> s = numbered_symbols('C')
>>> cform = ((exp(x)+cos(x)*x)/(x)).replace(
... lambda x:not x.is_Number,
... lambda x:x*next(s))
>>> cform
C1*C8*C9*(C2*C4*C5*x*cos(C3*x) + C7*exp(C6*x))/(C0*x)
>>> from sympy.solvers.ode import constantsimp, constant_renumber
>>> constantsimp(cform, [i for i in cform.atoms(Symbol) if i.name.startswith('C')])
C0*(C2*x*cos(C3*x) + C7*exp(C6*x))/x
>>> constant_renumber(_)
C1*(C2*x*cos(C3*x) + C4*exp(C5*x))/x
>>> eq = _
>>> cons = ordered(i for i in eq.atoms(Symbol) if i.name.startswith('C'))
>>> eq.xreplace(dict(zip(cons, var('a:z'))))
a*(b*x*cos(c*x) + d*exp(e*x))/x
时遇到了同样的问题,最简单的解决方案似乎是完全放弃glassfish-resources.xml
并改用glassfish-resources.xml
注释。
我的配置为@DataSourceDefinition
使用了单独的DataSourceBean.java
文件:
@DataSourceDefinition
@Singleton
@Startup
@DataSourceDefinition(name="java:global/jdbc/myDataSource",
className="com.microsoft.sqlserver.jdbc.SQLServerDataSource",
url="jdbc:sqlserver://127.0.0.1:1433;databaseName=myDB",
user="myuser",
password="mypassword"
)
public class DataSourceBean {
}
看起来像这样:
persistence.xml