我在服务器上安装了glassfish,其中JMS ConnectionFactory设置了jms/MyConnectionFactory,其资源类型为javax.jms.ConnectionFactory.
我现在想从本地计算机上的客户端应用程序访问它,我有以下内容:
public static void main(String[] args) {
try{
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
env.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
env.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
env.setProperty("org.omg.CORBA.ORBInitialHost", "10.97.3.74");
env.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext initialContext = new InitialContext(env);
ConnectionFactory connectionFactory = null;
try {
connectionFactory = (ConnectionFactory)
initialContext.lookup("jms/MyConnectionFactory");
} catch (Exception e) {
System.out.println("JNDI API lookup failed: " + e.toString());
e.printStackTrace();
System.exit(1);
}
}catch(Exception e){ e.printStackTrace(System.err);
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行我的客户端时,我得到以下输出:
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
{org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=10.97.3.74, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
19-Mar-2010 16:09:13 org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2 …Run Code Online (Sandbox Code Playgroud) 我有一个带有许多 EJB 依赖项的 EAR。其中 2 个提供了对 glassfish-embedded-all jar 的范围依赖。但是,当我在本地计算机上进行 mvn 安装或通过 hudson 上的 Maven 构建应用程序时,耳朵始终包含 glassfish-embedded-all jar。
例如具有提供的依赖项的 DataAccess-ejb
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
具有 ejb 依赖性的应用程序 Ear
<dependency>
<groupId>com.xxx.yyy</groupId>
<artifactId>DataAccess-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
有什么想法我做错了什么或可能的建议吗?
干杯,
詹姆士
正如所建议的那样,我允许所有WPF UIElement都具有动态大小,因此可以轻松调整大小,但是,TextBlock我必须指定大小Font.这意味着当元素的大小增加或减少时,字体大小保持不变.有没有办法让Font尺寸变得动态?
我想让一个线程维护以不同间隔安排的多个任务的责任。我想从调度程序中添加和删除任务。有没有什么图书馆可以帮我这个忙。如果没有,我会自己编写代码,只是不想重新发明轮子。
对于后台,我想向我的应用程序添加警报,该警报是由一个线程控制的,应用程序的其余部分可以在其中添加/删除计划任务。我可以使用多个TimerTask或编写我自己的单线程调度程序,但是如果有更好的选择,我不想忽略它。
詹姆士
我有一个EJB项目,其@SingletonEJB定义为:
@LocalBean
@Singleton
@Startup
public class DataModelBean implements DataModelBeanLocal {
Run Code Online (Sandbox Code Playgroud)
然后,我有了另一个EJB项目和另一个EJB:
@LocalBean
@Singleton
@Startup
@EJB(beanInterface=DataModelBeanLocal.class,name="DataModelBeanLocal")
@DependsOn("DataModelBeanLocal")
public class OutboundRouting implements OutboundRoutingLocal {
Run Code Online (Sandbox Code Playgroud)
但是,该@DependsOn方法不起作用,我尝试了多种不同的值,但@DependsOn均未成功。服务器启动失败:
模块的部署错误:Atlas:部署应用程序时发生异常:java.lang.RuntimeException:EJB OutboundRouting %%% EOL %%%的DependsOn依赖性'DataModelBeanLocal'无效
我不确定在这里应该做什么,有什么建议吗?
我大约12个月前开始使用maven ear插件,想知道是否有其他选择.Maven的一个好处是依赖管理,但你似乎几乎完全失去了耳塞.它将所有依赖的jar构建到耳朵中,但实际上不会将它们中的任何一个放在类路径上而不添加以下配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4</version>
<configuration>
<version>6</version>
<modules>
<ejbModule>
<groupId>com.mycompany.app</groupId>
<artifactId>MyApplication-ejb</artifactId>
</ejbModule>
<jarModule>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
<jarModule>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
<jarModule>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
</modules>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我错过了一些更新版本的插件消除了对此的需求,是否有替代方案可以为您管理?我无法相信每次向模块添加依赖项时我需要将其添加到耳塞配置中.最令人沮丧的是,即使我记得在上面的配置中添加一个依赖库,如果它依赖于其他东西(就像轴的情况一样),我只是在部署耳朵时才发现.
我有一个简单的xaml控件,具有以下网格行定义:
<Grid.RowDefinitions>
<RowDefinition Height="15*" />
<RowDefinition Height="60*" />
<RowDefinition Height="20*" />
<RowDefinition Height="20*" />
<RowDefinition Height="15*" />
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)
每行1-3个包含一个文本块,其中可能包含或不包含文本.在后面的代码中,如果没有文本,我想最小化RowDefinition.基本上我的代码背后有以下内容:
if(textblock.Text != ""){
grid.RowDefinitions[elementRow].Height = new GridLength(20, GridUnitType.Star);
}
else{
grid.RowDefinitions[elementRow].Height = new GridLength(0, GridUnitType.Star);
}
Run Code Online (Sandbox Code Playgroud)
我希望第0行和第4行保留,因为它们在xaml中定义.不幸的是,即使第2行的文本块中有文本没有显示任何内容,这也不起作用.
难道我做错了什么.
任何帮助表示赞赏,
詹姆士
有谁可以帮助解释以下内容.我遇到了一个Dictionary的问题,其中ContainsKey,当对象Equals和GetHashCode对象都成功时,求值为false .下面是Visual Studio中即时窗口的输出:
?LocationToRackingGroup.Keys.ToArray()[23].Equals(location)
true
?LocationToRackingGroup.Keys.ToArray()[23] == (location)
true
?this.LocationToRackingGroup.ContainsKey(location)
false
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?任何想法都非常感谢.
我有一个实体,我想成为一个领域.
@Column(name = "TEMPRATURE_ZONE")
@Enumerated(STRING)
private TemperatureRegime tempratureZone;
Run Code Online (Sandbox Code Playgroud)
枚举定义如下:
public enum TemperatureRegime {
AMBIENT,
CHILL
}
Run Code Online (Sandbox Code Playgroud)
我在这个字段的表中的数据总是"AMBIENT"或"CHILL"但是当我在表上执行findAll查询时,我得到以下异常:
Exception [EclipseLink-116] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: No conversion value provided for the value [Chill] in field [LOCATION_GROUP.TEMPRATURE_ZONE].
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[tempratureZone-->LOCATION_GROUP.TEMPRATURE_ZONE]
Descriptor: RelationalDescriptor(com.company.location.LocationGroup --> [DatabaseTable(LOCATION_GROUP)])
Run Code Online (Sandbox Code Playgroud)
我看不出有什么问题,有什么想法吗?
干杯,
詹姆士
我有以下代码来布置页面菜单:
//Header Conainer Panel
VerticalPanel headerWidget = new VerticalPanel();
headerWidget.setWidth("100%");
//Header Panel
HorizontalPanel headerPanel = new HorizontalPanel();
headerPanel.setStyleName("header");
headerPanel.setWidth("100%");
Label title = new Label("Information System");
title.setStyleName("componentgap");
headerPanel.add(title);
headerWidget.add(headerPanel);
//Menu 1 Panel
HorizontalPanel menu = new HorizontalPanel();
menu.setStyleName("menu1");
menu.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
Label componentLabel = new Label("Component");
componentLabel.setStyleName("componentgap");
componentLabel.setWidth("50px");
menu.add(componentLabel);
//Outbound Routing Menu Item
final Label outRouteMenu = new Label("Routing");
outRouteMenu.setWidth("75px");
outRouteMenu.setStyleName("menu1button");
Run Code Online (Sandbox Code Playgroud)
我必须将headerPanel和headerWidget设置为100%,因为我希望首页栏占据屏幕的整个宽度。但是,当我将“标签”添加到菜单时,它们在屏幕上的间距均匀,而不是我想要的彼此相邻的左侧。如您所见,我试图显式设置标签的宽度,以强制它们更小,因此在菜单栏中彼此相邻。
有什么想法可以实现这一目标吗?您将看到我使用的样式包括以下这些样式,但会指出它们不影响组件的宽度。
谢谢,
詹姆士
目前我有这样的事情:

CSS:
.header {
background-color: #669966;
border-bottom-color: #003300;
border-right-color: #003300;
border-top-color: #99CC99;
border-left-color: #99CC99;
color: #FFFFFF;
padding: 0px; …Run Code Online (Sandbox Code Playgroud)